|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
E - the type of elements held in this priority queuepublic interface PriorityQueue<E>
This priority queue interface is tailored for graph search algorithms. Its interface is different to a standard Java PriorityQueue to facilitate an efficient decreaseKey operation, which reduces the priority of a value that is already in the queue. Thus, handles are used to reference values in the heap
| Nested Class Summary | |
|---|---|
static interface |
PriorityQueue.Handle<T>
Handle to elements in a priority queue for efficient access. |
| Method Summary | |
|---|---|
PriorityQueue.Handle<E> |
add(E element)
Adds an element to this priority queue, maintaining heap order. |
void |
clear()
Removes all of the elements from this priority queue. |
void |
decreaseKey(PriorityQueue.Handle<E> handle,
E element)
Changes the value of the item stored in the pairing heap (optional operation). |
PriorityQueue.Handle<E> |
findMin()
Finds and returns the item with the lowest priority in this queue. |
boolean |
isEmpty()
Returns true if this priority queue contains no elements. |
E |
removeMin()
Removes and returns the item with the lowest priority from this queue. |
int |
size()
Returns the number of elements in this priority queue. |
| Method Detail |
|---|
int size()
boolean isEmpty()
PriorityQueue.Handle<E> add(E element)
element - the value of the item to insert
decreaseKey(Handle, Object)PriorityQueue.Handle<E> findMin()
IllegalStateException - if this priority queue is emptyremoveMin()E removeMin()
IllegalStateException - if this priority queue is emptyfindMin()
void decreaseKey(PriorityQueue.Handle<E> handle,
E element)
The given handle must be valid. A handle is valid as long as it is an element of this priority queue. When the
corresponding value is removed from the queue the handle is invalid. To check whether a handle is valid call
PriorityQueue.Handle.isValid(). Note that this is considered an advanced operation and might not be supported by all
priority queues.
handle - a valid handle returned by add(Object)element - the new element, which must be smaller than the currently stored one
IllegalArgumentException - if item is invalid
UnsupportedOperationException - if the decreaseKey operation is not supported by this priority queuevoid clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||