@uwdata/mosaic-core
Version:
Scalable and extensible linked data views.
35 lines • 1.21 kB
TypeScript
export declare class PriorityQueue<T = unknown> {
private queue;
/**
* Create a new priority queue instance.
* @param ranks An integer number of rank-order priority levels.
*/
constructor(ranks: number);
/**
* Indicate if the queue is empty.
* @returns true if empty, false otherwise.
*/
isEmpty(): boolean;
/**
* Insert an item into the queue with a given priority rank.
* @param item The item to add.
* @param rank The integer priority rank.
* Priority ranks are integers starting at zero.
* Lower ranks indicate higher priority.
*/
insert(item: T, rank: number): void;
/**
* Remove a set of items from the queue, regardless of priority rank.
* If a provided item is not in the queue it will be ignored.
* @param test A predicate function to test
* if an item should be removed (true to drop, false to keep).
*/
remove(test: (item: T) => boolean): void;
/**
* Remove and return the next highest priority item.
* @returns The next item in the queue,
* or undefined if this queue is empty.
*/
next(): T | undefined;
}
//# sourceMappingURL=priority-queue.d.ts.map