diff --git a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java index b049931..5bf5410 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithm/UpdateConflictCheck.java @@ -6,55 +6,23 @@ import models.dataFlowModel.DataFlowModel; public class UpdateConflictCheck { - DataFlowModel graph = new DataFlowModel(); - List order = new ArrayList<>(); - Map comp = new HashMap<>(); - List> set = new ArrayList<>(); - int index = 0; + private Map unvisit = new HashMap<>(); + private List list = new LinkedList<>(); - public void setup(DataFlowModel graph) { - this.graph = graph; - } - - public boolean check() { - boolean result = true; - for (Node node : graph.getResourceDependencyGraph().getNodes()) { - if (node.getIndegree() > 1) { - result = false; - break; + private void visit(Node node) { + if (unvisit.get(node)) { + for (Node n : node.getSuccessors()) { + visit(n); + list.add(node); } } - 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)); - } - if (set.size() > 1) - result = false; - return result; } - private Node dfs(Node n) { - for (Node out : n.getSuccessors()) { - if (!comp.containsValue(out)) { - return dfs(out); - } - } - index++; - comp.put(index, n); - return n; + private void assign(Node u1, Node u2) { + } - private Node assign(Node n) { - for (Node out : n.getPredecessors()) { - - } - return n; + public boolean run(DataFlowModel model) { + return false; } }