Class StatisticalCharacterizationAggregator
java.lang.Object
org.palladiosimulator.monitorrepository.statisticalcharacterization.StatisticalCharacterizationAggregator
- Direct Known Subclasses:
ArithmeticMeanAggregator,GeometricMeanAggregator,HarmonicMeanAggregator,MedianAggregator
Abstract base class for all implementations of aggregators for
StatisticalCharacterizations.-
Constructor Summary
ConstructorsConstructorDescriptionStatisticalCharacterizationAggregator(org.palladiosimulator.metricspec.NumericalBaseMetricDescription expectedDataMetric) Initializes a new instance of theStatisticalCharacterizationAggregatorclass with the given parameter. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.palladiosimulator.measurementframework.MeasuringValueaggregateData(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>Gets the default unit of the aggregated data.org.palladiosimulator.metricspec.NumericalBaseMetricDescriptionGets the data metric of the measurements this instance is aggregating.protected final org.jscience.physics.amount.Amount<javax.measure.quantity.Duration>Gets the length of the interval that the data to aggregate lie in.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.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.protected final doubleobtainDataValueFromMeasurement(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 Details
-
StatisticalCharacterizationAggregator
public StatisticalCharacterizationAggregator(org.palladiosimulator.metricspec.NumericalBaseMetricDescription expectedDataMetric) Initializes a new instance of theStatisticalCharacterizationAggregatorclass with the given parameter.- Parameters:
expectedDataMetric- TheNumericalBaseMetricDescriptionthat describes which kind of measurements are expected to aggregate.- Throws:
NullPointerException- In caseexpectedWindowMetric == null.
-
-
Method Details
-
getDataMetric
public org.palladiosimulator.metricspec.NumericalBaseMetricDescription getDataMetric()Gets the data metric of the measurements this instance is aggregating.- Returns:
- The
NumericalBaseMetricDescriptionrepresenting the underlying metric of the data. - See Also:
-
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
Unitobject. - 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 anIterableofMeasuringValues.intervalLeftBound- The left bound of the interval all measurements lie in, expressed in terms of aDurationAmount.
In the common case this parameter is only used for measurements with a continuousScopeOfValiditydata metric.intervalRightBound- The right bound of the interval all measurements lie in, expressed in terms of aDurationAmount.
In the common case this parameter is only used for measurements with a continuousScopeOfValiditydata metric.intervalLength- A potentially emptyOptionalindicating the interval length.
If empty, the length is computed from the passed interval bounds.- Returns:
- A
MeasuringValuerepresenting the result of the aggregation. - Throws:
NullPointerException- If any of the parameters isnull.IllegalArgumentException- If any of the givenAmountsrepresents a negative value.- See Also:
-
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
Amountindicating 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- AMeasuringValuecontaining 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- AMeasuringValuecontaining 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 anIterableofMeasuringValues.- Returns:
- A
Measurerepresenting 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 anIterableofMeasuringValues.- Returns:
- A
Measurerepresenting 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- TheMeasuringValuewhose validity "length" is to be determined.nextMeasurement- AnOptionalcontaining the directly succeedingMeasuringValue, or an emptyOptionalin case none is at hand.- Returns:
- The validity "length" of the measurement, expressed in terms of a
DurationAmount. - Throws:
IllegalStateException- If theScopeOfValidityof the underlying metric is notScopeOfValidity.CONTINUOUS.- See Also:
-
aggregateData(Iterable, Amount, Amount, Optional)getDataMetric()BaseMetricDescription.getScopeOfValidity()
-