我正在尝试做一个while循环,它将遍历java优先级队列并读取队列日期的顶部。它具有日期值,查看队列的其余部分以查看该日期是否正在其他地方使用,如果是,则将这些元素临时添加到它们自己的队列中,以便我可以调用不同的比较器方法来对它们进行排序。
public JobRequest closestDeadlineJob(int freeCPUS) {
// find top job to determine if other jobs for date need to be considered
JobRequest nextJob = scheduledJobs.peek(); // return top most job
// what is it's date?
Date currentDate = nextJob.getConvertedDeadlineDate();
JobPriorityQueue schedulerPriorityQueue = new JobPriorityQueue();
schedulerPriorityQueue.addJob( nextJob );
while(true) {
}
// this is the item at the top of the PRIORTY JOB queue to return
// remove that item from scheduledJobs
// return null; // replace with to the one you want to return
}
到目前为止我所拥有的,你看的不是很多