Bug #1354: Fix bug

Although the constraint is not applied it must be provided. Otherwise
the dominating forces would not take it into account. Normally this
wasn't a problem since if the secondary point date changes it was
provided. But it can happen that the secondary point doesn't change,
in that case the constraint must still be taken into account.
This commit is contained in:
Óscar González Fernández 2012-03-01 12:10:17 +01:00 committed by Jacobo Aragunde Pérez
parent 03ccf5d885
commit a9e5ae5cbe

View file

@ -1730,15 +1730,17 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
.withConstraints(restrictions.getStartConstraints())
.withConstraints(getStartConstraints())
.applyWithoutFinalCheck();
if (result != null && !result.equals(getStartDate(task))) {
return enforceRestrictions(result);
if (result != null) {
enforceRestrictions(result);
return biggerThan(result, adapter.getEndDateFor(task));
}
return restrictions;
}
private PositionRestrictions enforceRestrictions(GanttDate result) {
adapter.setStartDateFor(task, result);
return biggerThan(result, adapter.getEndDateFor(task));
private void enforceRestrictions(GanttDate result) {
if (!result.equals(getStartDate(task))) {
adapter.setStartDateFor(task, result);
}
}
}
@ -1752,8 +1754,9 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
.withConstraints(restrictions.getEndConstraints())
.withConstraints(getEndConstraints())
.applyWithoutFinalCheck();
if (result != null && !result.equals(getEndDateFor(task))) {
return enforceRestrictions(result);
if (result != null) {
enforceRestrictions(result);
return lessThan(adapter.getStartDate(task), result);
}
return restrictions;
}
@ -1768,11 +1771,11 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
return adapter.getEndConstraintsFor(task);
}
private PositionRestrictions enforceRestrictions(GanttDate newEnd) {
adapter.setEndDateFor(task, newEnd);
return lessThan(adapter.getStartDate(task), newEnd);
private void enforceRestrictions(GanttDate newEnd) {
if (!newEnd.equals(getEndDateFor(task))) {
adapter.setEndDateFor(task, newEnd);
}
}
}
@Override