cz.cuni.amis.utils.statistic
Interface IMovingAverage<TYPE>

Package class diagram package IMovingAverage
Type Parameters:
TYPE -
All Known Implementing Classes:
MovingAverage

public interface IMovingAverage<TYPE>

Represents interface to the moving average value.

Author:
Jimmy

Method Summary
 void add(TYPE item)
          Add another item into the moving average.
 TYPE getAverage()
          Returns an average of all items stored.
 int getCurrentLength()
          Return current number of items that are used to compute the average returned via getAverage().
 int getMaxLength()
          Return max number of consecutive items (added via add(Object) that are used to compute the average returned via getAverage().
 boolean isEnoughValues()
          Whether the object has enough values to compute the avarage according to the max numbers it may store (returns getCurrentLength() == getMaxLength().
 void reset()
          Resets the object -> it removes all items stored.
 void setMaxLength(int length)
          Sets number of items that the object requires for the computing of the average.
 

Method Detail

add

void add(TYPE item)
Add another item into the moving average.

Parameters:
item -

getAverage

TYPE getAverage()
Returns an average of all items stored.

Returns null if no values are stored.

Returns:

getCurrentLength

int getCurrentLength()
Return current number of items that are used to compute the average returned via getAverage().

Returns:

getMaxLength

int getMaxLength()
Return max number of consecutive items (added via add(Object) that are used to compute the average returned via getAverage().

Returns:

setMaxLength

void setMaxLength(int length)
Sets number of items that the object requires for the computing of the average. (Note that computation is done all the time, but when there is enough items == set number, the isEnoughValues() reports true.)

Parameters:
length -

isEnoughValues

boolean isEnoughValues()
Whether the object has enough values to compute the avarage according to the max numbers it may store (returns getCurrentLength() == getMaxLength().


reset

void reset()
Resets the object -> it removes all items stored. The getAverage() will return null after the call.



Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.