Constructor
Returns the current average
Resets the average counter to the zero state:
Returns the last value pushed
Pushes another value to the sliding window, overwriting the oldest one if the sliding window has reached its maximum size. Calculates the new average, stores it, and returns it.
Current average value of the whole window
The number of values the sliding window currently contains
Index of the value that was updated most recently
Sliding window, containing the values of the recent additions
Sliding Average Class
SlidingAverage is very simple. You can add values to the list and you can query the average at any time.