This class represents a timer task queue: a priority queue of TimerTasks,
ordered on nextExecutionTime. Each Timer object has one of these, which it
shares with its TimerThread. Internally this class uses a heap, which
offers log(n) performance for the add, removeMin and rescheduleMin
operations, and constant time performance for the getMin operation.
|Methods from java.lang.Object:|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait|
|Method from java.util.TaskQueue Detail:|
void add(TimerTask task)
Adds a new task to the priority queue.
Removes all elements from the priority queue.
TimerTask get(int i)
Return the ith task in the priority queue, where i ranges from 1 (the
head task, which is returned by getMin) to the number of tasks on the
Return the "head task" of the priority queue. (The head task is an
task with the lowest nextExecutionTime.)
Establishes the heap invariant (described above) in the entire tree,
assuming nothing about the order of the elements prior to the call.
Returns true if the priority queue contains no elements.
void quickRemove(int i)
Removes the ith element from queue without regard for maintaining
the heap invariant. Recall that queue is one-based, so
1 <= i <= size.
Remove the head task from the priority queue.
void rescheduleMin(long newTime)
Sets the nextExecutionTime associated with the head task to the
specified value, and adjusts priority queue accordingly.
Returns the number of tasks currently on the queue.