PQueue
in package
Simple priority queue.
Tags
Table of Contents
- $comparator : callable
- $contents : array<string|int, mixed>
- $sorted : bool
- __construct() : mixed
- getContent() : array<string|int, T>
- map() : array<string|int, mixed>
- peek() : mixed
- pop() : mixed|null
- push() : void
- setComparator() : void
- size() : int
- sort() : void
Properties
$comparator
private
callable
$comparator
= null
Tags
$contents
private
array<string|int, mixed>
$contents
= []
Tags
$sorted
private
bool
$sorted
= false
Methods
__construct()
public
__construct(callable $comparator) : mixed
Parameters
- $comparator : callable
Return values
mixed —getContent()
public
getContent([bool $sorted = true ]) : array<string|int, T>
Parameters
- $sorted : bool = true
Tags
Return values
array<string|int, T> —map()
public
map(callable $function[, bool $sorted = true ]) : array<string|int, mixed>
Parameters
- $function : callable
- $sorted : bool = true
Tags
Return values
array<string|int, mixed> —peek()
public
peek([int|null $index = null ]) : mixed
Parameters
- $index : int|null = null
Tags
Return values
mixed —pop()
public
pop() : mixed|null
Tags
Return values
mixed|null —push()
public
push(mixed $object) : void
Parameters
- $object : mixed
Tags
Return values
void —setComparator()
public
setComparator(callable $function) : void
Parameters
- $function : callable
Tags
Return values
void —size()
public
size() : int
Return values
int —sort()
private
sort() : void