Home » openjdk-7 » java » util » [javadoc | source]
java.util
class: TaskQueue [javadoc | source]
java.lang.Object
   java.util.TaskQueue
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.
Method from java.util.TaskQueue Summary:
add,   clear,   get,   getMin,   heapify,   isEmpty,   quickRemove,   removeMin,   rescheduleMin,   size
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.
  void clear() 
    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 queue, inclusive.
 TimerTask getMin() 
    Return the "head task" of the priority queue. (The head task is an task with the lowest nextExecutionTime.)
  void heapify() 
    Establishes the heap invariant (described above) in the entire tree, assuming nothing about the order of the elements prior to the call.
 boolean isEmpty() 
    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.
  void removeMin() 
    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.
 int size() 
    Returns the number of tasks currently on the queue.