null,
newWork,
    public static SIRStream flatten(SIRSplitJoin sj)    {        // Things that we use often:        SIRSplitter splitter = sj.getSplitter();        SIRJoiner joiner = sj.getJoiner();        boolean dupSplitter;                // Check that we meet the conditions; return the original        // split/join if we don't.        if (splitter.getType() == SIRSplitType.DUPLICATE)            dupSplitter = true;        else if (splitter.getType() == SIRSplitType.ROUND_ROBIN ||                 splitter.getType() == SIRSplitType.WEIGHTED_RR)            dupSplitter = false;        else            return sj;        if (joiner.getType() != SIRJoinType.ROUND_ROBIN &&            joiner.getType() != SIRJoinType.WEIGHTED_RR)            return sj;                // Check the ratios.        Iterator childIter = sj.getParallelStreams().iterator();        int i = 0;        int maxPeek = 0;        int pushes = 0;        while (childIter.hasNext())        {            SIRStream str = (SIRStream)childIter.next();            if (!(str instanceof SIRFilter))                return sj;            SIRFilter filter = (SIRFilter)str;            if (dupSplitter && filter.getPopInt() != 1)                return sj;            if (splitter.getType() == SIRSplitType.ROUND_ROBIN &&                filter.getPopInt() != 1)                return sj;            if (splitter.getType() == SIRSplitType.WEIGHTED_RR &&                filter.getPopInt() != splitter.getWeights()[i])                return sj;            if (!dupSplitter && filter.getPeekInt() != filter.getPopInt())                return sj;            if (joiner.getType() == SIRJoinType.ROUND_ROBIN &&                filter.getPushInt() != 1)                return sj;            if (joiner.getType() == SIRJoinType.WEIGHTED_RR &&                filter.getPushInt() != joiner.getWeights()[i])                return sj;            // Looks okay.  Increment counts for things.            if (filter.getPeekInt() > maxPeek)                maxPeek = filter.getPeekInt();            if (joiner.getType() == SIRJoinType.ROUND_ROBIN)                pushes++;            else if (joiner.getType() == SIRJoinType.WEIGHTED_RR)                pushes += filter.getPushInt();            i++;        }        // Rename all of the child streams of this.        RenameAll ra = new RenameAll();        List children = new LinkedList();        Iterator iter = sj.getParallelStreams().iterator();        while (iter.hasNext())        {            SIRFilter str = (SIRFilter)iter.next();            children.add(ra.renameFilter(str));        }        // So at this point we have an eligible split/join; flatten it.        JMethodDeclaration newWork =            getWorkFunction(sj, children, dupSplitter);        JFieldDeclaration[] newFields = getFields(sj, children);        JMethodDeclaration[] newMethods = getMethods(sj, children);        // Make names of things within the split/join unique.        ra.findDecls(newFields);        ra.findDecls(newMethods);        for (i = 0; i < newFields.length; i++)            newFields[i] = (JFieldDeclaration)newFields[i].accept(ra);        for (i = 0; i < newMethods.length; i++)            newMethods[i] = (JMethodDeclaration)newMethods[i].accept(ra);        newWork = (JMethodDeclaration)newWork.accept(ra);        // Get the init function now, using renamed names of things.        JMethodDeclaration newInit = getInitFunction(sj, children, ra);        // Build the new filter.        SIRFilter newFilter = new SIRFilter(sj.getParent(),                                            "SJFlatten_" + sj.getIdent(),                                            newFields,                                            newMethods,                                            new JIntLiteral(maxPeek),                                            // For now, pop fixed at 1.                                            new JIntLiteral(1),                                            new JIntLiteral(pushes),                                            null,                                            sj.getInputType(),                                            sj.getOutputType());                // Use the new init function.        newFilter.setInit(newInit);        // Replace the init function in the parent.        RenameAll.replaceParentInit(sj, newFilter);        return newFilter;    }