public class HeapAdaptablePriorityQueue<K,V> extends HeapPriorityQueue<K,V> implements AdaptablePriorityQueue<K,V>
HeapPriorityQueue
Constructor and Description |
---|
HeapAdaptablePriorityQueue()
Creates an empty heap with a default comparator.
|
HeapAdaptablePriorityQueue(java.util.Comparator comp)
Creates an empty heap with the given comparator.
|
Modifier and Type | Method and Description |
---|---|
Entry<K,V> |
insert(K k,
V v)
Inserts a key-value pair and returns the entry created.
|
Entry<K,V> |
remove(Entry<K,V> entry)
Removes and returns the given entry from the heap.
|
K |
replaceKey(Entry<K,V> entry,
K k)
Replaces the key of the given entry.
|
V |
replaceValue(Entry<K,V> e,
V value)
Replaces the value of the given entry.
|
isEmpty, min, removeMin, setComparator, size, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
isEmpty, min, removeMin, size
public HeapAdaptablePriorityQueue()
public HeapAdaptablePriorityQueue(java.util.Comparator comp)
public Entry<K,V> insert(K k, V v) throws InvalidKeyException
insert
in interface PriorityQueue<K,V>
insert
in class HeapPriorityQueue<K,V>
InvalidKeyException
public Entry<K,V> remove(Entry<K,V> entry) throws InvalidEntryException
remove
in interface AdaptablePriorityQueue<K,V>
InvalidEntryException
public K replaceKey(Entry<K,V> entry, K k) throws InvalidEntryException
replaceKey
in interface AdaptablePriorityQueue<K,V>
InvalidEntryException
public V replaceValue(Entry<K,V> e, V value) throws InvalidEntryException
replaceValue
in interface AdaptablePriorityQueue<K,V>
InvalidEntryException