newStatements.addStatement( new JExpressionStatement( new SIRPopExpression(sj.getInputType(),rep.splitter)));
int itemsConsumed; if (isDup) { itemsConsumed = rep.splitter; } else {   itemsConsumed = rep.splitter * sj.size(); } newStatements.addStatement(new JExpressionStatement(new SIRPopExpression(sj.getInputType(),itemsConsumed)));
    private static JMethodDeclaration makeWorkFunction(SIRSplitJoin sj,                                                       List children,                                                       SRepInfo rep) {        // see whether or not we have a duplicate        boolean isDup = sj.getSplitter().getType()==SIRSplitType.DUPLICATE;        // see whether or not we have a RR with unary weights (Unary RR)        boolean isURR = sj.getSplitter().isUnaryRoundRobin();        // Build the new work function; add the list of statements        // from each of the component filters.        JBlock newStatements = new JBlock(null, new LinkedList(), null);        FindVarDecls findVarDecls = new FindVarDecls();        Iterator childIter = children.iterator();        int i=0;        while (childIter.hasNext())            {                SIRFilter filter = (SIRFilter)childIter.next();                // Get the statements of the old work function                JBlock statements = filter.getWork().getBody();//                //replace variable accesses with numbered variables//                if (KjcOptions.rename1) {//                    statements = (JBlock)findVarDecls.findAndReplace(statements);//                }                // Make a for loop that repeats these statements according                // to reps                JStatement loop = Utils.makeForLoop(statements, rep.child[i]);                // test the original statements (rather than the loop,                // since it cascades pops and peeks) for whether or                // not there are pops before peeks                boolean popBeforePeek = Utils.popBeforePeek(statements);                // if we have a duplicating splitter, we need to make                // pops into peeks                if (isDup) {                    loop = popToPeek(loop, popBeforePeek, 0, 1);                }                 // if we have unary round-robin, multiply all indices                // to tapes by the number of children                if (isURR) {                    loop = popToPeek(loop, popBeforePeek, i, sj.size());                }                // add the loop to the new work function                newStatements.addStatement(Utils.peelMarkers(loop));                i++;            }        // add a pop loop to statements that pops the right number of        // times for the splitjoin        if ((isDup || isURR) && rep.splitter > 0) {            newStatements.addStatement(                                       new JExpressionStatement(                                                                new SIRPopExpression(sj.getInputType(),rep.splitter)));                                    // Utils.makeForLoop(new JExpressionStatement(null,            //                new SIRPopExpression(sj.getInputType()), null),            //                rep.splitter));        }//        //add variable declarations calculated by FindVarDecls//        if (KjcOptions.rename1) {//            findVarDecls.addVariableDeclarations(newStatements);//        }        // Now make a new work function based on this.        JMethodDeclaration newWork =            new JMethodDeclaration(null,                                   at.dms.kjc.Constants.ACC_PUBLIC,                                   CStdType.Void,                                   "work",                                   JFormalParameter.EMPTY,                                   CClassType.EMPTY,                                   newStatements,                                   null,                                   null);        return newWork;    }