eos.util
Class Averager

Object
  extended by eos.util.Averager

public class Averager
extends Object

A tool to calculate the mean of a data series. Data are continuously fed into a fixed-size buffer, and their average are calculated. When the buffer is full, the oldest datum would be swapped out.

Author:
zhihongx

Constructor Summary
Averager(int size)
          Create a new Averager with buffer size size
 
Method Summary
 double update(double val)
          Add val to buffer and returns the mean of data in the buffer
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Averager

public Averager(int size)
Create a new Averager with buffer size size

Parameters:
size -
Method Detail

update

public double update(double val)
Add val to buffer and returns the mean of data in the buffer

Parameters:
val -
Returns:
mean of data inside the buffer