Class DoubleIntegerDBIDHeap

    • Constructor Detail

      • DoubleIntegerDBIDHeap

        protected DoubleIntegerDBIDHeap​(DoubleIntegerHeap heap)
        Constructor.
        Parameters:
        heap - Heap to use
    • Method Detail

      • insert

        public double insert​(double distance,
                             DBIDRef id)
        Description copied from interface: DoubleDBIDHeap
        Add a double-id pair to the heap
        Specified by:
        insert in interface DoubleDBIDHeap
        Parameters:
        distance - Key value
        id - ID number
        Returns:
        Value of to the element at the top of the heap
      • insert

        public double insert​(double distance,
                             DBIDRef id,
                             int max)
        Description copied from interface: DoubleDBIDHeap
        Add a double-id pair to the heap unless the heap grows beyond the given maximum size. Beware of the following subtle details:
        • If the heap has fewer than "max" elements, the value is added.
        • else, if the new value is "worse" than the top, it will replace the top (and the heap will be repaired)
        • for a min heap, this adds only larger value, for a max heap only smaller values. This may seem odd, but it is equivalent to adding the new element and then removing the top ("best") element.
        • But: the heap will not be reduced to the given size
        Specified by:
        insert in interface DoubleDBIDHeap
        Parameters:
        distance - Distance value
        id - ID number
        max - Maximum number of values
        Returns:
        Distance to the element at the top of the heap
      • replaceTopElement

        public void replaceTopElement​(double distance,
                                      DBIDRef id)
        Replace the top element.
        Parameters:
        distance - New distance
        id - New element
      • size

        public int size()
        Description copied from interface: DoubleDBIDHeap
        Current size of heap.
        Specified by:
        size in interface DoubleDBIDHeap
        Returns:
        Heap size
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: DoubleDBIDHeap
        Test if the heap is empty.
        Specified by:
        isEmpty in interface DoubleDBIDHeap
        Returns:
        true when empty.
      • peekKey

        public double peekKey()
        Description copied from interface: DoubleDBIDHeap
        Get the topmost value (the heap is a DBIDRef, referencing the top element).
        Specified by:
        peekKey in interface DoubleDBIDHeap
        Returns:
        value at top
      • internalGetIndex

        public int internalGetIndex()
        Description copied from interface: DBIDRef
        Internal only: Get the internal index.

        NOT FOR PUBLIC USE - ELKI Optimization engine only.

        Specified by:
        internalGetIndex in interface DBIDRef
        Returns:
        Internal index
      • contains

        public boolean contains​(DBIDRef o)
        Description copied from interface: DoubleDBIDHeap
        Check if an object is already in the heap (slow scan).
        Specified by:
        contains in interface DoubleDBIDHeap
        Parameters:
        o - Other object
        Returns:
        true if contained
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object