|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcz.cuni.amis.utils.statistic.MovingAverage<TYPE>
public class MovingAverage<TYPE>

| Constructor Summary | |
|---|---|
MovingAverage(IAveragator<TYPE> averagator)
|
|
| 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 IMovingAverage.getAverage(). |
int |
getMaxLength()
Return max number of consecutive items (added via IMovingAverage.add(Object) that are used to
compute the average returned via IMovingAverage.getAverage(). |
boolean |
isEnoughValues()
Whether the object has enough values to compute the avarage according to the max numbers it may store (returns IMovingAverage.getCurrentLength() == IMovingAverage.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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MovingAverage(IAveragator<TYPE> averagator)
| Method Detail |
|---|
public void add(TYPE item)
IMovingAverage
add in interface IMovingAverage<TYPE>public TYPE getAverage()
IMovingAverageReturns null if no values are stored.
getAverage in interface IMovingAverage<TYPE>public int getCurrentLength()
IMovingAverageIMovingAverage.getAverage().
getCurrentLength in interface IMovingAverage<TYPE>public int getMaxLength()
IMovingAverageIMovingAverage.add(Object) that are used to
compute the average returned via IMovingAverage.getAverage().
getMaxLength in interface IMovingAverage<TYPE>public boolean isEnoughValues()
IMovingAverageIMovingAverage.getCurrentLength() == IMovingAverage.getMaxLength().
isEnoughValues in interface IMovingAverage<TYPE>public void reset()
IMovingAverageIMovingAverage.getAverage() will return
null after the call.
reset in interface IMovingAverage<TYPE>public void setMaxLength(int length)
IMovingAverageIMovingAverage.isEnoughValues() reports true.)
setMaxLength in interface IMovingAverage<TYPE>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||