Interface DoubleDBIDHeap

    • Method Detail

      • peekKey

        double peekKey()
        Get the topmost value (the heap is a DBIDRef, referencing the top element).
        Returns:
        value at top
      • poll

        void poll()
        Remove the topmost element.
      • insert

        double insert​(double key,
                      DBIDRef id)
        Add a double-id pair to the heap
        Parameters:
        key - Key value
        id - ID number
        Returns:
        Value of to the element at the top of the heap
      • insert

        double insert​(double distance,
                      DBIDRef id,
                      int max)
        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
        Parameters:
        distance - Distance value
        id - ID number
        max - Maximum number of values
        Returns:
        Distance to the element at the top of the heap
      • size

        int size()
        Current size of heap.
        Returns:
        Heap size
      • isEmpty

        default boolean isEmpty()
        Test if the heap is empty.
        Returns:
        true when empty.
      • clear

        void clear()
        Clear the heap.
      • unorderedIterator

        DoubleDBIDIter unorderedIterator()
        Unordered iterator over the heap.
        Returns:
        Iterator
      • contains

        boolean contains​(DBIDRef other)
        Check if an object is already in the heap (slow scan).
        Parameters:
        other - Other object
        Returns:
        true if contained