int numEliminated = 0; int start = 0; do {  while (start < pipe.size()-1 && !isFusable(pipe.get(start))) { start++; }  int end = start; while ((end+1) < pipe.size() && isFusable(pipe.get(end+1))) { end++; }  if (end > start) { fuse((SIRFilter)pipe.get(start), (SIRFilter)pipe.get(end)); numEliminated += end-start; System.err.println("Fusing " + (end-start+1) + " Pipeline filters!"); } start = end + 1; } while (start < pipe.size()-1);   if (pipe.size()==1 && pipe.get(0) instanceof SIRFilter && pipe.getParent()!=null) { Lifter.eliminatePipe(pipe); } return numEliminated;
return doFuse(pipe, pipe.size());
    public static int fuse(SIRPipeline pipe) {	int numEliminated = 0;	int start = 0;	do {	    // find start of candidate stretch for fusion	    while (start < pipe.size()-1 && !isFusable(pipe.get(start))) {		start++;	    }	    // find end of candidate stretch for fusion	    int end = start;	    while ((end+1) < pipe.size() && isFusable(pipe.get(end+1))) {		end++;	    }	    // if we found anything to fuse	    if (end > start) {		fuse((SIRFilter)pipe.get(start),		     (SIRFilter)pipe.get(end));		numEliminated += end-start;		System.err.println("Fusing " + (end-start+1) + " Pipeline filters!");	    }	    start = end + 1;	} while (start < pipe.size()-1);	// if pipe is down to a single filter and we're not at the	// toplevel already, then eliminate the pipeline	if (pipe.size()==1 && 	    pipe.get(0) instanceof SIRFilter &&	    pipe.getParent()!=null) {	    Lifter.eliminatePipe(pipe);	}	return numEliminated;    }