All Packages Class Hierarchy This Package Previous Next Index
Class websphinx.util.PriorityQueue
java.lang.Object
|
+----websphinx.util.PriorityQueue
- public class PriorityQueue
- extends Object
Priority queue. Objects stored in a priority queue must implement
the Prioritized interface.
-
PriorityQueue()
- Make an empty PriorityQueue.
-
PriorityQueue(int)
- Make an empty PriorityQueue with an initial capacity.
-
clear()
- Remove all objects from queue.
-
delete(Prioritized)
- Delete an object from queue.
-
deleteMin()
- Get and delete the object with lowest priority.
-
dump(PriorityQueue)
-
-
elements()
- Enumerate the objects in the queue, in no particular order
-
empty()
- Test whether queue is empty.
-
getMin()
- Get object with lowest priority from queue.
-
main(String[])
-
-
put(Prioritized)
- Put an object on the queue.
-
size()
- Get number of objects in queue.
-
update()
- Rebuild priority queuein case the priorities of its elements
have changed since they were inserted.
PriorityQueue
public PriorityQueue()
- Make an empty PriorityQueue.
PriorityQueue
public PriorityQueue(int initialCapacity)
- Make an empty PriorityQueue with an initial capacity.
- Parameters:
- initialCapacity - number of elements initially allocated in queue
put
public synchronized void put(Prioritized x)
- Put an object on the queue. Doesn't check for
duplicate puts.
- Parameters:
- x - object to put on the queue
getMin
public synchronized Object getMin()
- Get object with lowest priority from queue.
- Returns:
- object with lowest priority, or null if queue is empty
deleteMin
public synchronized Object deleteMin()
- Get and delete the object with lowest priority.
- Returns:
- object with lowest priority, or null if queue is empty
delete
public synchronized boolean delete(Prioritized x)
- Delete an object from queue. If object was inserted more than
once, this method deletes only one occurrence of it.
- Parameters:
- x - object to delete
- Returns:
- true if x was found and deleted, false if x not found in queue
clear
public synchronized void clear()
- Remove all objects from queue.
elements
public synchronized Enumeration elements()
- Enumerate the objects in the queue, in no particular order
- Returns:
- enumeration of objects in queue
size
public synchronized int size()
- Get number of objects in queue.
- Returns:
- number of objects
empty
public synchronized boolean empty()
- Test whether queue is empty.
- Returns:
- true iff queue is empty.
update
public synchronized void update()
- Rebuild priority queuein case the priorities of its elements
have changed since they were inserted. If the priority of
any element changes, this method must be called to update
the priority queue.
main
public static void main(String args[])
dump
public static void dump(PriorityQueue q)
All Packages Class Hierarchy This Package Previous Next Index