
public class DoubleIntegerMaxHeap extends Object implements DoubleIntegerHeap
| Modifier and Type | Class and Description | 
|---|---|
| private class  | DoubleIntegerMaxHeap.UnsortedIterUnsorted iterator - in heap order. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected int | sizeCurrent size of heap. | 
| private static int | TWO_HEAP_INITIAL_SIZEInitial size of the 2-ary heap. | 
| protected double[] | twoheapBase heap. | 
| protected int[] | twovalsBase heap values. | 
| Constructor and Description | 
|---|
| DoubleIntegerMaxHeap()Constructor, with default size. | 
| DoubleIntegerMaxHeap(int minsize)Constructor, with given minimum size. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | add(double o,
   int v)Add a key-value pair to the heap | 
| void | add(double key,
   int val,
   int max)Add a key-value pair to the heap if it improves the top. | 
| void | clear()Clear the heap contents. | 
| private void | heapifyDown(double cur,
           int val)Invoke heapify-down for the root object. | 
| private void | heapifyUp(int twopos,
         double cur,
         int val)Heapify-Up method for 2-ary heap. | 
| boolean | isEmpty()Is the heap empty? | 
| double | peekKey()Get the current top key | 
| int | peekValue()Get the current top value | 
| void | poll()Remove the first element | 
| void | replaceTopElement(double reinsert,
                 int val)Combined operation that removes the top element, and inserts a new element
 instead. | 
| int | size()Query the size | 
| String | toString() | 
| DoubleIntegerMaxHeap.UnsortedIter | unsortedIter()Get an unsorted iterator to inspect the heap. | 
protected double[] twoheap
protected int[] twovals
protected int size
private static final int TWO_HEAP_INITIAL_SIZE
public DoubleIntegerMaxHeap()
public DoubleIntegerMaxHeap(int minsize)
minsize - Minimum sizepublic void clear()
DoubleIntegerHeapclear in interface DoubleIntegerHeappublic int size()
DoubleIntegerHeapsize in interface DoubleIntegerHeappublic boolean isEmpty()
DoubleIntegerHeapisEmpty in interface DoubleIntegerHeaptrue when the size is 0.public void add(double o,
       int v)
DoubleIntegerHeapadd in interface DoubleIntegerHeapo - Keyv - Valuepublic void add(double key,
       int val,
       int max)
DoubleIntegerHeapadd in interface DoubleIntegerHeapkey - Keyval - Valuemax - Desired maximum sizepublic void replaceTopElement(double reinsert,
                     int val)
DoubleIntegerHeapreplaceTopElement in interface DoubleIntegerHeapreinsert - Key of new elementval - Value of new elementprivate void heapifyUp(int twopos,
             double cur,
             int val)
twopos - Position in 2-ary heap.cur - Current objectval - Current valuepublic void poll()
DoubleIntegerHeappoll in interface DoubleIntegerHeapprivate void heapifyDown(double cur,
               int val)
cur - Object to insert.val - Value to reinsert.public double peekKey()
DoubleIntegerHeappeekKey in interface DoubleIntegerHeappublic int peekValue()
DoubleIntegerHeappeekValue in interface DoubleIntegerHeappublic DoubleIntegerMaxHeap.UnsortedIter unsortedIter()
DoubleIntegerHeapunsortedIter in interface DoubleIntegerHeapCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.