private void dfs(WGraph g, Vertex vertex, Set mark) { Stack s = new Stack(); newnode: // this is an obvious hack to allow a 'goto' statement do { // despite java's "prohibition". mark.add(vertex); s.push( vertex.getOutgoingEdges().iterator()); // s.push(((CFGraphable)node).succC().iterator()); while (!s.isEmpty()) { for (Iterator i = (Iterator) s.pop(); i.hasNext(); ) { SequenceEdge e = (SequenceEdge) i.next(); Object cq = g.edge(e).CQclass; List l = (List) equiv.get(cq); if (l == null) { l = new LinkedList(); equiv.put(cq, l); } l.add(e); // append edge to end of list. elements.add(e); // recurse if (!mark.contains(e.getTarget())) { s.push(i); vertex = e.getTarget(); continue newnode; // recurse to top of procedure. } } } break; } while (true); // not really a loop. Just a block. }
public Node otherEnd(Node n) { RealNode rn = (RealNode) n; /* RealEdge connects RealNodes */ return node(hce.getSource().equals(rn.node) ? hce.getTarget() : hce.getSource()); }