PriorityQueue
class PriorityQueue implements Collection (View source)
A PriorityQueue is very similar to a Queue. Values are pushed into the queue with an assigned priority, and the value with the highest priority will always be at the front of the queue.
Implemented using a max heap.
Constants
MIN_CAPACITY |
|
Methods
Count elements of an object
Allocates enough memory for a required capacity
Returns the current capacity
Removes all values from the collection.
Returns a shallow copy of the collection.
No description
Returns whether the collection is empty.
Returns the value at the front of the queue, but does not remove it.
Removes and returns the value with the highest priority
Pushes a value with a given priority into the queue.
Converts the collection to an array.
Specify data which should be serialized to JSON
Details
int
count()
Count elements of an object
void
allocate(int $capacity)
Allocates enough memory for a required capacity
int
capacity()
Returns the current capacity
void
clear()
Removes all values from the collection.
TValue>
copy()
Returns a shallow copy of the collection.
Traversable
getIterator()
No description
bool
isEmpty()
Returns whether the collection is empty.
TValue
peek()
Returns the value at the front of the queue, but does not remove it.
TValue
pop()
Removes and returns the value with the highest priority
push(TValue $value, int $priority)
Pushes a value with a given priority into the queue.
array
toArray()
Converts the collection to an array.
Note: Casting to an array is not supported yet.
mixed
jsonSerialize()
Specify data which should be serialized to JSON