@InterfaceAudience.Private public class RollingStatCalculator extends Object
Modifier and Type | Field and Description |
---|---|
private int |
currentIndexPosition |
private double |
currentSqrSum |
private double |
currentSum |
private long[] |
dataValues |
private long |
numberOfDataValues |
private int |
rollingPeriod |
Constructor and Description |
---|
RollingStatCalculator(int rollingPeriod)
Creates a RollingStatCalculator with given number of rolling periods.
|
Modifier and Type | Method and Description |
---|---|
private long[] |
fillWithZeros(int size)
n * @return an array of given size initialized with zeros
|
double |
getDeviation()
Returns deviation of the data values that are in the current list of data values
|
double |
getMean()
Returns mean of the data values that are in the current list of data values
|
void |
insertDataValue(long data)
Inserts given data value to array of data values to be considered for statistics calculation n
|
private void |
removeData(long data)
Update the statistics after removing the given data value n
|
private double currentSum
private double currentSqrSum
private long numberOfDataValues
private int rollingPeriod
private int currentIndexPosition
private long[] dataValues
public RollingStatCalculator(int rollingPeriod)
public void insertDataValue(long data)
private void removeData(long data)
public double getMean()
public double getDeviation()
private long[] fillWithZeros(int size)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.