Date startDate, Date endDate) {
c.setTime(startDate);
int startDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
c.setTime(endDate);
int endDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
TaskLength duration = myTaskManager.createLength(timeUnit,
startDate, endDate);
DayType dayType = getTaskManager().getCalendar()
.getWeekDayType(startDayOfWeek);
dayType = getTaskManager().getCalendar().getDayTypeDate(
startDate);
return new DayTypeAlternance(dayType, duration, endDate);
}
void createAlternance(TimeUnit timeUnit, TimeFrame timeFrame, List output) {
DayType startType = null;
Date startDate = null;
int unitCount = timeFrame.getUnitCount(timeUnit);
for (int i=0; i<unitCount; i++) {
Date start = timeFrame.getUnitStart(timeUnit, i);
c.setTime(start);
int startDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
DayType dayType = getTaskManager().getCalendar().getWeekDayType(startDayOfWeek);
if (startType==null) {
startType = dayType;
startDate = start;
}
if (startType!=dayType) {
Date end = timeFrame.getUnitFinish(timeUnit,i-1);
TaskLength duration = myTaskManager.createLength(timeUnit, startDate, end);
output.add(new DayTypeAlternance(startType, duration, end));
startType = dayType;
startDate = start;
}
}
Date end = timeFrame.getUnitFinish(timeUnit,unitCount-1);
TaskLength duration = myTaskManager.createLength(timeUnit, startDate, end);
output.add(new DayTypeAlternance(startType, duration, end));
}
}