IBidirectionalCursorSequence
Defined in: packages/data/src/cursor/ibidirectional-cursor-sequence.ts:7
Adds the operations that need a predecessor, i.e. a back link or an index.
Extends
Section titled “Extends”ICursorSequence<T,C>
Type Parameters
Section titled “Type Parameters”T extends DefinedValue = DefinedValue
C extends IBidirectionalCursor<T> = IBidirectionalCursor<T>
Methods
Section titled “Methods”begin()
Section titled “begin()”begin():
C
Defined in: packages/data/src/cursor/icursor-sequence.ts:17
The first element; invalid when empty.
Returns
Section titled “Returns”C
Inherited from
Section titled “Inherited from”cursorAt()
Section titled “cursorAt()”cursorAt(
index):C
Defined in: packages/data/src/cursor/icursor-sequence.ts:23
O(1) for random-access backings, O(n) otherwise.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”C
Inherited from
Section titled “Inherited from”end():
C
Defined in: packages/data/src/cursor/icursor-sequence.ts:20
The past-the-end position, used to append.
Returns
Section titled “Returns”C
Inherited from
Section titled “Inherited from”insertAfter()
Section titled “insertAfter()”insertAfter(
cursor,item):void
Defined in: packages/data/src/cursor/icursor-sequence.ts:31
Inserts an item after cursor. O(1).
Parameters
Section titled “Parameters”cursor
Section titled “cursor”C
The position after which to insert.
T
The item to insert.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”insertAllAfter()
Section titled “insertAllAfter()”insertAllAfter(
cursor,items):void
Defined in: packages/data/src/cursor/icursor-sequence.ts:40
Inserts every item after cursor, keeping their relative order. O(n) in
the number of items.
Parameters
Section titled “Parameters”cursor
Section titled “cursor”C
The position after which to insert.
readonly T[]
The items to insert.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ICursorSequence.insertAllAfter
insertAllBefore()
Section titled “insertAllBefore()”insertAllBefore(
cursor,items):void
Defined in: packages/data/src/cursor/ibidirectional-cursor-sequence.ts:26
Inserts every item before cursor, keeping their relative order. O(n) in
the number of items.
Parameters
Section titled “Parameters”cursor
Section titled “cursor”C
The position before which to insert.
readonly T[]
The items to insert.
Returns
Section titled “Returns”void
insertBefore()
Section titled “insertBefore()”insertBefore(
cursor,item):void
Defined in: packages/data/src/cursor/ibidirectional-cursor-sequence.ts:17
Inserts an item before cursor. O(1).
Parameters
Section titled “Parameters”cursor
Section titled “cursor”C
The position before which to insert.
T
The item to insert.
Returns
Section titled “Returns”void
removeAfter()
Section titled “removeAfter()”removeAfter(
cursor):T|undefined
Defined in: packages/data/src/cursor/icursor-sequence.ts:49
Removes the element after cursor. O(1). Cursors at the removed element
become invalid.
Parameters
Section titled “Parameters”cursor
Section titled “cursor”C
The position before the element to remove.
Returns
Section titled “Returns”T | undefined
The removed element, or undefined if there was none.
Inherited from
Section titled “Inherited from”removeAt()
Section titled “removeAt()”removeAt(
cursor):T|undefined
Defined in: packages/data/src/cursor/ibidirectional-cursor-sequence.ts:35
Removes the element at cursor. O(1). Cursors at the removed element
become invalid.
Parameters
Section titled “Parameters”cursor
Section titled “cursor”C
The position to remove.
Returns
Section titled “Returns”T | undefined
The removed element, or undefined if cursor was not valid.
setAt()
Section titled “setAt()”setAt(
cursor,item):void
Defined in: packages/data/src/cursor/icursor-sequence.ts:57
Replaces the element at cursor.
Parameters
Section titled “Parameters”cursor
Section titled “cursor”C
The position to replace.
T
The new item.
Returns
Section titled “Returns”void