Options
All
  • Public
  • Public/Protected
  • All
Menu

Array-like data structure. Use the convenience method makeVector and vectorFromArray to create vectors.

Type Parameters

Hierarchy

  • Vector

Index

Constructors

Properties

TArray: T["TArray"]
TType: T["TType"]
TValue: T["TValue"]
[isConcatSpreadable]: true
data: readonly Data<T>[]

The primitive Data instances for this Vector's elements.

length: number

The number of elements in this Vector.

numChildren: number

The number of child Vectors if this Vector is a nested dtype.

stride: number

The number of primitive values per Vector element.

type: T

The DataType of this Vector.

Accessors

  • get ArrayType(): T["ArrayType"]
  • The Array or TypedAray constructor used for the JS representation of the element's values in {@link Vector.prototype.toArray toArray()}.

    Returns T["ArrayType"]

  • get VectorName(): string
  • get [toStringTag](): string
  • The name that should be printed when the Vector is logged in a message.

    Returns string

  • get byteLength(): number
  • The aggregate size (in bytes) of this Vector's buffers and/or child Vectors.

    Returns number

  • get isMemoized(): boolean
  • get nullCount(): number
  • The number of null elements in this Vector.

    Returns number

Methods

  • [iterator](): IterableIterator<null | T["TValue"]>
  • Iterator for the Vector's elements.

    Returns IterableIterator<null | T["TValue"]>

  • Combines two or more Vectors of the same type.

    Parameters

    • Rest ...others: Vector<T>[]

      Additional Vectors to add to the end of this Vector.

    Returns Vector<T>

  • get(index: number): null | T["TValue"]
  • Get an element value by position.

    Parameters

    • index: number

      The index of the element to read.

    Returns null | T["TValue"]

  • getByteLength(index: number): number
  • Get the size in bytes of an element by index.

    Parameters

    • index: number

      The index at which to get the byteLength.

    Returns number

  • getChild<R>(name: R): null | Vector<any>
  • Returns a child Vector by name, or null if this Vector has no child with the given name.

    Type Parameters

    • R extends string | number | symbol

    Parameters

    • name: R

      The name of the child to retrieve.

    Returns null | Vector<any>

  • getChildAt<R>(index: number): null | Vector<R>
  • Returns a child Vector by index, or null if this Vector has no child at the supplied index.

    Type Parameters

    Parameters

    • index: number

      The index of the child to retrieve.

    Returns null | Vector<R>

  • includes(element: T["TValue"], offset?: number): boolean
  • Parameters

    • element: T["TValue"]
    • Optional offset: number

    Returns boolean

  • indexOf(element: T["TValue"], offset?: number): number
  • Retrieve the index of the first occurrence of a value in an Vector.

    Parameters

    • element: T["TValue"]

      The value to locate in the Vector.

    • Optional offset: number

      The index at which to begin the search. If offset is omitted, the search starts at index 0.

    Returns number

  • isValid(index: number): boolean
  • Check whether an element is null.

    Parameters

    • index: number

      The index at which to read the validity bitmap.

    Returns boolean

  • memoize(): MemoizedVector<T>
  • Adds memoization to the Vector's get method. For dictionary vectors, this method return a vector that memoizes only the dictionary values.

    Memoization is very useful when decoding a value is expensive such as Uft8. The memoization creates a cache of the size of the Vector and therfore increases memory usage.

    Returns MemoizedVector<T>

    A new vector that memoizes calls to get.

  • set(index: number, value: null | T["TValue"]): void
  • Set an element value by position.

    Parameters

    • index: number

      The index of the element to write.

    • value: null | T["TValue"]

      The value to set.

    Returns void

  • slice(begin?: number, end?: number): Vector<T>
  • Return a zero-copy sub-section of this Vector.

    Parameters

    • Optional begin: number
    • Optional end: number

      The end of the specified portion of the Vector. This is exclusive of the element at the index 'end'.

    Returns Vector<T>

  • toArray(): T["TArray"]
  • Return a JavaScript Array or TypedArray of the Vector's elements.

    note

    If this Vector contains a single Data chunk and the Vector's type is a primitive numeric type corresponding to one of the JavaScript TypedArrays, this method returns a zero-copy slice of the underlying TypedArray values. If there's more than one chunk, the resulting TypedArray will be a copy of the data from each chunk's underlying TypedArray values.

    Returns T["TArray"]

    An Array or TypedArray of the Vector's elements, based on the Vector's DataType.

  • toJSON(): (null | T["TValue"])[]
  • toString(): string
  • Returns a string representation of the Vector.

    Returns string

    A string representation of the Vector.

  • Returns a vector without memoization of the get method. If this vector is not memoized, this method returns this vector.

    Returns Vector<T>

    A a vector without memoization.

Generated using TypeDoc