Class 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 Detail

      • InterpreterUtils

        public InterpreterUtils()
    • 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 - A MeasuringPoint of arbitrary kind.
        Returns:
        The ProcessingResourceSpecification that is associated with the given measuring point, or null.
        Throws:
        NullPointerException - In case the given measuring point is null.
      • 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 for ProcessingResourceSpecifications is started at the given element, yielding all specifications that are associated with leafs (e.g, PowerConsumingEntitys of the corresponding infrastructure model.
        Parameters:
        infModelElement - An EObject representing 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 - A NullPointerException is thrown, if the given argument is null.
      • getPowerProvidingEntityFromMeasuringPoint

        public static PowerProvidingEntity getPowerProvidingEntityFromMeasuringPoint​(ResourceSet resourceSet,
                                                                                     org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint measuringPoint)
        Gets the PowerProvidingEntity the given measuring point points to.
        In the current implementation, only ResourceURIMeasuringPoints are processed as this is sufficient for all contemporary use cases. That is, for all other types of measuring points null is returned.
        Parameters:
        measuringPoint - A reference to a MeasuringPoint model object.
        Returns:
        The PowerProvidingEntity model element the given measuring point is associated with, null otherwise.
        Throws:
        IllegalArgumentException - An IllegalArgumentException is thrown, if the given argument is null.
      • 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 metric
        available - 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 new HashMap 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 new HashMap 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)