* @param value - value of interval (an wmount of work (duration), not units)
*/
private void setWorkInterval(long start, long end, double value) {
moveDelayToContour();
long assignmentStart = getStart(); // the start including any delay
WorkCalendar cal = getEffectiveWorkCalendar();
if (end > getFinish()) { // add end if necessary
if (value == 0) {
this.setEnd(start);
return; // don't extend if value is 0
}
makeContourPersonal();
long extraDuration = cal.compare(end,getFinish(),false);
setDurationMillis(getDurationMillis() + extraDuration);
AbstractContour contour = PersonalContour.addEmptyBucket(getWorkContour(), extraDuration,true);
newDetail().setWorkContour(contour);
// adjust task end too
if (end > getTask().getEnd())
getTask().setEnd(end);
} else if (start < assignmentStart) { // if before assignment start
// if (value == 0)
// return; // don't extend if value is 0
long taskStart = getTask().getStart();
if (start < taskStart) {
long shiftAmount = cal.compare(taskStart,start, false);
setDurationMillis(getDurationMillis() + shiftAmount);
if (!getWorkContour().isPersonal())
makeContourPersonal();
newDetail().setWorkContour(PersonalContour.addEmptyBucket(getWorkContour(), shiftAmount,false)); // add empty space before
getTask().setScheduleConstraintAndUpdate(ConstraintType.SNLT, start); // this can set start before project duration.
taskStart = getTask().getStart();
}
assignmentStart = taskStart;
}
long startDuration = cal.compare(start,assignmentStart,false);
long endDuration = cal.compare(end,assignmentStart,false);
if (startDuration == endDuration)
return;
if (!getWorkContour().isPersonal())
makeContourPersonal();