Remove tasks that are not really initial from the initial and end tasks
FEA: ItEr74S04BugFixing
This commit is contained in:
parent
f1f9074647
commit
f82b20bbd1
3 changed files with 48 additions and 3 deletions
|
|
@ -1930,6 +1930,23 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
|
|||
return result;
|
||||
}
|
||||
|
||||
public boolean hasVisibleIncomingDependencies(V task) {
|
||||
return isSomeVisible(graph.incomingEdgesOf(task));
|
||||
}
|
||||
|
||||
public boolean hasVisibleOutcomingDependencies(V task) {
|
||||
return isSomeVisible(graph.outgoingEdgesOf(task));
|
||||
}
|
||||
|
||||
private boolean isSomeVisible(Set<D> dependencies) {
|
||||
for (D each : dependencies) {
|
||||
if (adapter.isVisible(each)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<V> getLatestTasks() {
|
||||
List<V> tasks = new ArrayList<V>();
|
||||
|
||||
|
|
|
|||
|
|
@ -121,13 +121,37 @@ public class CriticalPathCalculator<T, D extends IDependency<T>> {
|
|||
}
|
||||
|
||||
private InitialNode<T, D> createBeginningOfProjectNode() {
|
||||
return new InitialNode<T, D>(new HashSet<T>(removeContainers(graph
|
||||
return new InitialNode<T, D>(
|
||||
removeWithVisibleIncomingDependencies(removeContainers(graph
|
||||
.getInitialTasks())));
|
||||
}
|
||||
|
||||
|
||||
private Set<T> removeWithVisibleIncomingDependencies(Collection<T> tasks) {
|
||||
Set<T> result = new HashSet<T>();
|
||||
for (T each : tasks) {
|
||||
if (!graph.hasVisibleIncomingDependencies(each)) {
|
||||
result.add(each);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private LastNode<T, D> createEndOfProjectNode() {
|
||||
return new LastNode<T, D>(new HashSet<T>(removeContainers(graph
|
||||
.getLatestTasks())));
|
||||
return new LastNode<T, D>(
|
||||
removeWithVisibleOutcomingDependencies(removeContainers(graph
|
||||
.getLatestTasks())));
|
||||
}
|
||||
|
||||
private Set<T> removeWithVisibleOutcomingDependencies(
|
||||
Collection<T> removeContainers) {
|
||||
Set<T> result = new HashSet<T>();
|
||||
for (T each : removeContainers) {
|
||||
if (!graph.hasVisibleOutcomingDependencies(each)) {
|
||||
result.add(each);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<T, Node<T, D>> createGraphNodes() {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ public interface ICriticalPathCalculable<T> {
|
|||
|
||||
List<T> getLatestTasks();
|
||||
|
||||
boolean hasVisibleIncomingDependencies(T task);
|
||||
|
||||
boolean hasVisibleOutcomingDependencies(T task);
|
||||
|
||||
Set<T> getIncomingTasksFor(T task);
|
||||
|
||||
Set<T> getOutgoingTasksFor(T task);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue