@OpenApi
public abstract class Metric
extends java.lang.Object
implements java.lang.Cloneable
| Constructor and Description |
|---|
Metric(java.lang.String name,
java.lang.String abbreviation,
MetricType type,
java.lang.String id,
int metricValueType)
Metric constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acceptChild(BaseElement child)
Return if the child is eligible to have their values calculated.
|
abstract boolean |
acceptModelElement(BaseElement element)
Check if the metrics can be calculated to the given element.
|
void |
addProperties(java.util.Collection properties)
Add a collection of properties to the metric properties.
|
void |
addProperty(Property property)
Add property to the metric properties.
|
MetricResult |
calculate(BaseElement target,
MetricsCalculator calculator)
Calculate metrics values for local, global, average, min and max modes.
|
protected abstract MetricResult |
calculateLocalMetricValue(BaseElement target)
Implement this method to calculate the local metric value.
|
java.lang.String |
getAbbreviation() |
java.lang.String |
getDescription() |
java.lang.String |
getID()
Getter for id
|
java.lang.String |
getName() |
protected java.util.List |
getPropertiesList()
Must return a List of metrics properties.
|
MetricType |
getType() |
protected boolean |
isCounted(BaseElement target)
Used for determine if the element should be counted to get average values.
|
void |
removeProperties(java.util.Collection properties)
Remove a collection of properties from metric properties.
|
void |
removeProperty(Property property)
Remove the property from the metric properties.
|
static int |
round(float number)
Round to down.
|
void |
setAbbreviation(java.lang.String abbreviation) |
void |
setDescription(java.lang.String description) |
void |
setID(java.lang.String id)
Setter for id
|
protected void |
setLimits(MetricResult result,
BaseElement element)
Set if the result is out of limits.
|
void |
setName(java.lang.String name) |
@OpenApi
public Metric(java.lang.String name,
java.lang.String abbreviation,
MetricType type,
java.lang.String id,
int metricValueType)
name - Unique name of the metricabbreviation - Unique abbreviation of metrictype - MetricTypeid - - Id unique for the metricsmetricValueType - metricValueType Use type from MetricValue constants class.MetricType,
MetricValue,
MetricResult@OpenApi public MetricResult calculate(BaseElement target, MetricsCalculator calculator)
target - BaseElement.calculator - MetricsCalculatorMetricsCalculator@OpenApi protected boolean acceptChild(BaseElement child)
child - BaseElement.@OpenApi protected boolean isCounted(BaseElement target)
target - BaseElement@OpenApi protected abstract MetricResult calculateLocalMetricValue(BaseElement target)
target - BaseElement@OpenApi public abstract boolean acceptModelElement(BaseElement element)
element - BaseElement@OpenApi public static int round(float number)
number - float to be rounded@OpenApi public void addProperty(Property property)
Property class or its subclasses.property - PropertyProperty@OpenApi public void addProperties(java.util.Collection properties)
Property class or its subclasses.properties - Collection of propertiesProperty@OpenApi public void removeProperties(java.util.Collection properties)
Property class or its subclasses.properties - Collection of propertiesProperty@OpenApi public void removeProperty(Property property)
Property class or its subclasses.property - PropertyProperty@OpenApi public java.lang.String getAbbreviation()
@OpenApi public void setAbbreviation(java.lang.String abbreviation)
abbreviation - The abbreviation to set.@OpenApi public java.lang.String getDescription()
@OpenApi public void setDescription(java.lang.String description)
description - The description to set.@OpenApi public java.lang.String getName()
@OpenApi public void setName(java.lang.String name)
name - The name to set.@OpenApi public MetricType getType()
@OpenApi protected void setLimits(MetricResult result, BaseElement element)
result - MetricResultelement - BaseElement.@OpenApi protected java.util.List getPropertiesList()
@OpenApi public java.lang.String getID()
@OpenApi public void setID(java.lang.String id)
id -