The goog.structs.PriorityQueue Class

goog.structs.PriorityQueue
> goog.structs.Heap

goog.structs.PriorityQueue()

Class for Priority Queue datastructure.

.clear()

Inherited from goog.structs.Heap .

Removes all elements from the heap.

.clone()

Inherited from goog.structs.Heap .

Clones a heap and returns a new heap

returns {goog.structs.Heap}
A new goog.structs.Heap with the same key-value pairs.

.containsKey(key)

Inherited from goog.structs.Heap .

Whether the heap contains the given key.

key {Object}
The key to check for.
returns {boolean}
Whether the heap contains the key.

.containsValue(val)

Inherited from goog.structs.Heap .

Whether the heap contains the given value.

val {Object}
The value to check for.
returns {boolean}
Whether the heap contains the value.

.dequeue()

Retrieves and removes the head of this queue.

returns {*}
The element at the head of this queue. Returns undefined if the queue is empty.

.enqueue(priority, value)

Puts the specified value in the queue.

priority {*}
The priority of the value.
value {*}
The value.

.getCount()

Inherited from goog.structs.Heap .

The number of key-value pairs in the map

returns {number}
The number of pairs.

.getKeys()

Inherited from goog.structs.Heap .

Gets the keys of the heap.

returns {Array}
The keys in the heap.

.getValues()

Inherited from goog.structs.Heap .

Gets the values of the heap.

returns {Array}
The values in the heap.

.insert(key, value)

Inherited from goog.structs.Heap .

Insert the given value into the heap with the given key.

key {*}
The key.
value {*}
The value.

.insertAll(heap)

Inherited from goog.structs.Heap .

Adds multiple key-value pairs from another goog.structs.Heap or Object

heap {goog.structs.Heap|Object}
Object containing the data to add.

.isEmpty()

Inherited from goog.structs.Heap .

Returns true if this heap contains no elements.

returns {boolean}
Whether this heap contains no elements.

.peek()

Inherited from goog.structs.Heap .

Retrieves but does not remove the root value of this heap.

returns {*}
The value at the root of the heap. Returns undefined if the heap is empty.

.peekKey()

Inherited from goog.structs.Heap .

Retrieves but does not remove the key of the root node of this heap.

returns {*}
The key at the root of the heap. Returns undefined if the heap is empty.

.remove()

Inherited from goog.structs.Heap .

Retrieves and removes the root value of this heap.

returns {*}
The value removed from the root of the heap. Returns undefined if the heap is empty.