public static SIRStream fuse(SIRSplitJoin sj) {
public static SIRStream fuse(SIRSplitJoin sj,int[] partition) { if(partition.length==1) return fuse(sj);
    public static SIRStream fuse(SIRSplitJoin sj)    {	// dispatch to simple fusion	SIRStream dispatchResult = dispatchToSimple(sj);	if (dispatchResult!=null) {	    return dispatchResult;	}	if (!isFusable(sj)) {	    return sj;	} else {	    System.err.println("Fusing " + (sj.size()) + " SplitJoin filters!"); 	}	// get copy of child streams and rename them        List children = sj.getParallelStreams();	doRenaming(children);	// calculate some helper information	RepInfo rep = RepInfo.calcReps(sj);	Rate rate = calcRate(sj, rep);	SJChildInfo[] childInfo = makeSJChildInfo(children, rep, rate);        // make some components        JFieldDeclaration[] newFields = makeFields(sj, childInfo);        JMethodDeclaration[] newMethods = makeMethods(sj, children);        JMethodDeclaration newInit = makeInitFunction(sj, childInfo);	// make the new initwork, work functions	JMethodDeclaration newInitWork = makeInitWorkFunction(sj, childInfo, rep, rate);        JMethodDeclaration newWork = makeWorkFunction(sj, childInfo, rep, rate);	String newName = FusePipe.getFusedName(sj.getParallelStreams());	        // Build the new filter.  If there's no pushing or peeking        // from initwork, then just inline the initwork in the init function	SIRFilter newFilter;	if (rate.initPeek==0 && rate.initPush==0) {	    newInit.getBody().addAllStatements(newInitWork.getBody().getStatements());	    newFilter = new SIRFilter(sj.getParent(), newName, 						    newFields, newMethods, 						    new JIntLiteral(rate.peek),						    new JIntLiteral(rate.pop), 						    new JIntLiteral(rate.push),						    newWork, 						    sj.getInputType(), sj.getOutputType());	} else {	    newFilter = new SIRTwoStageFilter(sj.getParent(), newName,						    newFields, newMethods, 						    new JIntLiteral(rate.peek),						    new JIntLiteral(rate.pop), 						    new JIntLiteral(rate.push),						    newWork, 						    rate.initPeek, rate.initPop, rate.initPush,						    newInitWork,						    sj.getInputType(), sj.getOutputType());	}        // Use the new init function        newFilter.setInit(newInit);	// replace in parent	sj.getParent().replace(sj, newFilter);	// if we're the only filter left in parent, eliminate parent	/*if (sj.getParent() instanceof SIRPipeline &&	  sj.getParent().size()==1 && 	  sj.getParent().getParent()!=null) {	  Lifter.eliminatePipe((SIRPipeline)sj.getParent());	  }*/        return newFilter;    }