Constructor takes an optional capacity
parameter. If set,
the PriorityQueue won't accept new elements when the lengths reaches
the capacity, until it is dequeued.
The maximum queue length before overflow.
The maximum elements the structure can contain.
It can be set via the constructor or setCapacity
.
Default value is -1
(no limit).
The current amount of elements.
Removes the element with highest priority
The removes element or undefined
if it failed.
Adds a value to the queue. Its position depends on the given priority.
If the length already reached the (optional) capacity, enqueue
won't perform and return undefined
.
The value associed to the element.
The inserted element or undefined
if it failed.
Generated using TypeDoc
Priority Queue implementation based on a binary heap. It has two methods
enqueue
anddequeue
to manage its elements. It implements the CappedStructure interface to handle overflow of acapacity
is set.