private static SIRFilter fuse(List filters) {     SIRFilter result = new SIRFilter();   RenameAll renamer = new RenameAll(); for (ListIterator it=filters.listIterator(); it.hasNext(); ) { renamer.renameFilterContents((SIRFilter)it.next()); }   List filterInfo = makeFilterInfo(filters);   JMethodDeclaration initWork =  makeWork(filterInfo, true);   JMethodDeclaration steadyWork =  makeWork(filterInfo, false);   JMethodDeclaration init = makeInitFunction(filterInfo, initWork, result);   makeFused(filterInfo, init, initWork, steadyWork, result);   return result;
public static void fuse(SIRPipeline pipe) { 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(pipe, (SIRFilter)pipe.get(start), (SIRFilter)pipe.get(end)); System.out.println("Fusing " + (end-start+1) + " filters!"); } start = end + 1; } while (start < pipe.size()-1);
    private static SIRFilter fuse(List filters) {	// construct a dummy result to be filled in later.  This is	// necessary because in the process of patching the parent	// init function, we need to know about the new target.  Not a	// perfect solution.	SIRFilter result = new SIRFilter();	// rename the components of the filters	RenameAll renamer = new RenameAll();	for (ListIterator it=filters.listIterator(); it.hasNext(); ) {	    renamer.renameFilterContents((SIRFilter)it.next());	}	// construct set of filter info	List filterInfo = makeFilterInfo(filters);	// make the initial work function	JMethodDeclaration initWork =  makeWork(filterInfo, true);	// make the steady-state work function	JMethodDeclaration steadyWork =  makeWork(filterInfo, false);	// make the fused init functions	JMethodDeclaration init = makeInitFunction(filterInfo, 						   initWork, 						   result);	// fuse all other fields and methods	makeFused(filterInfo, init, initWork, steadyWork, result);		// return result	return result;    }