|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
A priority queue is a partially-ordered container that allows for removal of the element with lowest (or highest, depending on the comparator used) priority. It does not specify any implementation; one implementation, however, is with a heap, which gives O(log N) time complexity for the two basic operations: insert(.) and removeMax().
The elements need to be comparable using whatever means the PQ has of making comparisons. If an element is not comparable, the priority queue will throw an InvalidElementException.
| Method Summary | |
void |
insertItem(java.lang.Object key,
java.lang.Object element)
Add a (key,element) pair to the set maintained by the priority queue, making whatever internal adjustments are necessary. |
Locator |
min()
Allows access to element with first priority without removing it from the PriorityQueue. |
java.lang.Object |
minElement()
Inspect the element (not the key) with first priority, without modifying the priority queue. |
java.lang.Object |
minKey()
Inspect the key with first priority, without modifying the priority queue. |
java.lang.Object |
removeMinElement()
Remove a (key,element) pair with first priority, making whatever internal adjustments are necessary. |
| Methods inherited from interface jdsl.core.api.KeyBasedContainer |
insert,
insert,
keys,
locators,
makeLocator,
remove,
replaceElement,
replaceKey |
| Methods inherited from interface jdsl.core.api.Container |
elements,
newContainer |
| Methods inherited from interface jdsl.simple.api.SimpleContainer |
isEmpty,
size |
| Method Detail |
public Locator min()
throws EmptyContainerException
public java.lang.Object minElement()
throws EmptyContainerException
public java.lang.Object minKey()
throws EmptyContainerException
public void insertItem(java.lang.Object key,
java.lang.Object element)
throws InvalidKeyException
key - An object comparable under the implementation's
comparison schemeelement - An arbitrary object the client associates with
the key
public java.lang.Object removeMinElement()
throws EmptyContainerException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||