Package de.fzi.power.interpreter
Class PowerConsumptionSwitch
- java.lang.Object
-
- org.eclipse.emf.ecore.util.Switch<T>
-
- de.fzi.power.infrastructure.util.InfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
-
- de.fzi.power.interpreter.PowerConsumptionSwitch
-
public final class PowerConsumptionSwitch extends InfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
This class is used as the basis of interpreters that evaluate the power consumption ofInfrastructure
models. It is interpreted for the current point in time associated with theConsumptionContext
that is set forthis
.
-
-
Field Summary
-
Fields inherited from class de.fzi.power.infrastructure.util.InfrastructureSwitch
modelPackage
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
caseMountedPowerDistributionUnit(MountedPowerDistributionUnit mountedPdu)
Evaluates the power consumption of a mounted PDU and the elements nested below it.org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
casePowerConsumingEntity(PowerConsumingEntity powerConsumingEntity)
Evaluates the power consumption of a PowerConsumingEntity.org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
casePowerConsumingProvidingEntity(PowerConsumingProvidingEntity providingConsumingEntity)
Evaluates the power consumption of all elements connected to a PowerConsumingProvidingEntity.org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
casePowerConsumingResourceSet(PowerConsumingResourceSet resource)
Evaluate the power consumption of a PowerConsumingResource.org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
casePowerDistributionUnit(PowerDistributionUnit pdu)
Evaluate the power consumption of all elements connected topdu
org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
casePowerInfrastructureRepository(PowerInfrastructureRepository piModel)
Evaluate the power consumption for a fullPowerInfrastructureRepository
.org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
casePowerProvidingEntity(PowerProvidingEntity ppEntity)
Evaluates the power consumption of all elements connected to a PowerProvidingEntity.org.jscience.physics.amount.Amount<javax.measure.quantity.Power>
caseStatefulPowerConsumingResourceSet(StatefulPowerConsumingResourceSet resource)
Returns the result of interpreting the object as an instance of 'Stateful Power Consuming Resource Set'.static PowerConsumptionSwitch
createPowerConsumptionSwitch(ConsumptionContext ctx)
Creates a power consumption switch.void
setConsumptionContext(ConsumptionContext ctx)
Change the context for which the power consumption is evaluated.-
Methods inherited from class de.fzi.power.infrastructure.util.InfrastructureSwitch
caseAbstractPowerConsumingResource, caseEntity, caseIdentifier, caseNamedElement, defaultCase, doSwitch, isSwitchFor
-
-
-
-
Method Detail
-
createPowerConsumptionSwitch
public static PowerConsumptionSwitch createPowerConsumptionSwitch(ConsumptionContext ctx)
Creates a power consumption switch. It is used to evaluate the power consumption for a given evaluation scope. Changes to the properties ofctx
are considered in the evaluation of the power consumption.- Parameters:
ctx
- AConsumptionContext
instance denoting the initial evaluation context.- Returns:
- The PowerConsumptionSwitch to be used for the evaluation.
- Throws:
IllegalArgumentException
- In case the given consumption context wasnull
.
-
setConsumptionContext
public void setConsumptionContext(ConsumptionContext ctx)
Change the context for which the power consumption is evaluated.- Parameters:
ctx
- TheConsumptionContext
to set.- Throws:
IllegalArgumentException
- In casectx == null
.
-
casePowerDistributionUnit
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> casePowerDistributionUnit(PowerDistributionUnit pdu)
Evaluate the power consumption of all elements connected topdu
- Overrides:
casePowerDistributionUnit
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
pdu
- The power distribution unit for which the power consumption evaluation is performed- Returns:
- The power consumption evaluation result.
- See Also:
doSwitch(EObject)
-
casePowerConsumingProvidingEntity
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> casePowerConsumingProvidingEntity(PowerConsumingProvidingEntity providingConsumingEntity)
Evaluates the power consumption of all elements connected to a PowerConsumingProvidingEntity.- Overrides:
casePowerConsumingProvidingEntity
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
providingConsumingEntity
- The entity for which the consumption is evaluated.- Returns:
- The power consumption evaluation result.
- See Also:
doSwitch(EObject)
-
casePowerProvidingEntity
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> casePowerProvidingEntity(PowerProvidingEntity ppEntity)
Evaluates the power consumption of all elements connected to a PowerProvidingEntity. Uses {@see PowerConsumptionSwitch#doSwitch(int, org.eclipse.emf.ecore.EObject)} to evaluate the consumption using the case of this switch that is the actual type ofppEntity
.- Overrides:
casePowerProvidingEntity
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
ppEntity
- The entity for which the consumption of connected elements is evaluated.- Returns:
- The power consumption evaluation result.
- See Also:
doSwitch(EObject)
-
casePowerConsumingEntity
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> casePowerConsumingEntity(PowerConsumingEntity powerConsumingEntity)
Evaluates the power consumption of a PowerConsumingEntity. Uses {@see PowerConsumptionSwitch#doSwitch(int, org.eclipse.emf.ecore.EObject)} to evaluate the consumption using the case of this switch that is the actual type ofobject
.- Overrides:
casePowerConsumingEntity
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
powerConsumingEntity
- The entity for which the power consumption is evaluated.- Returns:
- the result of interpreting the object as an instance of 'Power Consuming Entity'.
- See Also:
doSwitch(EObject)
-
caseMountedPowerDistributionUnit
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> caseMountedPowerDistributionUnit(MountedPowerDistributionUnit mountedPdu)
Evaluates the power consumption of a mounted PDU and the elements nested below it.- Overrides:
caseMountedPowerDistributionUnit
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
mountedPdu
- The power distribution unit for which the power consumption is evaluated.- Returns:
- The evaluated power consumption.
- See Also:
doSwitch(EObject)
-
casePowerConsumingResourceSet
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> casePowerConsumingResourceSet(PowerConsumingResourceSet resource)
Evaluate the power consumption of a PowerConsumingResource. The evaluation is performed by looking up the power consumption specification/power model set for the resource.- Overrides:
casePowerConsumingResourceSet
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
resource
- The power consuming resource.- Returns:
- The amount of power consumed by the resource.
- See Also:
doSwitch(EObject)
-
caseStatefulPowerConsumingResourceSet
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> caseStatefulPowerConsumingResourceSet(StatefulPowerConsumingResourceSet resource)
Description copied from class:InfrastructureSwitch
Returns the result of interpreting the object as an instance of 'Stateful Power Consuming Resource Set'. This implementation returns null; returning a non-null result will terminate the switch.- Overrides:
caseStatefulPowerConsumingResourceSet
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
resource
- the target of the switch.- Returns:
- the result of interpreting the object as an instance of 'Stateful Power Consuming Resource Set'.
- See Also:
doSwitch(EObject)
-
casePowerInfrastructureRepository
public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> casePowerInfrastructureRepository(PowerInfrastructureRepository piModel)
Evaluate the power consumption for a fullPowerInfrastructureRepository
.- Overrides:
casePowerInfrastructureRepository
in classInfrastructureSwitch<org.jscience.physics.amount.Amount<javax.measure.quantity.Power>>
- Parameters:
piModel
- ThePowerInfrastructureRepository
for which the power consumption is evaluated.- Returns:
- The amount of power consumed throughout the whole repository model.
- See Also:
doSwitch(EObject)
-
-