ItEr33S14CUCreacionUnidadesPlanificacion: Using constraints to calculate end date

This commit is contained in:
Óscar González Fernández 2009-11-07 17:03:17 +01:00
parent 3c3c8a1014
commit f444c2f457

View file

@ -136,10 +136,18 @@ public class GanttDiagramGraph {
enforceEndDate(incoming);
}
@SuppressWarnings("unchecked")
private void enforceEndDate(Set<Dependency> incoming) {
Date endDate = task.getEndDate();
Date newEnd = Dependency.calculateEnd(task, endDate, incoming);
if (!endDate.equals(newEnd)) {
Constraint<Date> currentLength = task.getCurrentLengthConstraint();
Constraint<Date> respectStartDate = task
.getEndDateBiggerThanStartDate();
Date newEnd = Constraint.<Date> initialValue(null)
.withConstraints(currentLength)
.withConstraints(Dependency
.getEndConstraints(incoming))
.withConstraints(respectStartDate)
.apply();
if (!task.getEndDate().equals(newEnd)) {
task.setEndDate(newEnd);
}
}