Remove ICriticalPathCalculable from Node.
FEA: ItEr63OTS05CalculoCaminoCritico
This commit is contained in:
parent
dd1df00131
commit
031ca51aaf
4 changed files with 19 additions and 21 deletions
|
|
@ -91,13 +91,11 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
|
|||
}
|
||||
|
||||
private InitialNode<T, D> createBeginningOfProjectNode() {
|
||||
return new InitialNode<T, D>(new HashSet<T>(graph.getInitialTasks()),
|
||||
graph);
|
||||
return new InitialNode<T, D>(new HashSet<T>(graph.getInitialTasks()));
|
||||
}
|
||||
|
||||
private LastNode<T, D> createEndOfProjectNode() {
|
||||
return new LastNode<T, D>(new HashSet<T>(graph.getLatestTasks()),
|
||||
graph);
|
||||
return new LastNode<T, D>(new HashSet<T>(graph.getLatestTasks()));
|
||||
}
|
||||
|
||||
private Map<T, Node<T, D>> createGraphNodes() {
|
||||
|
|
@ -106,7 +104,8 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
|
|||
for (T task : graph.getTasks()) {
|
||||
Node<T, D> node = new Node<T, D>(task, graph
|
||||
.getIncomingTasksFor(task),
|
||||
graph.getOutgoingTasksFor(task), graph);
|
||||
graph.getOutgoingTasksFor(task), graph.getStartDate(task),
|
||||
graph.getEndDateFor(task));
|
||||
result.put(task, node);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,8 @@ import org.zkoss.ganttz.data.IDependency;
|
|||
*/
|
||||
public class InitialNode<T, D extends IDependency<T>> extends Node<T, D> {
|
||||
|
||||
public InitialNode(Set<? extends T> nextTasks,
|
||||
ICriticalPathCalculable<T> graph) {
|
||||
super(null, null, nextTasks, graph);
|
||||
public InitialNode(Set<? extends T> nextTasks) {
|
||||
super(null, null, nextTasks, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,9 +31,8 @@ import org.zkoss.ganttz.data.IDependency;
|
|||
*/
|
||||
public class LastNode<T, D extends IDependency<T>> extends Node<T, D> {
|
||||
|
||||
public LastNode(Set<? extends T> previousTasks,
|
||||
ICriticalPathCalculable<T> graph) {
|
||||
super(null, previousTasks, null, graph);
|
||||
public LastNode(Set<? extends T> previousTasks) {
|
||||
super(null, previousTasks, null, null, null);
|
||||
}
|
||||
|
||||
public void updateLatestValues() {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
|||
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.zkoss.ganttz.data.GanttDate;
|
||||
import org.zkoss.ganttz.data.IDependency;
|
||||
|
||||
|
||||
|
|
@ -46,12 +47,19 @@ public class Node<T, D extends IDependency<T>> {
|
|||
private Integer latestStart = null;
|
||||
private Integer latestFinish = null;
|
||||
|
||||
private ICriticalPathCalculable<T> graph;
|
||||
private LocalDate beginDate = null;
|
||||
private LocalDate endDate = null;
|
||||
|
||||
public Node(T task, Set<? extends T> previousTasks,
|
||||
Set<? extends T> nextTasks, ICriticalPathCalculable<T> graph) {
|
||||
Set<? extends T> nextTasks, GanttDate startDate, GanttDate endDate) {
|
||||
this.task = task;
|
||||
this.graph = graph;
|
||||
|
||||
if (startDate != null) {
|
||||
this.beginDate = new LocalDate(startDate.toDayRoundedDate());
|
||||
}
|
||||
if (endDate != null) {
|
||||
this.endDate = new LocalDate(endDate.toDayRoundedDate());
|
||||
}
|
||||
|
||||
this.earliestStart = 0;
|
||||
this.earliestFinish = getDuration();
|
||||
|
|
@ -111,16 +119,9 @@ public class Node<T, D extends IDependency<T>> {
|
|||
return 0;
|
||||
}
|
||||
|
||||
LocalDate beginDate = new LocalDate(graph.getStartDate(task)
|
||||
.toDayRoundedDate());
|
||||
LocalDate endDate = getTaskEndDate();
|
||||
return Days.daysBetween(beginDate, endDate).getDays();
|
||||
}
|
||||
|
||||
private LocalDate getTaskEndDate() {
|
||||
return new LocalDate(graph.getEndDateFor(task).toDayRoundedDate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Task: " + getDuration() + " (" + earliestStart + ","
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue