Search in sources :

Example 36 with ComponentCategory

use of org.osate.aadl2.ComponentCategory in project osate2 by osate.

the class InstanceModelUtil method getBoundProcesses.

/**
 * get all processes bound to the given component
 * @param procorVP
 * @return
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static EList<ComponentInstance> getBoundProcesses(final ComponentInstance procorVP) {
    SystemInstance root = procorVP.getSystemInstance();
    EList boundComponents = new ForAllElement() {

        @Override
        protected boolean suchThat(Element obj) {
            ComponentInstance ci = (ComponentInstance) obj;
            ComponentCategory cat = ci.getCategory();
            return ((cat == ComponentCategory.PROCESS) && InstanceModelUtil.isBoundToProcessor((ComponentInstance) obj, procorVP));
        }
    }.processPreOrderComponentInstance(root);
    return boundComponents;
}
Also used : BasicEList(org.eclipse.emf.common.util.BasicEList) EList(org.eclipse.emf.common.util.EList) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) SystemInstance(org.osate.aadl2.instance.SystemInstance) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) NamedElement(org.osate.aadl2.NamedElement) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ComponentCategory(org.osate.aadl2.ComponentCategory)

Example 37 with ComponentCategory

use of org.osate.aadl2.ComponentCategory in project osate2 by osate.

the class InstanceModelUtil method getAllBoundSWComponents.

/**
 * get all SW components bound to the given processor or VP component
 * This includes the children of a component that is bound as the binding property is inherited.
 * @param procorVP
 * @return
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static EList<ComponentInstance> getAllBoundSWComponents(final ComponentInstance procorVP) {
    SystemInstance root = procorVP.getSystemInstance();
    EList boundComponents = new ForAllElement() {

        @Override
        protected boolean suchThat(Element obj) {
            ComponentInstance ci = (ComponentInstance) obj;
            ComponentCategory cat = ci.getCategory();
            return ((cat == ComponentCategory.THREAD || cat == ComponentCategory.THREAD_GROUP || cat == ComponentCategory.PROCESS || cat == ComponentCategory.SYSTEM) && InstanceModelUtil.isBoundToProcessor((ComponentInstance) obj, procorVP));
        }
    }.processPreOrderComponentInstance(root);
    return boundComponents;
}
Also used : BasicEList(org.eclipse.emf.common.util.BasicEList) EList(org.eclipse.emf.common.util.EList) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) SystemInstance(org.osate.aadl2.instance.SystemInstance) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) NamedElement(org.osate.aadl2.NamedElement) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ComponentCategory(org.osate.aadl2.ComponentCategory)

Aggregations

ComponentCategory (org.osate.aadl2.ComponentCategory)30 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)22 Element (org.osate.aadl2.Element)9 ForAllElement (org.osate.aadl2.modelsupport.modeltraversal.ForAllElement)8 SystemInstance (org.osate.aadl2.instance.SystemInstance)7 BasicEList (org.eclipse.emf.common.util.BasicEList)6 NamedElement (org.osate.aadl2.NamedElement)6 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)6 EList (org.eclipse.emf.common.util.EList)5 ComponentClassifier (org.osate.aadl2.ComponentClassifier)5 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)5 EObject (org.eclipse.emf.ecore.EObject)4 Aadl2Package (org.osate.aadl2.Aadl2Package)4 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 EcorePackage (org.eclipse.emf.ecore.EcorePackage)2 Classifier (org.osate.aadl2.Classifier)2 ComponentPrototype (org.osate.aadl2.ComponentPrototype)2