UNPKG

@empathyco/x-components

Version:
230 lines (102 loc) • 3.53 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [BaseXPriorityQueue](./x-components.basexpriorityqueue.md) ## BaseXPriorityQueue class . Default [XPriorityQueue](./x-components.xpriorityqueue.md) implementation. Method big-O \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- - push O(n) - pop O(1) - peek O(1) - at O(1) **Signature:** ```typescript export declare class BaseXPriorityQueue<SomeRecord extends Dictionary, SomeData extends Dictionary = Dictionary> implements XPriorityQueue<SomeRecord, SomeData> ``` **Implements:** [XPriorityQueue](./x-components.xpriorityqueue.md)<!-- -->&lt;SomeRecord, SomeData&gt; ## Constructors <table><thead><tr><th> Constructor </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [(constructor)(comparatorFn)](./x-components.basexpriorityqueue._constructor_.md) </td><td> </td><td> Creates a new [XPriorityQueue](./x-components.xpriorityqueue.md)<!-- -->. </td></tr> </tbody></table> ## Properties <table><thead><tr><th> Property </th><th> Modifiers </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> [keys](./x-components.basexpriorityqueue.keys.md) </td><td> `readonly` </td><td> (keyof SomeRecord)\[\] </td><td> The `keys` property of a [XPriorityQueue](./x-components.xpriorityqueue.md) represents the keys of that queue. The value is an array of the parametrized `Key` type. </td></tr> </tbody></table> ## Methods <table><thead><tr><th> Method </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [at(index)](./x-components.basexpriorityqueue.at.md) </td><td> </td><td> Retrieves the [node](./x-components.xpriorityqueuenode.md) at a given position. </td></tr> <tr><td> [clear()](./x-components.basexpriorityqueue.clear.md) </td><td> </td><td> Removes all the [nodes](./x-components.xpriorityqueuenode.md) from the queue. </td></tr> <tr><td> [isEmpty()](./x-components.basexpriorityqueue.isempty.md) </td><td> </td><td> Checks if the queue is empty. </td></tr> <tr><td> [peek()](./x-components.basexpriorityqueue.peek.md) </td><td> </td><td> Retrieves, but does not remove, the head [node](./x-components.xpriorityqueuenode.md) of the queue. </td></tr> <tr><td> [pop()](./x-components.basexpriorityqueue.pop.md) </td><td> </td><td> See [XPriorityQueue.pop](./x-components.xpriorityqueue.pop.md)<!-- -->. </td></tr> <tr><td> [push(key, priority, data)](./x-components.basexpriorityqueue.push.md) </td><td> </td><td> . See [XPriorityQueue.push](./x-components.xpriorityqueue.push.md)<!-- -->. </td></tr> <tr><td> [size()](./x-components.basexpriorityqueue.size.md) </td><td> </td><td> Retrieves the number of [nodes](./x-components.xpriorityqueuenode.md) stored in the queue. </td></tr> <tr><td> [toString()](./x-components.basexpriorityqueue.tostring.md) </td><td> </td><td> Returns a string representation of this collection. The string representation consists of a list of the queue [nodes](./x-components.xpriorityqueuenode.md) split in multiple lines, one for each one. Nodes are converted to strings as by toString(). </td></tr> </tbody></table>