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 newHashMapdecorated 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 newHashMapdecorated 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 PowerProvidingEntitygetPowerProvidingEntityFromMeasuringPoint(ResourceSet resourceSet, org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint measuringPoint)Gets thePowerProvidingEntitythe given measuring point points to.
In the current implementation, onlyResourceURIMeasuringPoints are processed as this is sufficient for all contemporary use cases.static org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecificationgetProcessingResourceSpecificationFromMeasuringPoint(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 booleanisRequiredMetricSatisfiedBy(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- AMeasuringPointof arbitrary kind.- Returns:
- The
ProcessingResourceSpecificationthat 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 forProcessingResourceSpecifications is started at the given element, yielding all specifications that are associated with leafs (e.g,PowerConsumingEntitys of the corresponding infrastructure model.- Parameters:
infModelElement- AnEObjectrepresenting an element from an infrastructure model.- Returns:
- A set (i.e., a unique collection) containing all collected
ProcessingResourceSpecifications. If none were found, an empty set is returned. - Throws:
NullPointerException- ANullPointerExceptionis thrown, if the given argument isnull.
-
getPowerProvidingEntityFromMeasuringPoint
public static PowerProvidingEntity getPowerProvidingEntityFromMeasuringPoint(ResourceSet resourceSet, org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint measuringPoint)
Gets thePowerProvidingEntitythe given measuring point points to.
In the current implementation, onlyResourceURIMeasuringPoints are processed as this is sufficient for all contemporary use cases. That is, for all other types of measuring pointsnullis returned.- Parameters:
measuringPoint- A reference to aMeasuringPointmodel object.- Returns:
- The
PowerProvidingEntitymodel element the given measuring point is associated with,nullotherwise. - Throws:
IllegalArgumentException- AnIllegalArgumentExceptionis 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 newHashMapdecorated 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 newHashMapdecorated 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)
-
-