Class SimulationTimePowerCalculator
- java.lang.Object
-
- org.palladiosimulator.metricspec.metricentity.MetricEntity
-
- org.palladiosimulator.measurementframework.listener.MeasurementSource
-
- org.palladiosimulator.simulizar.power.calculators.SimulationTimePowerCalculator
-
- All Implemented Interfaces:
org.palladiosimulator.commons.designpatterns.IAbstractObservable<org.palladiosimulator.measurementframework.listener.IMeasurementSourceListener>,org.palladiosimulator.metricspec.metricentity.IMetricEntity,ISimulationEvaluationScopeListener
public class SimulationTimePowerCalculator extends org.palladiosimulator.measurementframework.listener.MeasurementSource implements ISimulationEvaluationScopeListener
Implementation of aMeasurementSourcewhich uses measurements provided by aSimulationTimeEvaluationScopeto compute the power consumption of aPowerProvidingEntityat simulation-time.
-
-
Constructor Summary
Constructors Constructor Description SimulationTimePowerCalculator(de.fzi.power.interpreter.ConsumptionContext consumptionContext, SimulationTimeEvaluationScope scope, de.fzi.power.infrastructure.PowerProvidingEntity ppe)Initializes a new instance of theSimulationTimePowerCalculatorclass with the given arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnewElementAvailable()An observedSimulationTimeEvaluationScopeinvokes this callback method once a new measurement has been collected.voidpreUnregister()If the observed scope is about to detach an observer (e.g., due to a call ofSimulationTimeEvaluationScope.removeAllListeners()orSimulationTimeEvaluationScope.removeListener(ISimulationEvaluationScopeListener)), this callback method is invoked.-
Methods inherited from class org.palladiosimulator.measurementframework.listener.MeasurementSource
addObserver, getMeasurementSourceListeners, notifyMeasurementSourceListener, removeObserver
-
-
-
-
Constructor Detail
-
SimulationTimePowerCalculator
public SimulationTimePowerCalculator(de.fzi.power.interpreter.ConsumptionContext consumptionContext, SimulationTimeEvaluationScope scope, de.fzi.power.infrastructure.PowerProvidingEntity ppe)Initializes a new instance of theSimulationTimePowerCalculatorclass with the given arguments.- Parameters:
consumptionContext- TheConsumptionContextused for evaluating the power consumption.scope- TheSimulationTimeEvaluationScopethis instance will observe.ppe- ThePowerProvidingEntitywhose consumption is to be calculated.- Throws:
NullPointerException- In case any of the arguments isnull.
-
-
Method Detail
-
newElementAvailable
public void newElementAvailable()
An observedSimulationTimeEvaluationScopeinvokes this callback method once a new measurement has been collected. The new measurement can be retrieved by means of the scope'sAbstractEvaluationScope.next()method or by using the scope'siterator.
This implementation obtains a new power consumption measurement based on the new measurement provided by the evaluation scope and forwards it to all attached listeners.- Specified by:
newElementAvailablein interfaceISimulationEvaluationScopeListener
-
preUnregister
public void preUnregister()
Description copied from interface:ISimulationEvaluationScopeListenerIf the observed scope is about to detach an observer (e.g., due to a call ofSimulationTimeEvaluationScope.removeAllListeners()orSimulationTimeEvaluationScope.removeListener(ISimulationEvaluationScopeListener)), this callback method is invoked.- Specified by:
preUnregisterin interfaceISimulationEvaluationScopeListener
-
-