TYPE - public interface IMovingAverage<TYPE>
| Modifier and Type | Method and Description |
|---|---|
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.
|
void add(TYPE item)
item - TYPE getAverage()
Returns null if no values are stored.
int getCurrentLength()
getAverage().int getMaxLength()
add(Object) that are used to
compute the average returned via getAverage().void setMaxLength(int length)
isEnoughValues() reports true.)length - boolean isEnoughValues()
getCurrentLength() == getMaxLength().void reset()
getAverage() will return
null after the call.Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.