FMLiveSwitchMovingAverage Class Reference

A moving average. More...

Instance Methods

(void) - add:
 Adds a sample. More...
 
(long long) - average
 Gets the average. More...
 
(instancetype) - initWithLookback:
 Initializes a new instance of the FMLiveSwitchMovingAverage class. More...
 

Class Methods

(FMLiveSwitchMovingAverage *) + movingAverageWithLookback:
 Initializes a new instance of the FMLiveSwitchMovingAverage class. More...
 

Detailed Description

A moving average.

Method Documentation

◆ add:

- (void) add: (long long)  value

Adds a sample.

Parameters
valueThe value to add.

◆ average

- (long long) average

Gets the average.

◆ initWithLookback:

- (instancetype) initWithLookback: (int)  lookback

Initializes a new instance of the FMLiveSwitchMovingAverage class.

Parameters
lookbackThe number of lookback values.

◆ movingAverageWithLookback:

+ (FMLiveSwitchMovingAverage*) movingAverageWithLookback: (int)  lookback

Initializes a new instance of the FMLiveSwitchMovingAverage class.

Parameters
lookbackThe number of lookback values.