Options
All
  • Public
  • Public/Protected
  • All
Menu

The model which actually handles new points/data and calculates the aggregation for a given AggragatorValue.

Hierarchy

  • AggregatorModel

Index

Constructors

constructor

  • Parameters

    • datapoints: number

      Number of points the datastore can hold.

    Returns AggregatorModel

Properties

Private cumulativeSum

cumulativeSum: number = 0

The cumulative sum of all value inputs ever made.

Private datastore

datastore: AggregatorDatapoint[] = []

The datastore is used in FIFO fashion, with newest element in front Meaning: .shift() to add, .pop() to remove

Readonly id

id: string

Unique Id.

Private maxDatapoints

maxDatapoints: number

Number of points that the datastore can hold.

Private totalInteractions

totalInteractions: number = 0

Total number of interactions all players made.

Methods

addValue

  • addValue(value: number): void
  • Add a value to the aggregator.

    Parameters

    • value: number

      The new input value.

    Returns void

getAverage

  • getAverage(pointsToConsider?: number, secondsToConsider?: number): number
  • Calculates the average over the inputs made.

    Parameters

    • Optional pointsToConsider: number

      Used to calculate the running average over this number of points.

    • Optional secondsToConsider: number

      Used to calculate the running average over this number of seconds.

    Returns number

    The average as number literal.

getCumSum

  • getCumSum(): number
  • Calculates the cumulative sum over all inputs made.

    Returns number

    The cumulative sum as number literal.

getInteractions

  • getInteractions(): number
  • Calculates the total number of player interactions ever made.

    Returns number

    The number of interactions as number literal.

getLatest

  • getLatest(): number
  • Get a value without using AggregatorMethod type.

    Returns number

    The latest number from the datastore.

getMedian

  • getMedian(pointsToConsider?: number, secondsToConsider?: number): number
  • Calculates the median over the inputs made.

    Parameters

    • Optional pointsToConsider: number

      Used to calculate the running median over this number of points.

    • Optional secondsToConsider: number

      Used to calculate the running median over this number of seconds.

    Returns number

    The median as number literal.

getValue

  • Get a value using AggregatorMethod type.

    Parameters

    Returns number

    The aggregated number.

reset

  • reset(): void
  • Reset internal values.

    Returns void

Generated using TypeDoc