Search in sources :

Example 1 with Role

use of org.palladiosimulator.pcm.repository.Role in project Palladio-Editors-Sirius by PalladioSimulator.

the class ComposedProvidingRequiringEntityServices method getSystemSpecifiedExecutionTimesWithDistinctRoles.

/**
 * filters the given {@link SystemSpecifiedExecutionTime}s to produce a collection with the first occurrences of SystemSpecifiedExecutionTime having distinct {@link Role}s
 * @param ssets
 * @return
 */
public Collection<SystemSpecifiedExecutionTime> getSystemSpecifiedExecutionTimesWithDistinctRoles(org.palladiosimulator.pcm.system.System system) {
    Collection<SystemSpecifiedExecutionTime> result = new ArrayList<SystemSpecifiedExecutionTime>();
    Collection<SystemSpecifiedExecutionTime> ssets = new ArrayList<SystemSpecifiedExecutionTime>();
    EList<QoSAnnotations> annotations = system.getQosAnnotations_System();
    for (QoSAnnotations annotation : annotations) {
        for (SpecifiedQoSAnnotation specifiedAnnotation : annotation.getSpecifiedQoSAnnotations_QoSAnnotations()) {
            if (specifiedAnnotation instanceof SystemSpecifiedExecutionTime) {
                ssets.add((SystemSpecifiedExecutionTime) specifiedAnnotation);
            }
        }
    }
    for (SystemSpecifiedExecutionTime sset : ssets) {
        if (sset.getRole_SpecifiedQoSAnnotation() != null && result.stream().noneMatch(x -> x.getRole_SpecifiedQoSAnnotation().equals(sset.getRole_SpecifiedQoSAnnotation())))
            result.add(sset);
    }
    return result;
}
Also used : SpecifiedQoSAnnotation(org.palladiosimulator.pcm.qosannotations.SpecifiedQoSAnnotation) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) Collection(java.util.Collection) QoSAnnotations(org.palladiosimulator.pcm.qosannotations.QoSAnnotations) Role(org.palladiosimulator.pcm.repository.Role) EObject(org.eclipse.emf.ecore.EObject) EList(org.eclipse.emf.common.util.EList) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) EMFCopyHelper(org.palladiosimulator.commons.emfutils.EMFCopyHelper) List(java.util.List) AbstractNamedReference(de.uka.ipd.sdq.stoex.AbstractNamedReference) ImplementationComponentType(org.palladiosimulator.pcm.repository.ImplementationComponentType) Collections(java.util.Collections) VariableUsage(org.palladiosimulator.pcm.parameter.VariableUsage) SystemSpecifiedExecutionTime(org.palladiosimulator.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime) QoSAnnotations(org.palladiosimulator.pcm.qosannotations.QoSAnnotations) SpecifiedQoSAnnotation(org.palladiosimulator.pcm.qosannotations.SpecifiedQoSAnnotation) ArrayList(java.util.ArrayList) SystemSpecifiedExecutionTime(org.palladiosimulator.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime)

Aggregations

AbstractNamedReference (de.uka.ipd.sdq.stoex.AbstractNamedReference)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 EMFCopyHelper (org.palladiosimulator.commons.emfutils.EMFCopyHelper)1 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)1 VariableUsage (org.palladiosimulator.pcm.parameter.VariableUsage)1 QoSAnnotations (org.palladiosimulator.pcm.qosannotations.QoSAnnotations)1 SpecifiedQoSAnnotation (org.palladiosimulator.pcm.qosannotations.SpecifiedQoSAnnotation)1 SystemSpecifiedExecutionTime (org.palladiosimulator.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime)1 ImplementationComponentType (org.palladiosimulator.pcm.repository.ImplementationComponentType)1 Role (org.palladiosimulator.pcm.repository.Role)1