Class HeapPriorityQueue<T extends HeapPriorityQueueElement>

  • Type Parameters:
    T - type of the contained elements.
    All Implemented Interfaces:
    InternalPriorityQueue<T>
    Direct Known Subclasses:
    HeapPriorityQueueSet

    public class HeapPriorityQueue<T extends HeapPriorityQueueElement>
    extends AbstractHeapPriorityQueue<T>
    Basic heap-based priority queue for HeapPriorityQueueElement objects. This heap supports fast deletes because it manages position indexes of the contained HeapPriorityQueueElements. The heap implementation is a simple binary tree stored inside an array. Element indexes in the heap array start at 1 instead of 0 to make array index computations a bit simpler in the hot methods. Object identification of remove is based on object identity and not on equals. We use the managed index from HeapPriorityQueueElement to find an element in the queue array to support fast deletes.

    Possible future improvements:

    • We could also implement shrinking for the heap.