gzz.util
Class PriorityQueue
java.lang.Object
|
+--gzz.util.PriorityQueue
- public class PriorityQueue
- extends java.lang.Object
A simple implementation of a priority queue, for background
jobs.
N.B. the current implementation is not the most efficient
possible one,
by far.
This class is not synchronized!
Method Summary |
void |
add(java.lang.Object job,
float priority)
Add a job to run. |
java.lang.Object |
getAndRemoveLowest()
Get the most important (with lowest numeric priority) job and remove
it from this queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PriorityQueue
public PriorityQueue()
add
public void add(java.lang.Object job,
float priority)
- Add a job to run.
If the job has already been added, set the priority
to the lower value (more important) of the two.
getAndRemoveLowest
public java.lang.Object getAndRemoveLowest()
- Get the most important (with lowest numeric priority) job and remove
it from this queue.