public class AggregatedMetricValues extends Object
Constructor and Description |
---|
AggregatedMetricValues()
Create an empty metric values.
|
AggregatedMetricValues(Map<Short,MetricValues> valuesByMetricId)
Create an AggregatedMetricValues with the given values by metric ids.
|
Modifier and Type | Method and Description |
---|---|
void |
add(AggregatedMetricValues other)
Add another AggregatedMetricValues to this one.
|
void |
add(short metricId,
MetricValues metricValuesToAdd)
Add the metric value to the given metric id.
|
void |
clear()
Clear all the values in this AggregatedMetricValues.
|
boolean |
isEmpty()
Check if the AggregatedMetricValues contains value for any metrics.
|
int |
length() |
Set<Short> |
metricIds() |
void |
subtract(AggregatedMetricValues other)
Subtract another AggregatedMetricValues from this one.
|
String |
toString() |
AggregatedMetricValues |
valuesFor(Collection<Short> metricIds,
boolean shareValueArray)
Get all the metric values for the given metric ids.
|
MetricValues |
valuesFor(short metricId)
Get the
MetricValues for the given metric id |
MetricValues |
valuesForGroup(String group,
MetricDef metricDef,
boolean shareValueArray)
Get a MetricValues which contains the sum of the values for all the metrics of a group in each corresponding
window.
|
void |
writeTo(OutputStream out)
Write this AggregatedMetricValues to the output stream to avoid string conversion.
|
public AggregatedMetricValues()
public AggregatedMetricValues(Map<Short,MetricValues> valuesByMetricId)
valuesByMetricId
- the values of the metrics. The key is the metric id.public MetricValues valuesFor(short metricId)
MetricValues
for the given metric idmetricId
- the metric id to get metric values.MetricValues
for the given metric id.public AggregatedMetricValues valuesFor(Collection<Short> metricIds, boolean shareValueArray)
metricIds
- the interested metric ids.shareValueArray
- whether the returned result should share the same value array with this class or not.public MetricValues valuesForGroup(String group, MetricDef metricDef, boolean shareValueArray)
group
- the group to get the metrics for.metricDef
- the metric definitionsshareValueArray
- whether the returned result should share the same value array with this class or not when
possible.public int length()
public boolean isEmpty()
public void add(short metricId, MetricValues metricValuesToAdd)
metricId
- the metric id the values associated with.metricValuesToAdd
- the metric values to add.public void add(AggregatedMetricValues other)
other
- the other AggregatedMetricValues.public void subtract(AggregatedMetricValues other)
other
- the other AggregatedMetricValues to subtract from this one.public void clear()
public void writeTo(OutputStream out) throws IOException
out
- the OutputStream.IOException