diff --git a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java index 0961d98..1a60d21 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java @@ -1,28 +1,48 @@ 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(); + int i = 0; - void setup(DataFlowModel graph) { + public void setup(DataFlowModel graph) { this.graph = graph; } - boolean check() { + public boolean check() { boolean result = true; + Map root = new HashMap<>(); for (Node node : graph.getResourceDependencyGraph().getNodes()) { if (node.getIndegree() > 1) result = false; } for (Node node : graph.getResourceDependencyGraph().getNodes()) { if (node.getIndegree() == 0) { - for (Node out : node.getSuccessors()) { - - } + root.put(i,search(node,false)); } } return result; } + + private Node search(Node node, boolean reverse) { + Setstep = new HashSet<>(); + if (reverse) { + for (Node out : node.getSuccessors()) { + return search(out,reverse); + } + } else { + for (Node out : node.getPredecessors()) { + return search(out,reverse); + } + } + i++; + return node; + } }