Skip to content

BoundedDoublyLinkedList

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:29

A DoublyLinkedList that holds at most capacity items and throws once full.

T extends DefinedValue

The type of elements in the list.

new BoundedDoublyLinkedList<T>(iterable, options): BoundedDoublyLinkedList<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:42

Iterable<T, any, any> | undefined

BoundedDoublyLinkedListOptions<T>

BoundedDoublyLinkedList<T>

readonly capacity: number

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:40

The maximum number of elements the collection can hold.

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

IBounded.capacity

[iterator](): Iterator<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:54

Iterator<T>

IPopFrontStorage.[iterator]


back(): T | undefined

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:150

T | undefined

IPopBackStorage.back


begin(): DoublyLinkedListCursor<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:174

The first element; invalid when empty.

DoublyLinkedListCursor<T>

IBidirectionalCursorSequence.begin


clear(): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:58

Removes all elements from the collection.

void

IPopFrontStorage.clear


count(): number

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:62

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

IPopFrontStorage.count


cursorAt(index): DoublyLinkedListCursor<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:182

O(1) for random-access backings, O(n) otherwise.

number

DoublyLinkedListCursor<T>

IBidirectionalCursorSequence.cursorAt


end(): DoublyLinkedListCursor<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:178

The past-the-end position, used to append.

DoublyLinkedListCursor<T>

IBidirectionalCursorSequence.end


front(): T | undefined

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:170

T | undefined

IPopFrontStorage.front


get(index): T | undefined

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:85

Returns the item at the specified index.

If the index is negative, it counts from the end of the list. If the index is out of bounds, undefined is returned.

Not uniformly O(1). This member reads as positional access, but only a random-access backing answers it in constant time. On a linked backing, it walks from an end, so a loop calling get over every index is quadratic. Iterate the list, or take a cursor (ICursorSequence/IBidirectionalCursorSequence), whenever the access pattern is sequential. Each implementation states its own complexity.

number

The index of the item to retrieve.

T | undefined

The item at the specified index, or undefined if the index is out of bounds.

IList.get


insertAfter(cursor, item): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:186

Inserts an item after cursor. O(1).

DoublyLinkedListCursor<T>

The position after which to insert.

T

The item to insert.

void

IBidirectionalCursorSequence.insertAfter


insertAllAfter(cursor, items): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:192

Inserts every item after cursor, keeping their relative order. O(n) in the number of items.

DoublyLinkedListCursor<T>

The position after which to insert.

readonly T[]

The items to insert.

void

IBidirectionalCursorSequence.insertAllAfter


insertAllBefore(cursor, items): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:204

Inserts every item before cursor, keeping their relative order. O(n) in the number of items.

DoublyLinkedListCursor<T>

The position before which to insert.

readonly T[]

The items to insert.

void

IBidirectionalCursorSequence.insertAllBefore


insertBefore(cursor, item): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:198

Inserts an item before cursor. O(1).

DoublyLinkedListCursor<T>

The position before which to insert.

T

The item to insert.

void

IBidirectionalCursorSequence.insertBefore


popBack(): T | undefined

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:146

T | undefined

IPopBackStorage.popBack


popFront(): T | undefined

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:166

T | undefined

IPopFrontStorage.popFront


pushBack(item): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:134

T

void

IPushBackStorage.pushBack


pushBackAll(items): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:140

readonly T[]

void

IPushBackStorage.pushBackAll


pushFront(item): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:154

T

void

IPushFrontStorage.pushFront


pushFrontAll(items): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:160

readonly T[]

void

IPushFrontStorage.pushFrontAll


remove(condition): IterableIterator<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:70

Removes every item matching the given predicate.

Predicate<[T]>

A predicate function to identify the items to remove.

IterableIterator<T>

An iterator of the removed items.

IList.remove


removeAfter(cursor): T | undefined

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:213

Removes the element after cursor. O(1). Cursors at the removed element become invalid.

