|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.graph.util.PairingHeap<E>
E - the type of elements held in this priority queuepublic class PairingHeap<E>
Implements a pairing heap. Supports a decreaseKey operation.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.kuka.graph.util.PriorityQueue |
|---|
PriorityQueue.Handle<T> |
| Constructor Summary | |
|---|---|
PairingHeap()
Creates a PairingHeap that orders its elements according to their natural ordering. |
|
PairingHeap(Comparator<? super E> comparator)
Creates a PairingHeap that orders its elements according to the specified comparator. |
|
| Method Summary | |
|---|---|
PriorityQueue.Handle<E> |
add(E value)
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> item,
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PairingHeap()
public PairingHeap(Comparator<? super E> comparator)
comparator - the comparator that will be used to order this priority queue| Method Detail |
|---|
public int size()
PriorityQueue
size in interface PriorityQueue<E>public boolean isEmpty()
PriorityQueue
isEmpty in interface PriorityQueue<E>public PriorityQueue.Handle<E> add(E value)
PriorityQueue
add in interface PriorityQueue<E>value - the value of the item to insert
PriorityQueue.decreaseKey(Handle, Object)public PriorityQueue.Handle<E> findMin()
PriorityQueue
findMin in interface PriorityQueue<E>PriorityQueue.removeMin()public E removeMin()
PriorityQueue
removeMin in interface PriorityQueue<E>PriorityQueue.findMin()
public void decreaseKey(PriorityQueue.Handle<E> item,
E element)
PriorityQueue
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.
decreaseKey in interface PriorityQueue<E>item - a valid handle returned by PriorityQueue.add(Object)element - the new element, which must be smaller than the currently stored onepublic void clear()
PriorityQueue
clear in interface PriorityQueue<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||