private void addNodeStatechart(statechart.Node node, String fatherLabel) { if (root.getLabel().equals(fatherLabel)) root.getChildren().add(node); else { DFSAdd(root, fatherLabel, node); } }
private IAC.Node StatechartNodeToIACNode(statechart.Node node) { if (node == null) return null; IAC.Node item = IACFactory.eINSTANCE.createNode(); item.setActivity(node.getActivity()); item.setLabel(node.getLabel()); item.setName(node.getName()); item.setType(node.getType()); if (node.getFather_of() != null) item.getFather_of().add(getNodeIAC(node.getFather_of().getLabel())); return item; }
private statechart.Node DFSAdd(Node root, String label, statechart.Node node) { Iterator<Node> it = root.getChildren().iterator(); statechart.Node search = null; while (it.hasNext()) { search = it.next(); if (search.getLabel().equals(label)) { search.getChildren().add((Node) node); return search; } else if (search.getChildren().size() > 0) { Node newsearch = DFSAdd(search, label, node); if (newsearch != null) { return newsearch; } } } return null; }
private statechart.Node DFSearch(statechart.Node root, String label) { Iterator<Node> it = root.getChildren().iterator(); statechart.Node search = null; while (it.hasNext()) { search = it.next(); if (search.getLabel().equals(label)) { // System.out.println("Label : " + search.getLabel()); return search; } else if (search.getChildren().size() > 0) { statechart.Node newsearch = DFSearch(search, label); if (newsearch != null) return newsearch; } } // if(search!=null) // System.out.println("To teleutaio "+ search.getLabel()); return null; }
private statechart.Node getNodeStateChart(String label) { if (root.getLabel().equals(label)) return root; else return DFSearch(root, label); }