gdDocumentation0.8.0

API reference

GDBinaryHeap

Heap that pops the value with the smallest rank chosen by pick first.

Methods

set_pick

set_pick(pick: Callable) -> void

Set the heap's rank-selection callback.

Parameters

NameTypeDefaultDescription
pickCallableRequiredCallable selecting a comparison or aggregation key from each value.

Return value

void

No value is returned.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

push

push(value: Variant) -> void

Insert a value and restore heap order.

Parameters

NameTypeDefaultDescription
valueVariantRequiredValue to store, serialize, validate or pass to the operation described above.

Return value

void

No value is returned.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

pop

pop() -> Variant

Remove and return the next value.

Parameters

No parameters.

Return value

Variant

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

peek

peek() -> Variant

Return the next value without removing it.

Parameters

No parameters.

Return value

Variant

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

drain

drain() -> Array

Remove all heap values in priority order.

Parameters

No parameters.

Return value

Array

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

size

size() -> int

Return the retained element count.

Parameters

No parameters.

Return value

int

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

is_empty

is_empty() -> bool

Report whether the container is empty.

Parameters

No parameters.

Return value

bool

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.