DoublyLinkedListCursor<T>

The position before the element to remove.

T | undefined

The removed element, or undefined if there was none.

IBidirectionalCursorSequence.removeAfter


removeAt(cursor): T | undefined

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:217

Removes the element at cursor. O(1). Cursors at the removed element become invalid.

DoublyLinkedListCursor<T>

The position to remove.

T | undefined

The removed element, or undefined if cursor was not valid.

IBidirectionalCursorSequence.removeAt


removeFirst(condition): boolean

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:66

Removes the first occurrence of the item matching the given predicate.

Predicate<[T]>

A predicate function to identify the item to remove.

boolean

true if the item was found and removed, false otherwise.

IList.removeFirst


replace(condition, newItemFactory): IterableIterator<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:78

Replaces every item matching the given predicate.

Predicate<[T]>

A predicate function to identify the items to replace.

Callable<[T], T>

A function that takes the old item and returns the new item to insert.

IterableIterator<T>

An iterator of the replaced items.

IList.replace


replaceFirst(condition, newItem): boolean

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:74

Replaces the first occurrence of the item matching the given predicate.

Predicate<[T]>

A predicate function to identify the item to replace.

T

The new item to insert.

boolean

true if the item was found and replaced, false otherwise.

IList.replaceFirst


set(index, item): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:89

Sets the item at the specified index.

If the index is negative, it counts from the end of the list. If the index is equal to the length of the list, the item is appended to the end. If the index is out of bounds, a RangeError is thrown.

number

The index at which to set the item.

T

The item to set.

void

If the index is out of bounds.

IList.set


setAt(cursor, item): void

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:221

Replaces the element at cursor.

DoublyLinkedListCursor<T>

The position to replace.

T

The new item.

void

IBidirectionalCursorSequence.setAt


slice(start?, end?): IterableIterator<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:130

Slice the list to a new list from start to end.

This method does not mutate the original list.

The range is specified by the start and end parameters, which are inclusive and exclusive, respectively. If start is omitted, it defaults to 0. If end is omitted, it defaults to the length of the list.

If either start or end is negative, they refer to positions from the end of the list. For example, -1 refers to the last element, -2 refers to the second last element, and so on.

If start is greater than or equal to end, the result is an empty iterator.

If the start index is out of bounds, a RangeError is thrown. If end is out of bounds, it is clamped to the valid range.

number

Optional start index of the range (inclusive).

number

Optional end index of the range (exclusive).

IterableIterator<T>

An iterator for the elements in the specified range.

If the start index is out of bounds.

IList.slice


splice(start, deleteCount?, item?): IterableIterator<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:97

Change the content of the list by removing or replacing existing elements and/or adding new elements in place.

If the start index is negative, it counts from the end of the list. If the start index is equal to the length of the list, no elements are removed and the items are appended to the end of the list. If the start index is out of bounds, a RangeError is thrown.

If deleteCount is omitted, it defaults to Infinity, meaning all elements from the start index to the end of the list will be removed. If deleteCount is greater than the number of elements from start to the end of the list, it will remove all elements from start to the end of the list. If deleteCount is 0 or negative, no elements will be removed.

If items are provided, they will be inserted starting at the start index.

number

The index at which to start changing the list.

number = Infinity

The number of elements to remove from the list. Defaults to Infinity

T

An optional element to add to the list at the start index.

IterableIterator<T>

An iterable of the removed items.

If the start index is out of bounds.

IList.splice


spliceAll(start, deleteCount?, items?): IterableIterator<T>

Defined in: packages/data/src/list/bounded-doubly-linked-list.ts:116

Same as IList.splice, but inserts every element of items at the start index, keeping their relative order.

number

The index at which to start changing the list.

number = Infinity

The number of elements to remove from the list. Defaults to Infinity

readonly T[] = []

The elements to add to the list, beginning at the start index.

IterableIterator<T>

An iterable of the removed items.

If the start index is out of bounds.

IList.spliceAll