|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.util.TrailingAverage
public class TrailingAverage
Used to compute a trailing average of a value.
| Field Summary | |
|---|---|
protected int[] |
_history
The history of values. |
protected int |
_index
The index where we will next record a value. |
| Constructor Summary | |
|---|---|
TrailingAverage()
Creates a trailing average instance with the default number of values used to compute the average (10). |
|
TrailingAverage(int history)
Creates a trailing average instance with the specified number of values used to compute the average. |
|
| Method Summary | |
|---|---|
void |
record(int value)
Records a new value. |
String |
toString()
|
int |
value()
Returns the current averaged value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int[] _history
protected int _index
| Constructor Detail |
|---|
public TrailingAverage()
public TrailingAverage(int history)
| Method Detail |
|---|
public void record(int value)
public int value()
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||