Methods Summary |
---|
public void | addTask(PriorityTask task, int day)
if (day < 0 || day >= FORWARD_PLANNING_DAYS)
throw new IllegalArgumentException("day out of range");
StoppableTaskQueue daysTaskQueue = schedule.get(day);
if (daysTaskQueue.addTask(task)) return; //2
// StoppableTaskQueue.addTask returns false only when called on
// a queue that has been shut down. In that case, it will also
// have been removed by now, so it's safe to try again.
if (! schedule.get(0).addTask(task)) {
throw new IllegalStateException("failed to add task " + task);
}
|
java.util.ListIterator | getSubSchedule(int startDay, int endDay)
return schedule.subList(startDay, endDay).listIterator();
|
public PriorityTask | getTask()
for (StoppableTaskQueue daysTaskQueue : schedule) {
PriorityTask topTask = daysTaskQueue.getTask();
if (topTask != null) return topTask;
}
return null; // no outstanding tasks - at all!?
|
public void | rollOver()
StoppableTaskQueue oldDay = schedule.remove(0);
Collection<PriorityTask> remainingTasks = oldDay.shutDown();
StoppableTaskQueue firstDay = schedule.get(0);
for (PriorityTask t : remainingTasks) {
firstDay.addTask(t);
}
StoppableTaskQueue lastDay = new StoppableTaskQueue();
schedule.add(lastDay);
|