Search in sources :

Example 6 with BehavioredImplementation

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

the class BottomUpComponentImplTraversal method processBottomUpComponentImpl.

private void processBottomUpComponentImpl(final EList<ComponentImplementation> cil) {
    final EList<ComponentImplementation> leafNodes = new BasicEList<ComponentImplementation>();
    for (Iterator<ComponentImplementation> all = cil.iterator(); all.hasNext(); ) {
        final ComponentImplementation aobj = all.next();
        /**
         * FIXME: verify that we traverse all subcomponents owned and inherited
         */
        final EList<Subcomponent> subs = aobj.getOwnedSubcomponents();
        final EList<SubprogramCall> calls;
        if (aobj instanceof BehavioredImplementation) {
            calls = ((BehavioredImplementation) aobj).getSubprogramCalls();
        } else {
            calls = new BasicEList<SubprogramCall>();
        }
        // all component impls without subcomponent - they are the bottom
        if (subs.isEmpty() && calls.isEmpty()) {
            leafNodes.add(aobj);
        } else {
            // also add it if none of the subs point to a component impl
            boolean foundnone = true;
            for (Iterator<Subcomponent> it = subs.iterator(); foundnone && it.hasNext(); ) {
                final Subcomponent sc = it.next();
                if (sc.getAllClassifier() instanceof ComponentImplementation) {
                    foundnone = false;
                }
            }
            // now do the same for subprogram calls
            for (Iterator<SubprogramCall> iit = calls.iterator(); foundnone && iit.hasNext(); ) {
                SubprogramCall sc = iit.next();
                if (sc.getCalledSubprogram() instanceof ComponentImplementation) {
                    foundnone = false;
                }
            }
            if (foundnone) {
                leafNodes.add(aobj);
            }
        }
    }
    // now process the encl list
    EList<ComponentImplementation> nextLevel = leafNodes;
    while (processingMethod.notCancelled() && !nextLevel.isEmpty()) {
        nextLevel = processUpComponentImpls(nextLevel, cil);
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) BehavioredImplementation(org.osate.aadl2.BehavioredImplementation) BasicEList(org.eclipse.emf.common.util.BasicEList) Subcomponent(org.osate.aadl2.Subcomponent) SubprogramCall(org.osate.aadl2.SubprogramCall)

Example 7 with BehavioredImplementation

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

the class Aadl2Util method findOwnedNamedElement.

/**
 * Find owned named elements. In the case of a thread implementation, subprogram implementation,
 * or abstract implementation also look up subprogram calls.
 * @param owner Classifier in which the lookup is performed
 * @param name name of Element to be found
 * @return NamedElement or null
 */
public static NamedElement findOwnedNamedElement(Classifier owner, String name) {
    for (Element e : owner.getOwnedElements()) {
        if (!(e instanceof NamedElement)) {
            continue;
        }
        NamedElement ne = (NamedElement) e;
        String neName = Aadl2Util.getName(ne);
        if (neName != null && neName.equalsIgnoreCase(name)) {
            return ne;
        }
    }
    if (owner instanceof BehavioredImplementation) {
        BehavioredImplementation bi = (BehavioredImplementation) owner;
        for (SubprogramCall sc : bi.getSubprogramCalls()) {
            if (sc.getName() != null && sc.getName().equalsIgnoreCase(name)) {
                return sc;
            }
        }
    }
    return null;
}
Also used : BehavioredImplementation(org.osate.aadl2.BehavioredImplementation) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) Element(org.osate.aadl2.Element) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) NamedElement(org.osate.aadl2.NamedElement) RefinableElement(org.osate.aadl2.RefinableElement) AadlString(org.osate.aadl2.AadlString) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) NamedElement(org.osate.aadl2.NamedElement) SubprogramCall(org.osate.aadl2.SubprogramCall)

Example 8 with BehavioredImplementation

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

the class PropertiesLinkingService method getLinkedObjects.

/**
 * returns the first linked object
 */
@Override
public List<EObject> getLinkedObjects(EObject context, EReference reference, INode node) throws IllegalNodeException {
    final EClass requiredType = reference.getEReferenceType();
    if (requiredType == null) {
        return Collections.<EObject>emptyList();
    }
    EObject searchResult = null;
    final EClass cl = Aadl2Package.eINSTANCE.getClassifier();
    final EClass sct = Aadl2Package.eINSTANCE.getSubcomponentType();
    final EClass pt = Aadl2Package.eINSTANCE.getPropertyType();
    final String name = getCrossRefNodeAsString(node);
    if (sct.isSuperTypeOf(requiredType) || cl.isSuperTypeOf(requiredType)) {
        // XXX: this code can be replicated in Aadl2LinkingService as it is called often in the core
        // resolve classifier reference
        EObject e = findClassifier(context, reference, name);
        if (e != null) {
            // the result satisfied the expected class
            return Collections.singletonList(e);
        }
        if (!(context instanceof Generalization) && sct.isSuperTypeOf(requiredType)) {
            // need to resolve prototype
            EObject res = AadlUtil.getContainingClassifier(context).findNamedElement(name);
            if (Aadl2Package.eINSTANCE.getDataPrototype() == reference) {
                if (res instanceof DataPrototype) {
                    searchResult = res;
                }
            } else if (res instanceof ComponentPrototype) {
                searchResult = res;
            }
        }
    } else if (Aadl2Package.eINSTANCE.getModelUnit() == requiredType) {
        AadlPackage pack = findAadlPackage(context, name, reference);
        if (pack != null) {
            searchResult = pack;
        } else {
            PropertySet ps = findPropertySet(context, name, reference);
            if (ps != null) {
                searchResult = ps;
            }
        }
    } else if (Aadl2Package.eINSTANCE.getAadlPackage() == requiredType) {
        AadlPackage pack = findAadlPackage(context, name, reference);
        if (pack != null) {
            searchResult = pack;
        }
    } else if (Aadl2Package.eINSTANCE.getPropertySet() == requiredType) {
        PropertySet ps = findPropertySet(context, name, reference);
        if (ps != null) {
            searchResult = ps;
        }
    } else if (Aadl2Package.eINSTANCE.getFeature().isSuperTypeOf(requiredType)) {
        if (context instanceof Feature) {
            // Feature referenced in feature refinement
            Classifier ns = AadlUtil.getContainingClassifier(context);
            // we need to resolve a refinement
            if (ns.getExtended() != null) {
                EObject res = ns.getExtended().findNamedElement(name);
                if (res != null && res instanceof Feature) {
                    searchResult = res;
                }
            } else {
                return Collections.emptyList();
            }
        } else if (context instanceof FlowEnd) {
            FlowEnd flowEnd = (FlowEnd) context;
            searchResult = findElementInContext(flowEnd, flowEnd.getContext(), name, Feature.class);
        }
    } else if (Aadl2Package.eINSTANCE.getSubcomponent().isSuperTypeOf(requiredType)) {
        // if context Subcomponent then find in extension source (refined
        // to)
        // prototype binding as context
        Classifier ns = AadlUtil.getContainingClassifier(context);
        if (context instanceof Subcomponent) {
            // we need to resolve a refinement
            if (ns.getExtended() != null) {
                ns = ns.getExtended();
            } else {
                return Collections.emptyList();
            }
        }
        EObject res = ns.findNamedElement(name);
        if (res instanceof Subcomponent) {
            searchResult = res;
        }
    } else if (Aadl2Package.eINSTANCE.getProperty() == requiredType) {
        // look for property definition in property set
        return findPropertyDefinitionAsList(context, reference, name);
    } else if (Aadl2Package.eINSTANCE.getAbstractNamedValue() == requiredType) {
        // AbstractNamedValue: constant reference, property definition reference, unit literal, enumeration literal
        if (context instanceof NamedValue) {
            List<EObject> res = Collections.EMPTY_LIST;
            if (name.indexOf("::") == -1) {
                // names without qualifier. Must be enum/unit literal
                res = findEnumLiteralAsList(context, reference, name);
                if (res.isEmpty()) {
                    res = findUnitLiteralAsList(context, reference, name);
                }
            }
            if (res.isEmpty()) {
                res = findPropertyConstant(context, reference, name);
            }
            if (res.isEmpty()) {
                res = findPropertyDefinitionAsList(context, reference, name);
            }
            return res;
        }
    } else if (Aadl2Package.eINSTANCE.getBasicProperty() == requiredType) {
        // look for record field definition
        if (context instanceof BasicPropertyAssociation) {
            BasicPropertyAssociation bpa = (BasicPropertyAssociation) context;
            // TODO: Need to check that the type of the record field is
            // correct for the value.
            Element parent = bpa.getOwner();
            while (parent != null && !(parent instanceof BasicPropertyAssociation || parent instanceof PropertyAssociation || parent instanceof Property || parent instanceof PropertyConstant)) {
                parent = parent.getOwner();
            }
            PropertyType propertyType = null;
            if (parent instanceof BasicPropertyAssociation) {
                BasicProperty bp = ((BasicPropertyAssociation) parent).getProperty();
                if (bp != null) {
                    propertyType = bp.getPropertyType();
                }
            } else if (parent instanceof PropertyAssociation) {
                Property pd = ((PropertyAssociation) parent).getProperty();
                if (pd != null) {
                    propertyType = pd.getPropertyType();
                }
            } else if (parent instanceof Property) {
                propertyType = ((Property) parent).getPropertyType();
            } else if (parent instanceof PropertyConstant) {
                propertyType = ((PropertyConstant) parent).getPropertyType();
            }
            propertyType = AadlUtil.getBasePropertyType(propertyType);
            if (propertyType != null && propertyType instanceof RecordType) {
                BasicProperty rf = (BasicProperty) ((RecordType) propertyType).findNamedElement(name);
                if (rf != null) {
                    searchResult = rf;
                }
            }
        }
    } else if (pt.isSuperTypeOf(requiredType)) {
        // look for property type in property set
        return findPropertyType(context, reference, name);
    } else if (Aadl2Package.eINSTANCE.getPropertyConstant() == requiredType) {
        // look for property constant in property set
        return findPropertyConstant(context, reference, name);
    } else if (Aadl2Package.eINSTANCE.getUnitLiteral() == requiredType) {
        // look for unit literal pointed to by baseUnit
        return findUnitLiteralAsList(context, reference, name);
    } else if (Aadl2Package.eINSTANCE.getEnumerationLiteral() == requiredType) {
        // look for enumeration literal
        return findEnumLiteralAsList(context, reference, name);
    } else if (Aadl2Package.eINSTANCE.getMode() == requiredType) {
        // referenced by mode transition, inmodes, ModeBinding
        EObject res = null;
        if (context instanceof ModeBinding) {
            if (reference == Aadl2Package.eINSTANCE.getModeBinding_ParentMode()) {
                res = AadlUtil.getContainingClassifier(context).findNamedElement(name);
            } else if (reference == Aadl2Package.eINSTANCE.getModeBinding_DerivedMode()) {
                Subcomponent subcomponent = AadlUtil.getContainingSubcomponent(context);
                while (subcomponent.getSubcomponentType() == null && subcomponent.getRefined() != null) {
                    subcomponent = subcomponent.getRefined();
                }
                ComponentClassifier subcomponentClassifier = null;
                if (subcomponent.getSubcomponentType() instanceof ComponentClassifier) {
                    subcomponentClassifier = ((ComponentClassifier) subcomponent.getSubcomponentType());
                } else if (subcomponent.getSubcomponentType() instanceof ComponentPrototype) {
                    subcomponentClassifier = findClassifierForComponentPrototype(AadlUtil.getContainingClassifier(context), ((ComponentPrototype) subcomponent.getSubcomponentType()));
                }
                if (subcomponentClassifier != null) {
                    res = subcomponentClassifier.findNamedElement(name);
                }
            }
        } else {
            // check about in modes in a contained property association
            PropertyAssociation pa = AadlUtil.getContainingPropertyAssociation(context);
            if (pa != null && !pa.getAppliesTos().isEmpty()) {
                ContainedNamedElement path = pa.getAppliesTos().get(0);
                EList<ContainmentPathElement> cpelist = path.getContainmentPathElements();
                Subcomponent cpesub = null;
                for (ContainmentPathElement containmentPathElement : cpelist) {
                    if (containmentPathElement.getNamedElement() instanceof Subcomponent) {
                        cpesub = (Subcomponent) containmentPathElement.getNamedElement();
                    } else {
                        break;
                    }
                }
                if (cpesub != null) {
                    if (cpesub.getAllClassifier() != null) {
                        res = cpesub.getAllClassifier().findNamedElement(name);
                    }
                } else {
                    res = AadlUtil.getContainingClassifier(context).findNamedElement(name);
                }
            } else {
                if ((pa != null) && (pa.getOwner() instanceof Subcomponent)) {
                    Subcomponent subco = (Subcomponent) pa.getOwner();
                    if (subco.getAllClassifier() != null) {
                        res = subco.getAllClassifier().findNamedElement(name);
                    }
                } else {
                    res = AadlUtil.getContainingClassifier(context).findNamedElement(name);
                }
            }
        }
        if (res != null && res instanceof Mode) {
            searchResult = res;
        }
    } else if (Aadl2Package.eINSTANCE.getNamedElement() == requiredType) {
        // containment path element
        if (context instanceof ContainmentPathElement) {
            EObject res = null;
            if (((ContainmentPathElement) context).getOwner() instanceof ContainmentPathElement) {
                // find next element in namespace of previous element
                ContainmentPathElement el = (ContainmentPathElement) ((ContainmentPathElement) context).getOwner();
                NamedElement ne = el.getNamedElement();
                if (ne instanceof Subcomponent) {
                    Subcomponent subcomponent = (Subcomponent) ne;
                    while (subcomponent.getSubcomponentType() == null && subcomponent.getRefined() != null) {
                        subcomponent = subcomponent.getRefined();
                    }
                    ComponentClassifier ns = null;
                    if (subcomponent.getSubcomponentType() instanceof ComponentClassifier) {
                        ns = (ComponentClassifier) subcomponent.getSubcomponentType();
                    } else if (subcomponent.getSubcomponentType() instanceof ComponentPrototype) {
                        ns = ResolvePrototypeUtil.resolveComponentPrototype((ComponentPrototype) subcomponent.getSubcomponentType(), el);
                    }
                    if (ns != null) {
                        res = ns.findNamedElement(name);
                        if (res == null && (ne instanceof ThreadSubcomponent || ne instanceof SubprogramSubcomponent || ne instanceof AbstractSubcomponent) && ns instanceof BehavioredImplementation) {
                            res = AadlUtil.findNamedElementInList(((BehavioredImplementation) ns).subprogramCalls(), name);
                        }
                    }
                } else if (ne instanceof FeatureGroup) {
                    FeatureGroup featureGroup = (FeatureGroup) ne;
                    while (featureGroup.getFeatureType() == null && featureGroup.getRefined() instanceof FeatureGroup) {
                        featureGroup = (FeatureGroup) featureGroup.getRefined();
                    }
                    FeatureGroupType ns = null;
                    if (featureGroup.getFeatureType() instanceof FeatureGroupType) {
                        ns = (FeatureGroupType) featureGroup.getFeatureType();
                    } else if (featureGroup.getFeatureType() instanceof FeatureGroupPrototype) {
                        ns = ResolvePrototypeUtil.resolveFeatureGroupPrototype((FeatureGroupPrototype) featureGroup.getFeatureType(), el);
                    }
                    if (ns != null) {
                        res = ns.findNamedElement(name);
                    }
                }
            } else {
                // the first containment path element
                Classifier ns = null;
                PropertyAssociation containingPropertyAssociation = AadlUtil.getContainingPropertyAssociation(context);
                if (containingPropertyAssociation != null) {
                    // need to make sure we look in the correct name space
                    if (containingPropertyAssociation.getOwner() instanceof Subcomponent) {
                        Subcomponent subcomponent = (Subcomponent) containingPropertyAssociation.getOwner();
                        while (subcomponent.getSubcomponentType() == null && subcomponent.getRefined() != null) {
                            subcomponent = subcomponent.getRefined();
                        }
                        if (subcomponent.getSubcomponentType() instanceof ComponentClassifier) {
                            ns = (ComponentClassifier) subcomponent.getSubcomponentType();
                        } else if (subcomponent.getSubcomponentType() instanceof ComponentPrototype) {
                            ns = ResolvePrototypeUtil.resolveComponentPrototype((ComponentPrototype) subcomponent.getSubcomponentType(), AadlUtil.getContainingClassifier(context));
                        }
                    } else if (containingPropertyAssociation.getOwner() instanceof FeatureGroup) {
                        FeatureGroup fg = (FeatureGroup) containingPropertyAssociation.getOwner();
                        while (fg.getFeatureType() == null && fg.getRefined() instanceof FeatureGroup) {
                            fg = (FeatureGroup) fg.getRefined();
                        }
                        if (fg.getFeatureType() instanceof FeatureGroupType) {
                            ns = (FeatureGroupType) fg.getFeatureType();
                        } else if (fg.getFeatureType() instanceof FeatureGroupPrototype) {
                            ns = ResolvePrototypeUtil.resolveFeatureGroupPrototype((FeatureGroupPrototype) fg.getFeatureType(), AadlUtil.getContainingClassifier(context));
                        }
                    } else {
                        ns = containingPropertyAssociation.getContainingClassifier();
                    }
                }
                if (ns != null) {
                    res = ns.findNamedElement(name);
                }
            }
            if (res != null && res instanceof NamedElement) {
                searchResult = res;
            }
        }
    } else {
        List<EObject> superes = super.getLinkedObjects(context, reference, node);
        return superes;
    }
    if (searchResult != null) {
        return Collections.singletonList(searchResult);
    }
    return Collections.<EObject>emptyList();
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) FeatureGroup(org.osate.aadl2.FeatureGroup) PropertyAssociation(org.osate.aadl2.PropertyAssociation) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) Element(org.osate.aadl2.Element) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) NamedElement(org.osate.aadl2.NamedElement) AbstractSubcomponent(org.osate.aadl2.AbstractSubcomponent) FeatureGroupType(org.osate.aadl2.FeatureGroupType) NamedValue(org.osate.aadl2.NamedValue) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) PropertyType(org.osate.aadl2.PropertyType) Generalization(org.osate.aadl2.Generalization) Feature(org.osate.aadl2.Feature) ComponentPrototype(org.osate.aadl2.ComponentPrototype) FeatureGroupPrototype(org.osate.aadl2.FeatureGroupPrototype) BasicProperty(org.osate.aadl2.BasicProperty) EClass(org.eclipse.emf.ecore.EClass) RecordType(org.osate.aadl2.RecordType) EObject(org.eclipse.emf.ecore.EObject) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) ThreadSubcomponent(org.osate.aadl2.ThreadSubcomponent) SubprogramGroupSubcomponent(org.osate.aadl2.SubprogramGroupSubcomponent) AbstractSubcomponent(org.osate.aadl2.AbstractSubcomponent) Subcomponent(org.osate.aadl2.Subcomponent) List(java.util.List) EList(org.eclipse.emf.common.util.EList) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) AadlPackage(org.osate.aadl2.AadlPackage) BehavioredImplementation(org.osate.aadl2.BehavioredImplementation) Mode(org.osate.aadl2.Mode) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) DataPrototype(org.osate.aadl2.DataPrototype) PropertyConstant(org.osate.aadl2.PropertyConstant) ThreadSubcomponent(org.osate.aadl2.ThreadSubcomponent) EList(org.eclipse.emf.common.util.EList) PropertySet(org.osate.aadl2.PropertySet) ModeBinding(org.osate.aadl2.ModeBinding) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) NamedElement(org.osate.aadl2.NamedElement) FlowEnd(org.osate.aadl2.FlowEnd)

Example 9 with BehavioredImplementation

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

the class AgeAadlUtil method getAllSubprogramCallSequences.

public static List<SubprogramCallSequence> getAllSubprogramCallSequences(final BehavioredImplementation bi) {
    EList<SubprogramCallSequence> returnList = new BasicEList<SubprogramCallSequence>();
    ComponentImplementation tmpCi = bi;
    while (tmpCi != null) {
        if (tmpCi instanceof BehavioredImplementation) {
            final BehavioredImplementation tmpBi = (BehavioredImplementation) tmpCi;
            returnList.addAll(tmpBi.getOwnedSubprogramCallSequences());
        }
        tmpCi = tmpCi.getExtended();
    }
    return returnList;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) BehavioredImplementation(org.osate.aadl2.BehavioredImplementation) SubprogramCallSequence(org.osate.aadl2.SubprogramCallSequence) BasicEList(org.eclipse.emf.common.util.BasicEList)

Example 10 with BehavioredImplementation

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

the class AadlBusinessObjectProvider method getChildren.

private static Stream<?> getChildren(final Classifier classifier, final boolean includeGeneralizations, final ExtensionRegistryService extRegistryService) {
    Stream<?> children = Stream.empty();
    // Shapes
    children = Stream.concat(children, AadlFeatureUtil.getAllDeclaredFeatures(classifier).stream());
    if (classifier instanceof ComponentImplementation) {
        final ComponentImplementation ci = (ComponentImplementation) classifier;
        children = Stream.concat(children, AgeAadlUtil.getAllInternalFeatures(ci).stream());
        children = Stream.concat(children, AgeAadlUtil.getAllProcessorFeatures(ci).stream());
        children = Stream.concat(children, ci.getAllSubcomponents().stream());
    }
    if (classifier instanceof BehavioredImplementation) {
        children = Stream.concat(children, AgeAadlUtil.getAllSubprogramCallSequences((BehavioredImplementation) classifier).stream());
    }
    if (classifier instanceof ComponentClassifier) {
        children = Stream.concat(children, ((ComponentClassifier) classifier).getAllModes().stream());
    }
    // Annex Subclauses
    final Stream.Builder<AnnexSubclause> subclauseStreamBuilder = Stream.builder();
    for (final AnnexSubclause annexSubclause : getAllDefaultAnnexSubclauses(classifier)) {
        final AnnexSubclause parsedAnnexSubclause = getParsedAnnexSubclause(annexSubclause);
        final boolean specializedHandling = parsedAnnexSubclause != null && extRegistryService.getApplicableBusinessObjectHandler(parsedAnnexSubclause) != null;
        // Only contribute the annex object if a BOH for the annex does not exist. The annex plugin is expected to contribute the object as needed.
        if (!specializedHandling) {
            subclauseStreamBuilder.add(annexSubclause);
        }
    }
    children = Stream.concat(children, subclauseStreamBuilder.build());
    // Connections
    if (classifier instanceof ComponentClassifier) {
        children = Stream.concat(children, ((ComponentClassifier) classifier).getAllModeTransitions().stream());
    }
    if (classifier instanceof ComponentImplementation) {
        children = Stream.concat(children, ((ComponentImplementation) classifier).getAllConnections().stream());
    }
    final ComponentType componentType;
    if (classifier instanceof ComponentType) {
        componentType = (ComponentType) classifier;
    } else if (classifier instanceof ComponentImplementation) {
        componentType = ((ComponentImplementation) classifier).getType();
    } else {
        componentType = null;
    }
    if (componentType != null) {
        children = Stream.concat(children, componentType.getAllFlowSpecifications().stream());
    }
    // Add generalizations
    if (includeGeneralizations) {
        if (classifier instanceof ComponentType) {
            final ComponentType ct = ((ComponentType) classifier);
            final TypeExtension te = ct.getOwnedExtension();
            if (te != null) {
                children = Stream.concat(children, Stream.of(te));
            }
        } else if (classifier instanceof ComponentImplementation) {
            final ComponentImplementation componentImplementation = ((ComponentImplementation) classifier);
            // Implementation Extension
            final ImplementationExtension ie = componentImplementation.getOwnedExtension();
            if (ie != null) {
                children = Stream.concat(children, Stream.of(ie));
            } else {
                // Realization
                final Realization realization = componentImplementation.getOwnedRealization();
                if (realization != null) {
                    children = Stream.concat(children, Stream.of(realization));
                }
            }
        } else if (classifier instanceof FeatureGroupType) {
            final FeatureGroupType featureGroupType = ((FeatureGroupType) classifier);
            final GroupExtension ge = featureGroupType.getOwnedExtension();
            if (ge != null) {
                children = Stream.concat(children, Stream.of(ge));
            }
        }
    }
    return children;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentClassifier(org.osate.aadl2.ComponentClassifier) ComponentType(org.osate.aadl2.ComponentType) BehavioredImplementation(org.osate.aadl2.BehavioredImplementation) FeatureGroupType(org.osate.aadl2.FeatureGroupType) TypeExtension(org.osate.aadl2.TypeExtension) ImplementationExtension(org.osate.aadl2.ImplementationExtension) Realization(org.osate.aadl2.Realization) GroupExtension(org.osate.aadl2.GroupExtension) Stream(java.util.stream.Stream) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Aggregations

BehavioredImplementation (org.osate.aadl2.BehavioredImplementation)9 ComponentImplementation (org.osate.aadl2.ComponentImplementation)5 SubprogramCall (org.osate.aadl2.SubprogramCall)4 BasicEList (org.eclipse.emf.common.util.BasicEList)3 NamedElement (org.osate.aadl2.NamedElement)3 Subcomponent (org.osate.aadl2.Subcomponent)3 Classifier (org.osate.aadl2.Classifier)2 ComponentClassifier (org.osate.aadl2.ComponentClassifier)2 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)2 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)2 Element (org.osate.aadl2.Element)2 FeatureGroupType (org.osate.aadl2.FeatureGroupType)2 SubprogramCallSequence (org.osate.aadl2.SubprogramCallSequence)2 List (java.util.List)1 Optional (java.util.Optional)1 Stream (java.util.stream.Stream)1 EList (org.eclipse.emf.common.util.EList)1 EClass (org.eclipse.emf.ecore.EClass)1 EObject (org.eclipse.emf.ecore.EObject)1 EOperation (org.eclipse.emf.ecore.EOperation)1