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, toSortedArrayList
add, addAll, element, remove
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
private 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)
Heap
putInQueue
in class Heap<O>
pos
- Indexe
- Elementprotected O removeAt(int pos)
Heap
public O removeObject(O e)
e
- Obejct to remove