Simple priority queue.
- Full name:
\ColorThief\PQueue
private array $contents
private bool $sorted
private callable $comparator
public __construct(callable $comparator): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$comparator |
callable |
private sort(): void
public push(mixed $object): void
Parameters:
Parameter | Type | Description |
---|---|---|
$object |
mixed |
public peek(?int $index = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$index |
?int |
public pop(): mixed|null
public size(): int
public map(callable $function, bool $sorted = true): array
Parameters:
Parameter | Type | Description |
---|---|---|
$function |
callable | |
$sorted |
bool |
public setComparator(callable $function): void
Parameters:
Parameter | Type | Description |
---|---|---|
$function |
callable |
public getContent(bool $sorted = true): \ColorThief\T[]
Parameters:
Parameter | Type | Description |
---|---|---|
$sorted |
bool |