Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Slice<T>

Represents a slice of a sequence of items. This allows to abstract the access to the items and prevent extraneous copies of the sequence.

Type parameters

  • T

Hierarchy

  • Slice

Index

Constructors

constructor

  • new Slice(sequence: Sequence<T>, start: number, end: number, reversed: boolean): Slice

Properties

end

end: number

The index after the last item in the slice, relative to the original sequence.

length

length: number

The length of the slice.

reversed

reversed: boolean

Reverse the access to the items: slice.get(0) will return the last item instead of the first.

sequence

sequence: Sequence<T>

The original sequence.

start

start: number

The index of the first item in the slice, relative to the original sequence.

Methods

getAbsoluteIndex

  • getAbsoluteIndex(relativeIndex: number): number

getItem

  • getItem(index: number): T

indexOf

  • indexOf(item: T): number

reverse

split

Generated using TypeDoc