IPriorityQueue
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:26
Interface representing a priority queue data type.
A priority queue is a collection where each item has a priority associated with it. Items with higher priority are served before items with lower priority.
ICollection<T>, not ICollection<[T, P]> — the priority is part of the
ordering, not of the element type. Iteration order is heap order, not
priority order; entries() is the priority-ordered, priority-carrying read.
Extends
Section titled “Extends”ICollection<T>
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”T extends DefinedValue = DefinedValue
The type of elements in the priority queue. Anything except
undefined, which means “no element”.
P = number
The type of priority values.
Properties
Section titled “Properties”precedes
Section titled “precedes”
readonlyprecedes:OrderPredicate<P>
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:34
Strict weak ordering over priorities: precedes(a, b) means a outranks
b.
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T,any,any>
Defined in: node_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es2015.iterable.d.ts:47
Returns
Section titled “Returns”Iterator<T, any, any>
Inherited from
Section titled “Inherited from”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/collection/icollection.ts:23
Removes all elements from the collection.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”count()
Section titled “count()”count():
number
Defined in: packages/data/src/collection/icollection.ts:20
The number of elements in the collection.
A method, not a getter: its async counterpart needs a round trip to the backing store, and a member must have the same shape in both.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”entries()
Section titled “entries()”entries():
IterableIterator<PriorityEntry<T,P>>
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:81
Every entry, in priority order (highest first).
Returns
Section titled “Returns”IterableIterator<PriorityEntry<T, P>>
extract()
Section titled “extract()”extract():
T|undefined
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:59
Removes and returns the item with the highest priority from the priority queue.
Returns
Section titled “Returns”T | undefined
The item with the highest priority, or undefined if the queue is
empty.
insert()
Section titled “insert()”insert(
priority,item):void
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:42
Inserts an item with its associated priority into the priority queue.
Parameters
Section titled “Parameters”priority
Section titled “priority”P
The priority of the item to insert.
T
The item to insert.
Returns
Section titled “Returns”void
insertAll()
Section titled “insertAll()”insertAll(
priority,items):void
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:50
Inserts every item at the same priority into the priority queue.
Parameters
Section titled “Parameters”priority
Section titled “priority”P
The priority shared by all the items to insert.
readonly T[]
The items to insert.
Returns
Section titled “Returns”void
peek()
Section titled “peek()”peek():
T|undefined
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:68
Returns the item with the highest priority without removing it from the queue.
Returns
Section titled “Returns”T | undefined
The item with the highest priority, or undefined if the queue is
empty.
setPriority()
Section titled “setPriority()”setPriority(
item,priority):boolean
Defined in: packages/data/src/priority-queue/ipriority-queue.ts:78
Updates the priority of an existing item in the priority queue.
Parameters
Section titled “Parameters”T
The item whose priority is to be updated.
priority
Section titled “priority”P
The new priority of the item.
Returns
Section titled “Returns”boolean
true if the item was found and its priority updated, false
otherwise.