Search in sources :

Example 26 with ComponentType

use of org.geotoolkit.sml.xml.v100.ComponentType in project osate2 by osate.

the class SetExtendedClassifierPropertySection method getExtensibleClassifierDescriptions.

/**
 * Return a list of EObjectDescriptions for classifiers that could be extended.
 * The result will includes null since extending no classifier is a valid option.
 * @return
 */
private List<IEObjectDescription> getExtensibleClassifierDescriptions(final Classifier classifier) {
    final List<IEObjectDescription> objectDescriptions = new ArrayList<IEObjectDescription>();
    objectDescriptions.add(null);
    final String name = classifier.getQualifiedName();
    // Populate the list with valid classifier descriptions
    if (name != null) {
        for (final IEObjectDescription desc : AadlModelAccessUtil.getAllEObjectsByType(classifier.eResource(), classifier.eClass())) {
            if (!name.equalsIgnoreCase(desc.getName().toString("::"))) {
                objectDescriptions.add(desc);
            }
        }
        // Ensure that abstract classifiers are in the list
        if (classifier instanceof ComponentType) {
            if (classifier.eClass() != Aadl2Package.eINSTANCE.getAbstractType()) {
                for (final IEObjectDescription desc : AadlModelAccessUtil.getAllEObjectsByType(classifier.eResource(), Aadl2Package.eINSTANCE.getAbstractType())) {
                    if (!name.equalsIgnoreCase(desc.getName().toString("::"))) {
                        objectDescriptions.add(desc);
                    }
                }
            }
        } else if (classifier instanceof ComponentImplementation) {
            if (classifier.eClass() != Aadl2Package.eINSTANCE.getAbstractImplementation()) {
                for (final IEObjectDescription desc : AadlModelAccessUtil.getAllEObjectsByType(classifier.eResource(), Aadl2Package.eINSTANCE.getAbstractImplementation())) {
                    if (!name.equalsIgnoreCase(desc.getName().toString("::"))) {
                        objectDescriptions.add(desc);
                    }
                }
            }
        }
    }
    return objectDescriptions;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) ArrayList(java.util.ArrayList) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Example 27 with ComponentType

use of org.geotoolkit.sml.xml.v100.ComponentType in project osate2 by osate.

the class SubcomponentImpl method getAllFeatures.

/**
 * Get list of all features of a subcomponent, including ancestor features
 * These are the features of its classifier
 * In case of refined features the refined feature is returned in the list.
 * @return List of features
 */
public EList<Feature> getAllFeatures() {
    ComponentImplementation ci = getComponentImplementation();
    if (ci != null) {
        return ci.getAllFeatures();
    }
    ComponentType ct = getComponentType();
    if (ct != null) {
        return ct.getAllFeatures();
    }
    return ECollections.emptyEList();
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType)

Example 28 with ComponentType

use of org.geotoolkit.sml.xml.v100.ComponentType in project osate2 by osate.

the class AadlBusinessObjectProvider method getAllDefaultAnnexSubclauses.

/**
 * Returns all the default annex subclauses owned by a classifier or any extended or implemented classifiers.
 * @param topClassifier
 * @return
 */
private static EList<AnnexSubclause> getAllDefaultAnnexSubclauses(final Classifier topClassifier) {
    final EList<AnnexSubclause> result = new BasicEList<AnnexSubclause>();
    if (topClassifier == null) {
        return result;
    }
    final EList<Classifier> classifiers = topClassifier.getSelfPlusAllExtended();
    if (topClassifier instanceof ComponentImplementation) {
        ComponentType ct = ((ComponentImplementation) topClassifier).getType();
        if (ct != null) {
            // May be null in the case of an invalid model.
            final EList<Classifier> tclassifiers = ct.getSelfPlusAllExtended();
            classifiers.addAll(tclassifiers);
        }
    }
    for (Classifier classifier : classifiers) {
        result.addAll(classifier.getOwnedAnnexSubclauses());
    }
    return result;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier) SubprogramClassifier(org.osate.aadl2.SubprogramClassifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Example 29 with ComponentType

use of org.geotoolkit.sml.xml.v100.ComponentType in project osate2 by osate.

the class AssuranceCaseImpl method setSystem.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSystem(ComponentType newSystem) {
    ComponentType oldSystem = system;
    system = newSystem;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, AlisaPackage.ASSURANCE_CASE__SYSTEM, oldSystem, system));
}
Also used : ComponentType(org.osate.aadl2.ComponentType) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 30 with ComponentType

use of org.geotoolkit.sml.xml.v100.ComponentType in project osate2 by osate.

the class AadlBaUtils method prototypeBindingResolverForDataComponentReference.

/**
 * Returns the DataClassifier object associated to prototype binding in a DataComponentReference
 *
 * @param r the DataComponentRefenrence object from which the binding will be resolved
 * @param dp the DataPrototpye object that enables to identify the targeted prototype binding
 * @param parentContainer the object that contains the element binded to the
 * given DataComponentRefenrence
 * @return the DataClassifier object
 */
