Skip to content

ILossyHeap

Defined in: packages/data/src/heap/ilossy-heap.ts:14

The lossy sibling of IHeap: never throws or waits when a bounded heap is full, evicting or skipping instead (overflowPolicy).

"evict" drops the root — the same element extract/peek already expose, since a heap has no ends to pick a victim from. To keep the N greatest instead, construct with the inverse ordering.

T extends DefinedValue = DefinedValue

readonly capacity: number

Defined in: packages/data/src/collection/ibounded.ts:17

The maximum number of elements the collection can hold.

Note: Infinity is not a legal value here — an unbounded type omits this mixin.

ILossy.capacity


readonly overflowPolicy: OverflowPolicy

Defined in: packages/data/src/collection/ilossy.ts:20

Policy applied when the collection reaches its capacity.

ILossy.overflowPolicy


readonly precedes: OrderPredicate<T>

Defined in: packages/data/src/heap/iheap.ts:15

Strict weak ordering: precedes(a, b) is true when a outranks b.

IHeap.precedes

[iterator](): Iterator<T, any, any>

Defined in: node_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es2015.iterable.d.ts:47

Iterator<T, any, any>

IHeap.[iterator]


clear(): void

Defined in: packages/data/src/collection/icollection.ts:23

Removes all elements from the collection.

void

IHeap.clear


count(): number

Defined in: packages/data/src/collection/icollection.ts:20

The number of elements in the collection.

A method, not a getter: its async counterpart needs a round trip to the backing store, and a member must have the same shape in both.

number

IHeap.count


extract(): T | undefined

Defined in: packages/data/src/heap/iheap.ts:36

Removes and returns the root item of the heap.

T | undefined

The root item of the heap, or undefined if the heap is empty.

IHeap.extract


extractAndInsert(item): T | undefined

Defined in: packages/data/src/heap/iheap.ts:51

Extracts the root item from the heap and inserts a new item in one operation.

T

The item to replace.

T | undefined

IHeap.extractAndInsert


insert(item): readonly T[]

Defined in: packages/data/src/heap/ilossy-heap.ts:22

Same as IHeap.insert, but never throws — returns the items dropped to make room (empty if nothing was dropped).

T

readonly T[]

IHeap.insert

IHeap.insert


insertAll(items): readonly T[]

Defined in: packages/data/src/heap/ilossy-heap.ts:30

Same as IHeap.insertAll, but never throws — returns the items dropped to make room (empty if nothing was dropped).

readonly T[]

readonly T[]

IHeap.insertAll

IHeap.insertAll


insertAndExtract(item): T | undefined

Defined in: packages/data/src/heap/iheap.ts:59

Inserts an item into the heap and then extracts and returns the root item in one operation.

T

The item to insert and extract.

T | undefined

IHeap.insertAndExtract


peek(): T | undefined

Defined in: packages/data/src/heap/iheap.ts:43

Returns the root item of the heap without removing it.

T | undefined

The root item of the heap, or undefined if the heap is empty.

IHeap.peek