Search in sources :

Example 1 with ImplementationComponentType

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

the class ComposedProvidingRequiringEntityServices method getVariableUsages.

/**
 * Returns a list containing all {@link VariableUsage}s associated with the
 * {@link AssemblyContext}. This means all usages that are defined on the context itself and
 * those of its encapsulated component which are not overwritten.
 *
 * @param assemblyContext
 *            AssemblyContext
 * @return associated VariableUsages
 * @see #isOverridden(VariableUsage, AssemblyContext)
 */
public Collection<EObject> getVariableUsages(final AssemblyContext assemblyContext) {
    final Collection<EObject> usages = new HashSet<>();
    // only ImplementationComponentTypes can have VariableUsages
    if (!(assemblyContext.getEncapsulatedComponent__AssemblyContext() instanceof ImplementationComponentType))
        return usages;
    final Collection<VariableUsage> componentVariableUsages = ((ImplementationComponentType) assemblyContext.getEncapsulatedComponent__AssemblyContext()).getComponentParameterUsage_ImplementationComponentType();
    // combine the sets
    usages.addAll(assemblyContext.getConfigParameterUsages__AssemblyContext());
    for (final VariableUsage vu : componentVariableUsages) {
        if (!isOverridden(vu, assemblyContext)) {
            usages.add(vu);
        }
    }
    return usages;
}
Also used : ImplementationComponentType(org.palladiosimulator.pcm.repository.ImplementationComponentType) EObject(org.eclipse.emf.ecore.EObject) HashSet(java.util.HashSet) VariableUsage(org.palladiosimulator.pcm.parameter.VariableUsage)

Example 2 with ImplementationComponentType

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

the class ReconnectSourceOfConformsCompleteRelation method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    ImplementationComponentType newSource = (ImplementationComponentType) parameters.get("target");
    ImplementationComponentType oldSource = (ImplementationComponentType) parameters.get("source");
    DNodeContainer otherEnd = (DNodeContainer) parameters.get("otherEnd");
    CompleteComponentType target = (CompleteComponentType) otherEnd.getTarget();
    newSource.getParentCompleteComponentTypes().add(target);
    oldSource.getParentCompleteComponentTypes().remove(target);
}
Also used : ImplementationComponentType(org.palladiosimulator.pcm.repository.ImplementationComponentType) DNodeContainer(org.eclipse.sirius.diagram.DNodeContainer) CompleteComponentType(org.palladiosimulator.pcm.repository.CompleteComponentType)

Aggregations

ImplementationComponentType (org.palladiosimulator.pcm.repository.ImplementationComponentType)2 HashSet (java.util.HashSet)1 EObject (org.eclipse.emf.ecore.EObject)1 DNodeContainer (org.eclipse.sirius.diagram.DNodeContainer)1 VariableUsage (org.palladiosimulator.pcm.parameter.VariableUsage)1 CompleteComponentType (org.palladiosimulator.pcm.repository.CompleteComponentType)1