Manages custom data within a time or frame based window

Type Parameters

  • T

Hierarchy (view full)

Constructors

Properties

data: TimedData<T>[] = []

Accessors

  • get size(): number
  • Returns number

    the size of the container, number of contained elements

  • get windowMode(): number
  • Returns number

    the currently set window mode of the container

  • get windowSize(): number
  • Returns number

    the currently set window size of the container, time interval or frame number depending on the windowMode

Methods

  • Returns T

    the average of the contained elements, or null if no data contained

  • clears the data array

    Returns void

  • adds new data to the container with timestamp updates the data array

    Parameters

    • timestamp: number

      timestamp of the data

    • data: T

      custom data

    Returns void

  • sets the window size in time unit or frame number depending on the windowMode

    Parameters

    • windowSize: number

      time unit or frame number

    Returns void

  • Updates the container by removing the outdated elements from the front of the data array. In FRAME windowMode, only the last windowSize elements are kept In TIME mode, the elements older than windowSize are removed from the frint of the array (relative to the current timestamp parameter)

    Parameters

    • timestamp: number

      current timestamp

    Returns void