|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
TYPE
- public interface IMovingAverage<TYPE>
Represents interface to the moving average value.
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 |
---|
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |