public class RollingAverage
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_SIZE |
| Constructor and Description |
|---|
RollingAverage()
Constructor, with default size
|
RollingAverage(int size)
Constructor, with given size
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNumber(int number)
Add a number to the rolling average
|
int |
getAverage()
Get the rolling average
|
void |
reset()
Reset the rolling average
|
void |
resize(int size)
Resize the rolling average
|
int |
size()
Get the size
|
public static final int DEFAULT_SIZE
public RollingAverage()
public RollingAverage(int size)
size - public int size()
public void resize(int size)
Side Effect: the rolling average is reset
size - public void addNumber(int number)
number - public int getAverage()
public void reset()