Package de.fzi.power.interpreter
Class InterpreterUtils
- java.lang.Object
-
- de.fzi.power.interpreter.InterpreterUtils
-
public final class InterpreterUtils extends Object
Utility class that contains common classes, methods or objects used at multiple locations in the power interpreter project.
-
-
Constructor Summary
Constructors Constructor Description InterpreterUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K extends de.uka.ipd.sdq.identifier.Identifier,V>
Map<K,V>createIdentifierMatchingHashMap()
Creates a newHashMap
decorated with an {@link IdentifierMatchingMapDecorator) to allow to use EMF model elements from potentially different sources as key.static <K extends de.uka.ipd.sdq.identifier.Identifier,V>
Map<K,V>createIdentifierMatchingHashMap(int size)
Creates a newHashMap
decorated with an {@link IdentifierMatchingMapDecorator) to allow to use EMF model elements from potentially different sources as key.static Map<org.palladiosimulator.metricspec.MetricDescription,org.palladiosimulator.edp2.datastream.IDataSource>
determineDataSourcesForAvailableMetrics(Set<org.palladiosimulator.edp2.datastream.IDataSource> dataSources, Set<ExtendedMeasureProvider> measureProviders)
static PowerProvidingEntity
getPowerProvidingEntityFromMeasuringPoint(ResourceSet resourceSet, org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint measuringPoint)
Gets thePowerProvidingEntity
the given measuring point points to.
In the current implementation, onlyResourceURIMeasuringPoint
s are processed as this is sufficient for all contemporary use cases.static org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification
getProcessingResourceSpecificationFromMeasuringPoint(org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint measuringPoint)
Gets the processing resource specification that is associated with the given measuring point.static Set<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification>
getProcessingResourceSpecsFromInfrastructureElement(EObject infModelElement)
Gets all the processing resource specifications that are subsumed by the given model element.static boolean
isRequiredMetricSatisfiedBy(org.palladiosimulator.metricspec.MetricDescription required, org.palladiosimulator.metricspec.MetricDescription available)
Helper method that checks whether the required metric (required
) equals the provided one (available
) or is subsumed by it..
-
-
-
Method Detail
-
getProcessingResourceSpecificationFromMeasuringPoint
public static org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification getProcessingResourceSpecificationFromMeasuringPoint(org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint measuringPoint)
Gets the processing resource specification that is associated with the given measuring point.- Parameters:
measuringPoint
- AMeasuringPoint
of arbitrary kind.- Returns:
- The
ProcessingResourceSpecification
that is associated with the given measuring point, ornull
. - Throws:
NullPointerException
- In case the given measuring point isnull
.
-
getProcessingResourceSpecsFromInfrastructureElement
public static Set<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification> getProcessingResourceSpecsFromInfrastructureElement(EObject infModelElement)
Gets all the processing resource specifications that are subsumed by the given model element. That is, a top down search forProcessingResourceSpecification
s is started at the given element, yielding all specifications that are associated with leafs (e.g,PowerConsumingEntity
s of the corresponding infrastructure model.- Parameters:
infModelElement
- AnEObject
representing an element from an infrastructure model.- Returns:
- A set (i.e., a unique collection) containing all collected
ProcessingResourceSpecification
s. If none were found, an empty set is returned. - Throws:
NullPointerException
- ANullPointerException
is thrown, if the given argument isnull
.
-
getPowerProvidingEntityFromMeasuringPoint
public static PowerProvidingEntity getPowerProvidingEntityFromMeasuringPoint(ResourceSet resourceSet, org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint measuringPoint)
Gets thePowerProvidingEntity
the given measuring point points to.
In the current implementation, onlyResourceURIMeasuringPoint
s are processed as this is sufficient for all contemporary use cases. That is, for all other types of measuring pointsnull
is returned.- Parameters:
measuringPoint
- A reference to aMeasuringPoint
model object.- Returns:
- The
PowerProvidingEntity
model element the given measuring point is associated with,null
otherwise. - Throws:
IllegalArgumentException
- AnIllegalArgumentException
is thrown, if the given argument isnull
.
-
isRequiredMetricSatisfiedBy
public static boolean isRequiredMetricSatisfiedBy(org.palladiosimulator.metricspec.MetricDescription required, org.palladiosimulator.metricspec.MetricDescription available)
Helper method that checks whether the required metric (required
) equals the provided one (available
) or is subsumed by it..- Parameters:
required
- the required metricavailable
- the available metric- Returns:
- true, the required metric is satisfied by Measurements of the available metric
-
createIdentifierMatchingHashMap
public static <K extends de.uka.ipd.sdq.identifier.Identifier,V> Map<K,V> createIdentifierMatchingHashMap()
Creates a newHashMap
decorated with an {@link IdentifierMatchingMapDecorator) to allow to use EMF model elements from potentially different sources as key.- Returns:
- a decorated map
-
createIdentifierMatchingHashMap
public static <K extends de.uka.ipd.sdq.identifier.Identifier,V> Map<K,V> createIdentifierMatchingHashMap(int size)
Creates a newHashMap
decorated with an {@link IdentifierMatchingMapDecorator) to allow to use EMF model elements from potentially different sources as key.- Parameters:
size
- the size of the initial map- Returns:
- a decorated map
-
determineDataSourcesForAvailableMetrics
public static Map<org.palladiosimulator.metricspec.MetricDescription,org.palladiosimulator.edp2.datastream.IDataSource> determineDataSourcesForAvailableMetrics(Set<org.palladiosimulator.edp2.datastream.IDataSource> dataSources, Set<ExtendedMeasureProvider> measureProviders)
-
-