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;
}
Aggregations