Search in sources :

Example 1 with SubSystem

use of org.palladiosimulator.pcm.subsystem.SubSystem in project Palladio-Editors-Sirius by PalladioSimulator.

the class AllocationServices method getNestedUndeployedAssemblyContexts.

public Collection<AssemblyContext> getNestedUndeployedAssemblyContexts(AssemblyContext parentAssemblyContext, Allocation allocation) {
    if (!(parentAssemblyContext.getEncapsulatedComponent__AssemblyContext() instanceof SubSystem))
        return null;
    SubSystem encapsulatedSubsystem = (SubSystem) parentAssemblyContext.getEncapsulatedComponent__AssemblyContext();
    Collection<AssemblyContext> result = new ArrayList<AssemblyContext>();
    for (AssemblyContext nestedAssemblyContext : encapsulatedSubsystem.getAssemblyContexts__ComposedStructure()) {
        if (!isAllocated(nestedAssemblyContext, allocation))
            result.add(nestedAssemblyContext);
    }
    return result;
}
Also used : SubSystem(org.palladiosimulator.pcm.subsystem.SubSystem) ArrayList(java.util.ArrayList) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Example 2 with SubSystem

use of org.palladiosimulator.pcm.subsystem.SubSystem in project Palladio-Editors-Sirius by PalladioSimulator.

the class AllocationServices method getUndeployedSubAssemblyContexts.

public Collection<AssemblyContext> getUndeployedSubAssemblyContexts(AssemblyContext assemblyContext, Allocation allocation, boolean recursively) {
    if (!(assemblyContext.getEncapsulatedComponent__AssemblyContext() instanceof SubSystem))
        throw new IllegalArgumentException("The encapsulated component of " + assemblyContext + " must be a SubSystem");
    SubSystem subSystem = (SubSystem) assemblyContext.getEncapsulatedComponent__AssemblyContext();
    Collection<AssemblyContext> result = new ArrayList<AssemblyContext>();
    for (AssemblyContext a : subSystem.getAssemblyContexts__ComposedStructure()) {
        if (!isAllocated(a, allocation)) {
            result.add(a);
            if (recursively && a.getEncapsulatedComponent__AssemblyContext() instanceof SubSystem) {
                result.addAll(getUndeployedSubAssemblyContexts(a, allocation, true));
            }
        }
    }
    return result;
}
Also used : SubSystem(org.palladiosimulator.pcm.subsystem.SubSystem) ArrayList(java.util.ArrayList) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Example 3 with SubSystem

use of org.palladiosimulator.pcm.subsystem.SubSystem in project Palladio-Editors-Sirius by PalladioSimulator.

the class AllocationServices method getUndeployedAssemblyContexts.

public Collection<AssemblyContext> getUndeployedAssemblyContexts(Allocation allocation) {
    Collection<AssemblyContext> assemblyContexts = allocation.getSystem_Allocation().getAssemblyContexts__ComposedStructure();
    Collection<AssemblyContext> result = new ArrayList<AssemblyContext>();
    for (AssemblyContext assemblyContext : assemblyContexts) {
        if (assemblyContext.getEncapsulatedComponent__AssemblyContext() instanceof SubSystem) {
            if (hasDeployedComponents((SubSystem) assemblyContext.getEncapsulatedComponent__AssemblyContext(), allocation)) {
                result.add(assemblyContext);
                result.addAll(getUndeployedSubAssemblyContexts(assemblyContext, allocation, true));
            }
        }
    }
    return result;
}
Also used : SubSystem(org.palladiosimulator.pcm.subsystem.SubSystem) ArrayList(java.util.ArrayList) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Aggregations

ArrayList (java.util.ArrayList)3 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)3 SubSystem (org.palladiosimulator.pcm.subsystem.SubSystem)3