private static DataClassifier prototypeBindingResolverForDataComponentReference(DataComponentReference r, DataPrototype dp, NamedElement parentContainer) {
    if (r.getData().size() > 1) {
        DataHolder h = r.getData().get(r.getData().size() - 2);
        NamedElement parent = h.getElement();
        if (parent instanceof Classifier) {
            Classifier c = (Classifier) parent;
            return getDataClassifier(c.getOwnedPrototypeBindings(), dp);
        }
        if (parent instanceof Subcomponent) {
            Subcomponent s = (Subcomponent) parent;
            return getDataClassifier(s.getOwnedPrototypeBindings(), dp);
        } else if (parent instanceof DataAccess) {
            DataAccess da = (DataAccess) parent;
            DataSubcomponentType parentDst = da.getDataFeatureClassifier();
            Classifier c = (Classifier) parentDst;
            DataClassifier matchedPrototype = getDataClassifier(c.getOwnedPrototypeBindings(), dp);
            if (matchedPrototype == null) {
                if (parentContainer instanceof ComponentType) {
                    ComponentType ct = (ComponentType) parentContainer;
                    for (Feature f : ct.getOwnedFeatures()) {
                        if (f instanceof DataAccess && f.getName().equals(parent.getName())) {
                            DataAccess containerDa = (DataAccess) f;
                            DataSubcomponentType containerDst = containerDa.getDataFeatureClassifier();
                            Classifier c2 = (Classifier) containerDst;
                            return getDataClassifier(c2.getOwnedPrototypeBindings(), dp);
                        }
                    }
                }
            }
        } else if (parent instanceof DataPort) {
            DataPort dataport = (DataPort) parent;
            DataSubcomponentType parentDst = dataport.getDataFeatureClassifier();
            Classifier c = (Classifier) parentDst;
            DataClassifier matchedPrototype = getDataClassifier(c.getOwnedPrototypeBindings(), dp);
            if (matchedPrototype == null) {
                if (parentContainer instanceof ComponentType) {
                    ComponentType ct = (ComponentType) parentContainer;
                    for (Feature f : ct.getOwnedFeatures()) {
                        if (f instanceof DataPort && f.getName().equals(parent.getName())) {
                            DataPort containerDp = (DataPort) f;
                            DataSubcomponentType containerDst = containerDp.getDataFeatureClassifier();
                            Classifier c2 = (Classifier) containerDst;
                            return getDataClassifier(c2.getOwnedPrototypeBindings(), dp);
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : DataPort(org.osate.aadl2.DataPort) EventDataPort(org.osate.aadl2.EventDataPort) DataSubcomponentType(org.osate.aadl2.DataSubcomponentType) ComponentType(org.osate.aadl2.ComponentType) DataHolder(org.osate.ba.aadlba.DataHolder) Subcomponent(org.osate.aadl2.Subcomponent) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) SubprogramGroupSubcomponent(org.osate.aadl2.SubprogramGroupSubcomponent) SystemSubcomponent(org.osate.aadl2.SystemSubcomponent) DataSubcomponent(org.osate.aadl2.DataSubcomponent) SubprogramClassifier(org.osate.aadl2.SubprogramClassifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier) ProcessClassifier(org.osate.aadl2.ProcessClassifier) DataClassifier(org.osate.aadl2.DataClassifier) ProcessorClassifier(org.osate.aadl2.ProcessorClassifier) DataClassifier(org.osate.aadl2.DataClassifier) BehaviorNamedElement(org.osate.ba.aadlba.BehaviorNamedElement) NamedElement(org.osate.aadl2.NamedElement) Feature(org.osate.aadl2.Feature) AbstractFeature(org.osate.aadl2.AbstractFeature) DirectedFeature(org.osate.aadl2.DirectedFeature) DataAccess(org.osate.aadl2.DataAccess)

Aggregations

ComponentType (org.osate.aadl2.ComponentType)73 ComponentImplementation (org.osate.aadl2.ComponentImplementation)42 Classifier (org.osate.aadl2.Classifier)33 ComponentClassifier (org.osate.aadl2.ComponentClassifier)21 ArrayList (java.util.ArrayList)18 EObject (org.eclipse.emf.ecore.EObject)16 NamedElement (org.osate.aadl2.NamedElement)15 AnnexSubclause (org.osate.aadl2.AnnexSubclause)13 Feature (org.osate.aadl2.Feature)13 BasicEList (org.eclipse.emf.common.util.BasicEList)11 AadlPackage (org.osate.aadl2.AadlPackage)11 HashSet (java.util.HashSet)10 FeatureGroupType (org.osate.aadl2.FeatureGroupType)10 List (java.util.List)9 Subcomponent (org.osate.aadl2.Subcomponent)8 FeatureGroup (org.osate.aadl2.FeatureGroup)7 EList (org.eclipse.emf.common.util.EList)6 Property (org.osate.aadl2.Property)6 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)6 GetPropertyExpr (com.rockwellcollins.atc.agree.agree.GetPropertyExpr)5