Search in sources :

Example 1 with SystemSpecifiedExecutionTime

use of org.palladiosimulator.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime 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)

Example 2 with SystemSpecifiedExecutionTime

use of org.palladiosimulator.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddSystemSpecifiedExecutionTime method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    SystemSpecifiedExecutionTime sset = (SystemSpecifiedExecutionTime) parameters.get("instance");
    Signature sig = getSignature(sset);
    for (SpecifiedQoSAnnotation s : sset.getQosAnnotations_SpecifiedQoSAnnotation().getSpecifiedQoSAnnotations_QoSAnnotations()) {
        if ((s instanceof SystemSpecifiedExecutionTime) && (s.getSignature_SpecifiedQoSAnnation() != null) && (s.getRole_SpecifiedQoSAnnotation().equals(sset.getRole_SpecifiedQoSAnnotation())) && (s.getSignature_SpecifiedQoSAnnation().equals(sig)))
            return;
    }
    sset.setSignature_SpecifiedQoSAnnation(sig);
}
Also used : Signature(org.palladiosimulator.pcm.repository.Signature) SpecifiedQoSAnnotation(org.palladiosimulator.pcm.qosannotations.SpecifiedQoSAnnotation) SystemSpecifiedExecutionTime(org.palladiosimulator.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime)

Aggregations

SpecifiedQoSAnnotation (org.palladiosimulator.pcm.qosannotations.SpecifiedQoSAnnotation)2 SystemSpecifiedExecutionTime (org.palladiosimulator.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime)2 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 ImplementationComponentType (org.palladiosimulator.pcm.repository.ImplementationComponentType)1 Role (org.palladiosimulator.pcm.repository.Role)1 Signature (org.palladiosimulator.pcm.repository.Signature)1