diff --git a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java index 1a60d21..be9642a 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java @@ -1,15 +1,14 @@ package algorithm; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; import models.*; import models.dataFlowModel.DataFlowModel; public class UpdateConflictCheck { DataFlowModel graph = new DataFlowModel(); + Map comp = new HashMap<>(); int i = 0; public void setup(DataFlowModel graph) { @@ -26,20 +25,28 @@ for (Node node : graph.getResourceDependencyGraph().getNodes()) { if (node.getIndegree() == 0) { root.put(i,search(node,false)); + break; } } + for(int j=root.size();j<0;j--) { + search(root.get(j), true); + } return result; } private Node search(Node node, boolean reverse) { - Setstep = new HashSet<>(); + comp.put(node, true); if (reverse) { for (Node out : node.getSuccessors()) { - return search(out,reverse); + if(comp.containsKey(out)) { + return search(out,reverse); + } } } else { for (Node out : node.getPredecessors()) { - return search(out,reverse); + if(comp.containsKey(out)) { + return search(out,reverse); + } } } i++;