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.


Constructor Index

 o PriorityQueue()
Make an empty PriorityQueue.
 o PriorityQueue(int)
Make an empty PriorityQueue with an initial capacity.

Method Index

 o clear()
Remove all objects from queue.
 o delete(Prioritized)
Delete an object from queue.
 o deleteMin()
Get and delete the object with lowest priority.
 o dump(PriorityQueue)
 o elements()
Enumerate the objects in the queue, in no particular order
 o empty()
Test whether queue is empty.
 o getMin()
Get object with lowest priority from queue.
 o main(String[])
 o put(Prioritized)
Put an object on the queue.
 o size()
Get number of objects in queue.
 o update()
Rebuild priority queuein case the priorities of its elements have changed since they were inserted.

Constructors

 o PriorityQueue
 public PriorityQueue()
Make an empty PriorityQueue.

 o PriorityQueue
 public PriorityQueue(int initialCapacity)
Make an empty PriorityQueue with an initial capacity.

Parameters:
initialCapacity - number of elements initially allocated in queue

Methods

 o 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
 o getMin
 public synchronized Object getMin()
Get object with lowest priority from queue.

Returns:
object with lowest priority, or null if queue is empty
 o deleteMin
 public synchronized Object deleteMin()
Get and delete the object with lowest priority.

Returns:
object with lowest priority, or null if queue is empty
 o 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
 o clear
 public synchronized void clear()
Remove all objects from queue.

 o elements
 public synchronized Enumeration elements()
Enumerate the objects in the queue, in no particular order

Returns:
enumeration of objects in queue
 o size
 public synchronized int size()
Get number of objects in queue.

Returns:
number of objects
 o empty
 public synchronized boolean empty()
Test whether queue is empty.

Returns:
true iff queue is empty.
 o 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.

 o main
 public static void main(String args[])
 o dump
 public static void dump(PriorityQueue q)

All Packages  Class Hierarchy  This Package  Previous  Next  Index