public class MetricValues extends Object
Constructor and Description |
---|
MetricValues(int numWindows)
Construct a MetricValues.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double[] values)
Add a value array to the existing value array.
|
void |
add(MetricValues metricValues)
Add another MetricValue to this MetricValues.
|
float |
avg() |
void |
clear()
Clear the entire MetricValues.
|
double[] |
doubleArray() |
double |
get(int index)
Get value at the given index.
|
boolean |
isEqual(MetricValues other) |
float |
latest() |
int |
length()
The length of the value array.
|
float |
max() |
void |
set(int index,
double value)
Set the value at the given index.
|
void |
subtract(double[] values)
Subtract a value array from the existing value array.
|
void |
subtract(MetricValues metricValues)
Subtract another MetricValue from this MetricValues.
|
String |
toString() |
void |
writeTo(OutputStream out)
Write the MetricValues directly into a OutputStream to avoid string conversion.
|
public MetricValues(int numWindows)
numWindows
- the number of windows the metric values should contain (i.e the length of the value array).public void set(int index, double value)
index
- the index to set the value.value
- the value to use.public double get(int index)
index
- the index to get value from.public void clear()
public int length()
public void add(double[] values)
values
- the value array to add.public void add(MetricValues metricValues)
metricValues
- the MetricValues to add.public void subtract(double[] values)
values
- the value array to add.public void subtract(MetricValues metricValues)
metricValues
- the MetricValues to add.public float avg()
public float max()
public float latest()
public double[] doubleArray()
public void writeTo(OutputStream out) throws IOException
out
- the output stream to write to.IOException
public boolean isEqual(MetricValues other)