Class StatisticalCharacterizationAggregator
- java.lang.Object
-
- org.palladiosimulator.monitorrepository.statisticalcharacterization.StatisticalCharacterizationAggregator
-
- Direct Known Subclasses:
ArithmeticMeanAggregator
,GeometricMeanAggregator
,HarmonicMeanAggregator
,MedianAggregator
public abstract class StatisticalCharacterizationAggregator extends Object
Abstract base class for all implementations of aggregators forStatisticalCharacterization
s.
-
-
Constructor Summary
Constructors Constructor Description StatisticalCharacterizationAggregator(org.palladiosimulator.metricspec.NumericalBaseMetricDescription expectedDataMetric)
Initializes a new instance of theStatisticalCharacterizationAggregator
class with the given parameter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.palladiosimulator.measurementframework.MeasuringValue
aggregateData(Iterable<org.palladiosimulator.measurementframework.MeasuringValue> data, org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> intervalLeftBound, org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> intervalRightBound, Optional<org.jscience.physics.amount.Amount<javax.measure.quantity.Duration>> intervalLength)
Method to be called by clients that wish to aggregate a sequence of data.protected abstract javax.measure.Measure<Double,javax.measure.quantity.Quantity>
calculateStatisticalCharacterizationContinuous(Iterable<org.palladiosimulator.measurementframework.MeasuringValue> dataToAggregate)
Method to be implemented by each subclass to calculate the statistical characterization of a sequence of measurements with a continuous scope of validity (i.e., to aggregate them).
This method is invoked withinaggregateData(Iterable, Amount, Amount, Optional)
.protected abstract javax.measure.Measure<Double,javax.measure.quantity.Quantity>
calculateStatisticalCharaterizationDiscrete(Iterable<org.palladiosimulator.measurementframework.MeasuringValue> dataToAggregate)
Method to be implemented by each subclass to calculate the statistical characterization of a sequence of measurements with a discrete scope of validity (i.e., to aggregate them).
This method is invoked withinaggregateData(Iterable, Amount, Amount, Optional)
.javax.measure.unit.Unit<javax.measure.quantity.Quantity>
getDataDefaultUnit()
Gets the default unit of the aggregated data.org.palladiosimulator.metricspec.NumericalBaseMetricDescription
getDataMetric()
Gets the data metric of the measurements this instance is aggregating.protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration>
getIntervalLength()
Gets the length of the interval that the data to aggregate lie in.protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration>
obtainCurrentMeasurementValidityLength(org.palladiosimulator.measurementframework.MeasuringValue currentMeasurement, Optional<org.palladiosimulator.measurementframework.MeasuringValue> nextMeasurement)
Gets how "long" the value of a certain measurement (with a continuous scope of validity) is valid which is the difference between the point in time the next measurement was taken and that of the given measurement (or the left bound of the current interval if the latter is "larger").
In case no succeeding measurement is present, the right bound of the interval all data lie in is used instead.protected org.jscience.physics.amount.Amount<javax.measure.quantity.Quantity>
obtainDataFromMeasurement(org.palladiosimulator.measurementframework.MeasuringValue measurement)
Gets the desired data (i.e., the data that adheres to the expected data metric) from the given measurement.protected double
obtainDataValueFromMeasurement(org.palladiosimulator.measurementframework.MeasuringValue measurement)
Gets the numeric value of desired data (i.e., the data that adheres to the expected data metric) from the given measurement.
-
-
-
Constructor Detail
-
StatisticalCharacterizationAggregator
public StatisticalCharacterizationAggregator(org.palladiosimulator.metricspec.NumericalBaseMetricDescription expectedDataMetric)
Initializes a new instance of theStatisticalCharacterizationAggregator
class with the given parameter.- Parameters:
expectedDataMetric
- TheNumericalBaseMetricDescription
that describes which kind of measurements are expected to aggregate.- Throws:
NullPointerException
- In caseexpectedWindowMetric == null
.
-
-
Method Detail
-
getDataMetric
public org.palladiosimulator.metricspec.NumericalBaseMetricDescription getDataMetric()
Gets the data metric of the measurements this instance is aggregating.- Returns:
- The
NumericalBaseMetricDescription
representing the underlying metric of the data. - See Also:
getDataDefaultUnit()
-
getDataDefaultUnit
public javax.measure.unit.Unit<javax.measure.quantity.Quantity> getDataDefaultUnit()
Gets the default unit of the aggregated data.- Returns:
- The default unit of the aggregated data, expressed as a
Unit
object. - See Also:
NumericalBaseMetricDescription.getDefaultUnit()
,getDataMetric()
-
aggregateData
public final org.palladiosimulator.measurementframework.MeasuringValue aggregateData(Iterable<org.palladiosimulator.measurementframework.MeasuringValue> data, org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> intervalLeftBound, org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> intervalRightBound, Optional<org.jscience.physics.amount.Amount<javax.measure.quantity.Duration>> intervalLength)
Method to be called by clients that wish to aggregate a sequence of data.- Parameters:
data
- The sequence of data/measurements to be aggregated, expressed as anIterable
ofMeasuringValue
s.intervalLeftBound
- The left bound of the interval all measurements lie in, expressed in terms of aDuration
Amount
.
In the common case this parameter is only used for measurements with a continuousScopeOfValidity
data metric.intervalRightBound
- The right bound of the interval all measurements lie in, expressed in terms of aDuration
Amount
.
In the common case this parameter is only used for measurements with a continuousScopeOfValidity
data metric.intervalLength
- A potentially emptyOptional
indicating the interval length.
If empty, the length is computed from the passed interval bounds.- Returns:
- A
MeasuringValue
representing the result of the aggregation. - Throws:
NullPointerException
- If any of the parameters isnull
.IllegalArgumentException
- If any of the givenAmounts
represents a negative value.- See Also:
getDataMetric()
-
getIntervalLength
protected final org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> getIntervalLength()
Gets the length of the interval that the data to aggregate lie in.- Returns:
- An
Amount
indicating the interval length.
-
obtainDataFromMeasurement
protected final org.jscience.physics.amount.Amount<javax.measure.quantity.Quantity> obtainDataFromMeasurement(org.palladiosimulator.measurementframework.MeasuringValue measurement)
Gets the desired data (i.e., the data that adheres to the expected data metric) from the given measurement.- Parameters:
measurement
- AMeasuringValue
containing the data.- Returns:
- The desired data, expressed in terms of an
Amount
. - See Also:
obtainDataValueFromMeasurement(MeasuringValue)
,NumericalBaseMetricDescription.getDefaultUnit()
-
obtainDataValueFromMeasurement
protected final double obtainDataValueFromMeasurement(org.palladiosimulator.measurementframework.MeasuringValue measurement)
Gets the numeric value of desired data (i.e., the data that adheres to the expected data metric) from the given measurement.- Parameters:
measurement
- AMeasuringValue
containing the data.- Returns:
- The desired data value, expressed in terms of a double value in the default unit of the corresponding metric.
- See Also:
NumericalBaseMetricDescription.getDefaultUnit()
,obtainDataFromMeasurement(MeasuringValue)
-
calculateStatisticalCharaterizationDiscrete
protected abstract javax.measure.Measure<Double,javax.measure.quantity.Quantity> calculateStatisticalCharaterizationDiscrete(Iterable<org.palladiosimulator.measurementframework.MeasuringValue> dataToAggregate)
Method to be implemented by each subclass to calculate the statistical characterization of a sequence of measurements with a discrete scope of validity (i.e., to aggregate them).
This method is invoked withinaggregateData(Iterable, Amount, Amount, Optional)
.- Parameters:
dataToAggregate
- The sequence of data/measurements to be aggregated, expressed as anIterable
ofMeasuringValue
s.- Returns:
- A
Measure
representing the result of the aggregation. - See Also:
getDataMetric()
,BaseMetricDescription.getScopeOfValidity()
-
calculateStatisticalCharacterizationContinuous
protected abstract javax.measure.Measure<Double,javax.measure.quantity.Quantity> calculateStatisticalCharacterizationContinuous(Iterable<org.palladiosimulator.measurementframework.MeasuringValue> dataToAggregate)
Method to be implemented by each subclass to calculate the statistical characterization of a sequence of measurements with a continuous scope of validity (i.e., to aggregate them).
This method is invoked withinaggregateData(Iterable, Amount, Amount, Optional)
.- Parameters:
dataToAggregate
- The sequence of data/measurements to be aggregated, expressed as anIterable
ofMeasuringValue
s.- Returns:
- A
Measure
representing the result of the aggregation. - See Also:
getDataMetric()
,BaseMetricDescription.getScopeOfValidity()
-
obtainCurrentMeasurementValidityLength
protected final org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> obtainCurrentMeasurementValidityLength(org.palladiosimulator.measurementframework.MeasuringValue currentMeasurement, Optional<org.palladiosimulator.measurementframework.MeasuringValue> nextMeasurement)
Gets how "long" the value of a certain measurement (with a continuous scope of validity) is valid which is the difference between the point in time the next measurement was taken and that of the given measurement (or the left bound of the current interval if the latter is "larger").
In case no succeeding measurement is present, the right bound of the interval all data lie in is used instead.- Parameters:
currentMeasurement
- TheMeasuringValue
whose validity "length" is to be determined.nextMeasurement
- AnOptional
containing the directly succeedingMeasuringValue
, or an emptyOptional
in case none is at hand.- Returns:
- The validity "length" of the measurement, expressed in terms of a
Duration
Amount
. - Throws:
IllegalStateException
- If theScopeOfValidity
of the underlying metric is notScopeOfValidity.CONTINUOUS
.- See Also:
aggregateData(Iterable, Amount, Amount, Optional)
,getDataMetric()
,BaseMetricDescription.getScopeOfValidity()
-
-