File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ declare module 'p-queue-ts' {
2
+ type Comparator < T > = ( a : T , b : T ) => boolean ;
3
+
4
+ export class PriorityQueue < T > {
5
+ constructor ( comparator ?: Comparator < T > ) ;
6
+
7
+ /**
8
+ * Inserts the specified element into this priority queue.
9
+ */
10
+ push : ( value : T ) => void ;
11
+ /**
12
+ * Returns true if this queue contains the specified element.
13
+ */
14
+ contains : ( value : T , comparator ?: ( item : T ) => boolean ) => boolean ;
15
+ /**
16
+ * Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
17
+ */
18
+ top : ( ) => T ;
19
+ /**
20
+ * Retrieves and removes the head of this queue, or returns null if this queue is empty.
21
+ * Everytime pop element from queue, the queue is started "sift down" to rebuild the heap
22
+ */
23
+ pop : ( ) => T ;
24
+ /**
25
+ * Returns the number of elements in this collection.
26
+ */
27
+ size : ( ) => number ;
28
+ /**
29
+ * Checks whether the queue is empty.
30
+ */
31
+ empty : ( ) => boolean ;
32
+ /**
33
+ * Removes all of the elements from this priority queue.
34
+ */
35
+ clear : ( ) => void ;
36
+ /**
37
+ * Returns an array containing all of the elements in this queue.
38
+ */
39
+ toArray : ( ) => T [ ] ;
40
+ }
41
+ }
42
+
You can’t perform that action at this time.
0 commit comments