
O - object typepublic class UpdatableHeap<O> extends Heap<O>
| Modifier and Type | Field and Description | 
|---|---|
| protected static int | IN_TIESConstant for "in ties list", for tied heaps. | 
| protected gnu.trove.map.TObjectIntMap<Object> | indexHolds the indices in the heap of each element. | 
| protected static int | NO_VALUEConstant for "not in heap". | 
comparator, queue, size, validSize| 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 | add(O e)Add an element to the heap. | 
| void | clear()Clear the heap. | 
| protected boolean | heapifyDownComparable(int ipos,
                     Object reinsert)Execute a "Heapify Downwards" aka "SiftDown". | 
| protected boolean | heapifyDownComparator(int ipos,
                     Object cur)Execute a "Heapify Downwards" aka "SiftDown". | 
| protected void | heapifyUpComparable(int pos,
                   Object elem)Execute a "Heapify Upwards" aka "SiftUp". | 
| protected void | heapifyUpComparator(int pos,
                   Object cur)Execute a "Heapify Upwards" aka "SiftUp". | 
| protected void | offerAt(int pos,
       O e)Offer element at the given position. | 
| O | poll()Remove the top element. | 
| protected O | removeAt(int pos)Remove the element at the given position. | 
| O | removeObject(O e)Remove the given object from the queue. | 
| O | replaceTopElement(O e)Combined operation that removes the top element, and inserts a new element
 instead. | 
checkHeap, ensureValid, heapifyDown, heapifyUp, heapModified, isEmpty, iterator, peek, resize, sizeprotected static final int NO_VALUE
protected static final int IN_TIES
protected final gnu.trove.map.TObjectIntMap<Object> index
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()
Heapprotected void offerAt(int pos,
           O e)
pos - Positione - Elementprotected O removeAt(int pos)
Heappublic O removeObject(O e)
e - Object to removepublic O replaceTopElement(O e)
HeapreplaceTopElement in class Heap<O>e - New element to insertprotected void heapifyUpComparable(int pos,
                       Object elem)
heapifyUpComparable in class Heap<O>pos - insertion positionelem - Element to insertprotected void heapifyUpComparator(int pos,
                       Object cur)
heapifyUpComparator in class Heap<O>pos - insertion positioncur - Element to insertprotected boolean heapifyDownComparable(int ipos,
                            Object reinsert)
HeapheapifyDownComparable in class Heap<O>ipos - re-insertion positionreinsert - Object to reinsertprotected boolean heapifyDownComparator(int ipos,
                            Object cur)
HeapheapifyDownComparator in class Heap<O>ipos - re-insertion positioncur - Object to reinsert