Iterator i = current_ops.iterator();
for (SIROperator oper : current_ops) {
    private void findNextPhase() {        Iterator i = current_ops.iterator();        // iterate over nodes in current phase        while (i.hasNext()) {            SIROperator oper = (SIROperator)i.next();            Vector<NetStream> out = RegisterStreams.getNodeOutStreams(oper);            // case: splitjoin splitter, make sure to schedule 0-weight edges, which will not            // be found by RegisterStreams.getNodeOutStreams.  Also record the number of            // incoming edges to the associated joiner so that the joiner's continuation will            // not be processed until all of the joiner's predecessors have been processed.            if (oper instanceof SIRSplitter && ! (oper.getParent() instanceof SIRFeedbackLoop)) {                assert oper.getParent() instanceof SIRSplitJoin;                SIRSplitter splitter = (SIRSplitter)oper;                SIRJoiner joiner = ((SIRSplitJoin)splitter.getParent()).getJoiner();                assert (! splitjoinJoiners.containsKey(joiner));                int join_ways = RegisterStreams.getNodeInStreams(                        joiner).size();                if (join_ways > 0) {                    splitjoinJoiners.put(joiner, join_ways);                }                                                       List<SIROperator> splitterChildren = ((SIRSplitJoin)(splitter.getParent())).getChildren();                int[] splitterWeights = splitter.getWeights();                int j = 0;                for (SIROperator child : splitterChildren) {                    // getChildren includes the splitter and joiner as well as the                    // stream children.  We are only interested in the stream children                    if (child instanceof SIRStream && splitterWeights[j++] == 0) {                            next_ops.add(streamChild(child));                       }                }            }            // check all nodes that are downstream from nodes in current phase            for (int a = 0; a < out.size(); a++) {                        SIROperator next =                     NodeEnumerator.getOperator(out.elementAt(a).getDest());                                /*                 * Here: if phases.containsKey, would be very surprised unless it is the                 * joiner of a feedbackloop.  In a feedbackloop need to schedule the loop before                 * the continuation. If a feedbackloop splitter has both a loop edge                 * and a contiuation edge then we have to modify the order in which we                 * iterate.                 */                // check if no phase assigned yet                if (!phases.containsKey(next)) {                     // case: next is joiner at top of feedbackloop.                    // we need to remember its splitter so as to not process the continuation                    // of the feedbackloop before _both_ the body and loop portions are processed.                    if (next instanceof SIRJoiner && next.getParent() instanceof SIRFeedbackLoop) {                        // first encounter with feedbackloop joiner (or would have had phases.containsKey(next))                        SIRSplitter loopSplitter = ((SIRFeedbackLoop)next.getParent()).getSplitter();                        // debugging: this should be first encounter with this feedbackloop joiner                        assert ! feedbackSplittersBody.contains(loopSplitter) && ! feedbackSplittersLoop.contains(loopSplitter);                        int split_ways =  RegisterStreams.getNodeOutStreams(loopSplitter).size();                        assert split_ways <= 2;                        // if non-degenerate feedback loop, then need some fancy work when encounter splitter                        if (split_ways == 2) {                            feedbackSplittersBody.add(loopSplitter);                        }                    }                                         // case: next is splitter at bottom of feedbackloop and body has been processed                    // indicate that loop now needs to be processed.                    if (next instanceof SIRSplitter && next.getParent() instanceof SIRFeedbackLoop                            && feedbackSplittersBody.contains(next)) {                        // if encounter splitter of non-degenerate feedbackloop, we "discover it"                        // and go from processing body to processing loop.                        feedbackSplittersBody.remove(next);                        feedbackSplittersLoop.add(next);                    }                    // case: oper (parent of next) is the splitter at the bottom of a feedback loop.                         // if still processing feedbackloop, do not "discover" loop's continuation (the                    // the first child of the splitter)                    if (a == 0 && oper instanceof SIRSplitter && feedbackSplittersLoop.contains(oper)) {                        continue;                    }                    // case: splitjoin joiner: do not process until all paths into joiner are                     // processed.  (So should never be 'discovered' more than once.)                    if (next instanceof SIRJoiner                            && !(next.getParent() instanceof SIRFeedbackLoop)) {                        assert next.getParent() instanceof SIRSplitJoin;                        SIRJoiner joiner = (SIRJoiner) next;                        assert splitjoinJoiners.containsKey(joiner);                        int join_ways_remaining = splitjoinJoiners.get(joiner);                        if (join_ways_remaining > 1) {                            splitjoinJoiners.put(joiner, join_ways_remaining - 1);                            continue;                        } else {                            splitjoinJoiners.remove(joiner);                        }                    }                                        // case? can it occur:                    // feedbackloop with split (1,0) == no execution of loop (back edge) portion.                } else {                                        // case: joiner at top of feedback loop is seen twice: once at entry to feedback loop                    // and once after processing the loop.                    assert next instanceof SIRJoiner && next.getParent() instanceof SIRFeedbackLoop                      && (feedbackSplittersLoop.contains(((SIRFeedbackLoop)next.getParent()).getSplitter())                              || RegisterStreams.getNodeInStreams(((SIRFeedbackLoop)next.getParent()).getSplitter()).size() < 2 )                        : "Node " + next + "is not the joiner of a FeedBackLoop being processed" ;                      // have processed body and loop, continuation is next                      SIRSplitter loopSplitter = ((SIRFeedbackLoop)next.getParent()).getSplitter();                      if (feedbackSplittersLoop.remove(loopSplitter)) {                          Vector<NetStream> nexts = RegisterStreams.getNodeOutStreams(loopSplitter);                          next = NodeEnumerator.getOperator(                                  nexts.elementAt(0).getDest());                      } else {                          // case: there is no continuation (saw joiner twice since processed loop                          // but no entry in feedbackSplittersLoop since didn't have both loop and                          // continuation.                          continue;                      }                }                phases.put(next, number_of_phases + 1);                next_ops.add(next);                // System.out.println("Operator: "+next+                // " assigned to phase: "+                // (number_of_phases+1));            }        }    }