Interface DoubleDBIDHeap

    • Method Detail

      • peekKey

        double peekKey()
        Get the topmost value (the heap is a DBIDRef, referencing the top element).
        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
        key - Key value
        id - ID number
        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
        distance - Distance value
        id - ID number
        max - Maximum number of values
        Distance to the element at the top of the heap
      • size

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

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

        void clear()
        Clear the heap.
      • unorderedIterator

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

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