|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.util.MinHeap<K,V>
K
- key typeV
- value typepublic final class MinHeap<K,V>
A min-heap.
Constructor Summary | |
---|---|
MinHeap(int cap,
java.util.Comparator<K> cmp)
Constructs a heap with the given initial capacity and order. |
Method Summary | |
---|---|
void |
insert(K key,
V value)
Inserts the given key/value pair into the heap. |
boolean |
isEmpty()
Checks if this heap is empty. |
V |
minValue()
returns the value of the smallest key from this heap. |
V |
removeMin()
Removes the minimum from this heap. |
int |
size()
Size of this heap. |
java.lang.String |
toString()
|
void |
verify()
Verifies the inner structure of the heap. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MinHeap(int cap, java.util.Comparator<K> cmp)
cap
- initial capacitycmp
- comparatorMethod Detail |
---|
public void insert(K key, V value)
key
- keyvalue
- valuepublic V removeMin()
public V minValue()
public int size()
public boolean isEmpty()
true
if heap is empty, false
otherwisepublic void verify()
java.lang.IllegalStateException
- if the invariants don't holdpublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |