[Bug #871] Fixed problem in critical path when dependencies are violated by constraints.

FEA: ItEr71S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2011-03-01 18:48:30 +01:00
parent 6537c64484
commit 9af91d31d7

View file

@ -264,7 +264,7 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
Node<T, D> node = nodes.get(task);
DependencyType dependencyType = getDependencyTypeEndStartByDefault(
currentTask, task);
Constraint<GanttDate> constraint = getDateStartConstraint(task);
Constraint<GanttDate> constraint = getDateConstraints(task);
switch (dependencyType) {
case START_START:
@ -303,30 +303,26 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
node.setEarliestStart(earliestStart);
}
private Constraint<GanttDate> getDateStartConstraint(T task) {
private Constraint<GanttDate> getDateConstraints(T task) {
if (task == null) {
return null;
}
List<Constraint<GanttDate>> constraints = graph
List<Constraint<GanttDate>> startConstraints = graph
.getStartConstraintsFor(task);
if (constraints == null) {
return null;
}
return Constraint.coalesce(constraints);
}
private Constraint<GanttDate> getDateEndConstraint(T task) {
if (task == null) {
return null;
}
List<Constraint<GanttDate>> constraints = graph
List<Constraint<GanttDate>> endConstraints = graph
.getEndConstraintsFor(task);
if (constraints == null) {
if ((startConstraints == null) && (endConstraints == null)) {
return null;
}
return Constraint.coalesce(constraints);
if (startConstraints == null) {
return Constraint.coalesce(endConstraints);
}
if (endConstraints == null) {
return Constraint.coalesce(startConstraints);
}
startConstraints.addAll(endConstraints);
return Constraint.coalesce(startConstraints);
}
private void backward(Node<T, D> currentNode, T nextTask) {
@ -352,7 +348,7 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
Node<T, D> node = nodes.get(task);
DependencyType dependencyType = getDependencyTypeEndStartByDefault(
task, currentTask);
Constraint<GanttDate> constraint = getDateEndConstraint(task);
Constraint<GanttDate> constraint = getDateConstraints(task);
switch (dependencyType) {
case START_START: