diff --git a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java index b6689a2..9f1ccba 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java @@ -9,7 +9,7 @@ DataFlowModel graph = new DataFlowModel(); List order = new ArrayList<>(); Map comp = new HashMap<>(); - int i = 0; + List> set = new ArrayList<>(); int index = 0; public void setup(DataFlowModel graph) { @@ -24,24 +24,34 @@ break; } } + while (comp.size() < graph.getResourceDependencyGraph().getNodes().size()) { + for (Node node : graph.getResourceDependencyGraph().getNodes()) { + if (node.getIndegree() == 0) { + dfs(node); + break; + } + } + } + for (int i = index; i > 0; i--) { + assign(comp.get(i)); + } return result; } - private Node dfs(Node n, boolean reverse) { - order.add(index); + private Node dfs(Node n) { + for (Node out : n.getSuccessors()) { + if (!comp.containsValue(out)) { + return dfs(out); + } + } + index++; comp.put(index, n); - if (!reverse) { - for (Node in : n.getSuccessors()) { - if (comp.containsValue(in)) { - return dfs(in, reverse); - } - } - } else { - for (Node in : n.getPredecessors()) { - if (comp.containsValue(in)) { - return dfs(in, reverse); - } - } + return n; + } + + private Node assign(Node n) { + for (Node out : n.getPredecessors()) { + } return n; }