Fixed critical path to take into account backwards planning.

FEA: ItEr67OTS05AdaptacionCaminhoCriticoPlanificacionBackwards
This commit is contained in:
Manuel Rego Casasnovas 2011-01-03 16:10:57 +01:00
parent b89537e74f
commit 4648aa8754
4 changed files with 24 additions and 4 deletions

View file

@ -2013,6 +2013,11 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
return adapter.getStartConstraintsFor(task);
}
@Override
public List<Constraint<GanttDate>> getEndConstraintsFor(V task) {
return adapter.getEndConstraintsFor(task);
}
@Override
public GanttDate getStartDate(V task) {
return adapter.getStartDate(task);

View file

@ -263,7 +263,7 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
Node<T, D> node = nodes.get(task);
DependencyType dependencyType = getDependencyTypeEndStartByDefault(
currentTask, task);
Constraint<GanttDate> constraint = getDateConstraint(task);
Constraint<GanttDate> constraint = getDateStartConstraint(task);
switch (dependencyType) {
case START_START:
@ -302,7 +302,7 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
node.setEarliestStart(earliestStart);
}
private Constraint<GanttDate> getDateConstraint(T task) {
private Constraint<GanttDate> getDateStartConstraint(T task) {
if (task == null) {
return null;
}
@ -315,6 +315,19 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
return Constraint.coalesce(constraints);
}
private Constraint<GanttDate> getDateEndConstraint(T task) {
if (task == null) {
return null;
}
List<Constraint<GanttDate>> constraints = graph
.getEndConstraintsFor(task);
if (constraints == null) {
return null;
}
return Constraint.coalesce(constraints);
}
private void backward(Node<T, D> currentNode, T nextTask) {
T currentTask = currentNode.getTask();
int latestStart = currentNode.getLatestStart();
@ -338,7 +351,7 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
Node<T, D> node = nodes.get(task);
DependencyType dependencyType = getDependencyTypeEndStartByDefault(
task, currentTask);
Constraint<GanttDate> constraint = getDateConstraint(task);
Constraint<GanttDate> constraint = getDateEndConstraint(task);
switch (dependencyType) {
case START_START:

View file

@ -59,6 +59,8 @@ public interface ICriticalPathCalculable<T> {
List<Constraint<GanttDate>> getStartConstraintsFor(T task);
List<Constraint<GanttDate>> getEndConstraintsFor(T task);
List<T> getChildren(T task);
}

View file

@ -2786,7 +2786,7 @@ public class CriticalPathCalculatorTest {
@Test
public void oneTaskWithTwoDependantTasksLastOneWithEqualConstraint2() {
givenOneTaskWithTwoDependantTasksLastOneWithEqualConstraint(2, 5, 3,
START.plusDays(3));
START.plusDays(4));
List<ITaskFundamentalProperties> criticalPath = buildCalculator()
.calculateCriticalPath(diagramGraphExample);