BRUtil - Making Java a Kinder, Gentler, Place to be.

brutil
Interface PriorityQueue

All Superinterfaces:
Collection
All Known Implementing Classes:
BinaryHeap

public interface PriorityQueue
extends Collection


Method Summary
 java.lang.Object extractFirst()
          Get the element with greatest priority out of the queue
 java.lang.Comparable getFirstKey()
          Get the key of the object with greatest priority.
 Handle insert(java.lang.Comparable key, java.lang.Object data)
          Insert this the given item in the heap, and organize it based on the specified key.
 boolean updateKey(Handle handle, java.lang.Comparable newKey)
          Change the key of the item in the queue pointed to by the specified Handle to the specified Comparable.
 
Methods inherited from interface brutil.Collection
clear, isEmpty, size
 

Method Detail

extractFirst

public java.lang.Object extractFirst()
Get the element with greatest priority out of the queue
Returns:
The object with the greatest priority.

getFirstKey

public java.lang.Comparable getFirstKey()
Get the key of the object with greatest priority.
Returns:
The key of the object with greatest priority.

insert

public Handle insert(java.lang.Comparable key,
                     java.lang.Object data)
Insert this the given item in the heap, and organize it based on the specified key.
Parameters:
key - The item that will specify how the inserted data should be treated within the queue. Comparables should be the same of the same specific type.
data - The object to store in the queue.
Returns:
A handle object that will allow the user to have limited access to the key and data.
See Also:
Handle

updateKey

public boolean updateKey(Handle handle,
                         java.lang.Comparable newKey)
Change the key of the item in the queue pointed to by the specified Handle to the specified Comparable.
Parameters:
handle - A Handle that points to the element to be updated in the queue.
newKey - The value that the key should be set to.
Returns:
true if the key was successfully replaced. false if the current key has higher priority than the specified key.


BRUtil - Making Java a Kinder, Gentler, Place to be.