public class DoubleExpMovingAvg extends MapStatComponent<Double,DoubleExpMovingAvg>
| Constructor and Description |
|---|
DoubleExpMovingAvg(String name,
long periodMillis)
Creates an instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(DoubleExpMovingAvg other)
Add the values from another average.
|
void |
add(double value,
long time)
Adds a new value to the average, ignoring values that are not newer than
time of the previous call.
|
void |
clear()
Resets the statistic to its initial state.
|
DoubleExpMovingAvg |
copy()
Narrow the return type to the component type.
|
Double |
get()
Returns the current average, or 0 if no values have been added.
|
protected String |
getFormattedValue(boolean useCommas)
Returns the value of the statistic as a formatted string, either using
or not using commas as requested.
|
String |
getName()
Returns the name of this stat.
|
boolean |
isNotSet()
Returns whether the statistic is in its initial state.
|
String |
toString() |
getFormattedValuepublic DoubleExpMovingAvg(String name, long periodMillis)
periodMillis represents
the time period in milliseconds over which values will be averaged.name - the name of this statperiodMillis - the averaging period in millisecondspublic String getName()
public void add(double value,
long time)
value - the new valuetime - the current time in millisecondspublic void add(DoubleExpMovingAvg other)
other - the other averagepublic Double get()
public void clear()
BaseStatpublic DoubleExpMovingAvg copy()
MapStatComponentcopy in class MapStatComponent<Double,DoubleExpMovingAvg>protected String getFormattedValue(boolean useCommas)
MapStatComponentgetFormattedValue in class MapStatComponent<Double,DoubleExpMovingAvg>useCommas - whether to use commaspublic boolean isNotSet()
BaseStatCopyright © 2024. All rights reserved.