ItEr32S09ValidacionEProbasFuncionaisItEr31S12: [Bug #66] Removing duplication

This commit is contained in:
Óscar González Fernández 2009-10-26 19:56:56 +01:00
parent f26348e1ae
commit dd19e8a59b
3 changed files with 14 additions and 20 deletions

View file

@ -346,12 +346,7 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
map.put(date, hours);
}
if (zoomByDay()) {
return map;
} else {
return groupByWeek(map);
}
return convertAsNeededByZoom(map);
}
/**
@ -378,12 +373,7 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
map.put(day, map.get(day) + hours);
}
}
if (zoomByDay()) {
return map;
} else {
return groupByWeek(map);
}
return convertAsNeededByZoom(map);
}
}

View file

@ -83,7 +83,7 @@ public abstract class LoadChartFiller implements ILoadChartFiller {
}
private LocalDate nextDay(LocalDate date) {
if (zoomByDay()) {
if (isZoomByDay()) {
return date.plusDays(1);
} else {
return date.plusWeeks(1);
@ -101,7 +101,7 @@ public abstract class LoadChartFiller implements ILoadChartFiller {
}
private LocalDate convertAsNeededByZoom(LocalDate date) {
if (zoomByDay()) {
if (isZoomByDay()) {
return date;
} else {
return getThursdayOfThisWeek(date);
@ -192,7 +192,7 @@ public abstract class LoadChartFiller implements ILoadChartFiller {
return date.dayOfWeek().withMinimumValue().plusDays(DAYS_TO_THURSDAY);
}
protected boolean zoomByDay() {
private boolean isZoomByDay() {
return zoomLevel.equals(ZoomLevel.DETAIL_FIVE);
}
@ -230,4 +230,12 @@ public abstract class LoadChartFiller implements ILoadChartFiller {
return result;
}
protected SortedMap<LocalDate, Integer> convertAsNeededByZoom(SortedMap<LocalDate, Integer> map) {
if (isZoomByDay()) {
return map;
} else {
return groupByWeek(map);
}
}
}

View file

@ -518,11 +518,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
}
}
if (zoomByDay()) {
return map;
} else {
return groupByWeek(map);
}
return convertAsNeededByZoom(map);
}
private SortedMap<LocalDate, Integer> calculateHoursAdditionByDay(