An ordered list of values that can be added to but not altered; older values might be forgotten. Each value has a unique unchanging index in the HistoryList, but a HistoryList has a limited capacity and old values will be dropped if necessary from the HistoryList to make room for new values to be added.

HistoryList contains only those values whose index is between getStartIndex and getEndIndex (inclusive). The start and end index can change when writing a new value to the list, because a new value might overwrite an old value.

The type of value stored can be number, string, boolean or any object. When using HistoryList you can specify to the compiler the type of the value with angle brackets. For example HistoryList<!Vector> indicates storing non-null Vectors in the HistoryList.

interface HistoryList<T> {
    getEndIndex(): number;
    getEndValue(): null | T;
    getIterator(index?): HistoryIterator<T>;
    getSize(): number;
    getStartIndex(): number;
    getValue(index): T;
    reset(): void;
    store(value): number;
}

Type Parameters

  • T

Implemented by

Methods

  • Returns the index of the ending value in this HistoryList. The ending value is the newest value in this HistoryList.

    Returns number

    the index of the ending value in this HistoryList, or –1 if nothing has been stored

    Throws

    when the index number exceeds the maximum representable integer

  • Returns the last value stored in this HistoryList, or null if this HistoryList is empty.

    Returns null | T

    the last value stored in this HistoryList, or null if this HistoryList is empty

  • Returns a HistoryIterator which begins at the given index in this HistoryList.

    Parameters

    • Optional index: number

      the index to start the iterator at; if undefined or –1, then starts at beginning of this HistoryList

    Returns HistoryIterator<T>

    a HistoryIterator which begins at the given index in this HistoryList.

  • Returns the number of points currently stored in this HistoryList (which is less than or equal to the capacity of this HistoryList).

    Returns number

    the number of points currently stored in this HistoryList

  • Returns the index of the starting value in this HistoryList. The starting value is the oldest value in this HistoryList.

    Returns number

    the index of the starting value in this HistoryList

    Throws

    when the index number exceeds the maximum representable integer

  • Returns the value stored at the given index in this HistoryList.

    Parameters

    • index: number

      the index of the value of interest

    Returns T

    the value stored at the given index

    Throws

    if the index is out of range

  • Clears out the memory of this HistoryList, so that there are no values stored. The capacity of this HistoryList is unchanged.

    Returns void

  • Stores the given value into this HistoryList.

    Parameters

    • value: T

      the value to store

    Returns number

    index within HistoryList where the value was stored

    Throws

    when the index number exceeds the maximum representable integer

Generated using TypeDoc