Пример #1
0
 /** Visit each predecessor of this node applying the given visitor. Breadth first. */
 private <Alpha, Beta> void doVisitPredecessors(
     Visitor<Alpha, Beta> visitor, Alpha arg1, Beta arg2, Set<GraphNode> seen) {
   if (seen.add(this)) {
     Collection<GraphNode> allKill = null;
     for (Iterator<GraphNode> i = pred.iterator(); i.hasNext(); ) {
       GraphNode pred = i.next();
       List<GraphNode> kill = visitor.visit(pred, this, arg1, arg2);
       if (kill != null) {
         if (allKill == null) allKill = new ArrayList<GraphNode>();
         allKill.addAll(kill);
       }
     }
     if (allKill != null) pred.removeAll(allKill);
     for (Iterator<GraphNode> i = pred.iterator(); i.hasNext(); ) {
       GraphNode pred = i.next();
       pred.doVisitPredecessors(visitor, arg1, arg2, seen);
     }
   }
 }
Пример #2
0
 /**
  * Return an iterator over all the indirect successors of this node. This does NOT include aliases
  * of successors and is used for graph maintenance.
  */
 public Iterator<GraphNode> iteratorOverSuccessors() {
   return succClosed.iterator();
 }
Пример #3
0
 @Override
 Iterator<GraphNode> siblingIterator() {
   return components.iterator();
 }