Skip to content

DoublyLinkedListCursor

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

A cursor over a DoublyLinkedList.

A cursor whose element was removed — by any means, not just through this cursor — is exactly when valid becomes false; the underlying node is marked on removal, and every cursor still referencing it observes that mark. end()’s cursor has no node of its own: insertAfter/insertBefore on it append (reading the list’s current tail live, so it never goes stale), and retreat() from it moves to the current last element. Retreating past the first element fails (returns false, cursor unchanged) rather than modelling a symmetrical “before the beginning” position.

T extends DefinedValue

The type of elements in the list.

new DoublyLinkedListCursor<T>(list, node): DoublyLinkedListCursor<T>

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

DoublyLinkedList<T>

DoublyLinkedListNode_<T> | null

DoublyLinkedListCursor<T>

get valid(): boolean

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

False once moved past the end, or once its element was removed.

boolean

False once moved past the end, or once its element was removed.

IBidirectionalCursor.valid


get value(): T | undefined

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

The element at this position, undefined when not valid.

T | undefined

The element at this position, undefined when not valid.

IBidirectionalCursor.value

advance(): boolean

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

Moves one position forward.

boolean

false if that moved past the end.

IBidirectionalCursor.advance


clone(): DoublyLinkedListCursor<T>

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

An independent cursor at the same position.

DoublyLinkedListCursor<T>

IBidirectionalCursor.clone


retreat(): boolean

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

Moves one position back.

boolean

false if that moved before the start.

IBidirectionalCursor.retreat