Trace[] tempArray = (Trace[])partitioner.getTraceGraph().clone(); Arrays.sort(tempArray, new CompareTraceBNWork(partitioner)); LinkedList sortedTraces = new LinkedList(Arrays.asList(tempArray));
initSchedule = InitSchedule.getInitSchedule(partitioner.topTraces);
    public void schedule()     {	//sort traces...	Trace[] tempArray = (Trace[])partitioner.getTraceGraph().clone();	Arrays.sort(tempArray, 		    new CompareTraceBNWork(partitioner));	LinkedList sortedTraces = new LinkedList(Arrays.asList(tempArray));	currentTime = 0;		//set all the available times to zero	tileAvail = new int[rawChip.getTotalTiles()];	for (int i = 0; i < rawChip.getTotalTiles(); i++)	    tileAvail[i] = 0;	//schedule predefined filters first, but don't put them in the 	//schedule just assign them tiles...	removePredefined(sortedTraces);	//reverse the list	Collections.reverse(sortedTraces);	//start to schedule the traces	while (!sortedTraces.isEmpty()) {	    Trace trace = (Trace)sortedTraces.get(0);	    System.out.println("Trying to schedule " + trace);	    while (true) {		HashMap layout = canScheduleTrace(trace);		//if we cannot schedule this trace...		if (layout == null) {		    //try to schedule other traces that will fit before the 		    //room becomes available for this trace		    while (scheduleSmallerTrace(sortedTraces, trace)) {}		    //increment current time to next smallest avail time		    currentTime = nextTime(currentTime);		}		else {		    scheduleTrace(layout, trace, sortedTraces);		    break;		}	    }	}		//set up dependencies	setupDepends();	initSchedule = InitSchedule.getInitSchedule(partitioner.topTraces);    }