
O - object typepublic class UpdatableHeap<O> extends Heap<O>
| Modifier and Type | Field and Description |
|---|---|
private HashMap<O,Integer> |
index
Holds the indices in the heap of each element.
|
private static long |
serialVersionUID
Serial version
|
| Constructor and Description |
|---|
UpdatableHeap()
Simple constructor with default size.
|
UpdatableHeap(Comparator<? super O> comparator)
Constructor with comparator
|
UpdatableHeap(int size)
Constructor with predefined size.
|
UpdatableHeap(int size,
Comparator<? super O> comparator)
Constructor with predefined size and comparator
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
offer(O e) |
O |
poll() |
protected void |
putInQueue(int pos,
Object e)
Put an element into the queue at a given position.
|
protected O |
removeAt(int pos)
Remove the element at the given position.
|
O |
removeObject(O e)
Remove the given object from the queue.
|
castQueueElement, compare, compareExternal, compareExternalExternal, contains, heapifyDown, heapifyUp, heapifyUpParent, iterator, peek, size, swap, toSortedArrayListadd, addAll, element, removecontainsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArrayprivate static final long serialVersionUID
public UpdatableHeap()
public UpdatableHeap(int size)
size - Sizepublic UpdatableHeap(Comparator<? super O> comparator)
comparator - Comparatorpublic UpdatableHeap(int size,
Comparator<? super O> comparator)
size - Sizecomparator - Comparatorpublic void clear()
public boolean offer(O e)
protected void putInQueue(int pos,
Object e)
HeapputInQueue in class Heap<O>pos - Indexe - Elementprotected O removeAt(int pos)
Heappublic O removeObject(O e)
e - Obejct to remove