Search in sources :

Example 31 with ComponentType

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

the class ComponentImplementationImpl method getAllPrototypes.

/**
 * Returns all the mode objects of a given implementation, including
 * ancestor.
 *
 * @return EList of all mode objects
 */
// XXX: [AADL 1 -> AADL 2] Added to make instantiation and property lookup
// work.
public EList<Prototype> getAllPrototypes() {
    final BasicEList<Prototype> returnlist = new BasicEList<Prototype>();
    ComponentType type = getType();
    if (Aadl2Util.isNull(type)) {
        return returnlist;
    }
    EList<Classifier> ancestors = getType().getSelfPlusAllExtended();
    // Process from farthest ancestor to self
    for (ListIterator<Classifier> li = ancestors.listIterator(ancestors.size()); li.hasPrevious(); ) {
        final ComponentType current = (ComponentType) li.previous();
        final EList<Prototype> currentItems = current.getOwnedPrototypes();
        if (currentItems != null) {
            for (Iterator<Prototype> i = currentItems.iterator(); i.hasNext(); ) {
                final Prototype fe = i.next();
                final Prototype rfe = fe.getRefined();
                if (rfe != null) {
                    returnlist.remove(rfe);
                }
                returnlist.add(fe);
            }
        }
    }
    ancestors = getSelfPlusAllExtended();
    // Process from farthest ancestor to self
    for (ListIterator<Classifier> li = ancestors.listIterator(ancestors.size()); li.hasPrevious(); ) {
        final ComponentImplementation current = (ComponentImplementation) li.previous();
        final EList<Prototype> currentItems = current.getOwnedPrototypes();
        if (currentItems != null) {
            for (Iterator<Prototype> i = currentItems.iterator(); i.hasNext(); ) {
                final Prototype fe = i.next();
                final Prototype rfe = fe.getRefined();
                if (rfe != null) {
                    returnlist.remove(rfe);
                }
                returnlist.add(fe);
            }
        }
    }
    return returnlist;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) Prototype(org.osate.aadl2.Prototype) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier)

Example 32 with ComponentType

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

the class ComponentImplementationImpl method getType.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public ComponentType getType() {
    ComponentType type = basicGetType();
    type = type != null && ((EObject) type).eIsProxy() ? (ComponentType) eResolveProxy((InternalEObject) type) : type;
    return // unresolved
    type != null && ((EObject) type).eIsProxy() ? // unresolved
    null : // proxy
    type;
}
Also used : ComponentType(org.osate.aadl2.ComponentType) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 33 with ComponentType

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

the class ComponentImplementationImpl method getAllModeTransitions.

/**
 * Returns all the mode transition objects of a given implementation,
 * including ancestor.
 *
 * @return EList of all mode transition objects
 */
// XXX: [AADL 1 -> AADL 2] Added to make instantiation work.
public EList<ModeTransition> getAllModeTransitions() {
    EList<Classifier> ancestors = getSelfPlusAllExtended();
    final BasicEList<ModeTransition> returnlist = new BasicEList<ModeTransition>();
    for (Iterator<Classifier> it = ancestors.iterator(); it.hasNext(); ) {
        final ComponentImplementation current = (ComponentImplementation) it.next();
        returnlist.addAll(current.getOwnedModeTransitions());
    }
    if (getType() == null) {
        return returnlist;
    }
    ancestors = getType().getSelfPlusAllExtended();
    for (Iterator<Classifier> it = ancestors.iterator(); it.hasNext(); ) {
        final ComponentType current = (ComponentType) it.next();
        returnlist.addAll(current.getOwnedModeTransitions());
    }
    return returnlist;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) BasicEList(org.eclipse.emf.common.util.BasicEList) ModeTransition(org.osate.aadl2.ModeTransition) Classifier(org.osate.aadl2.Classifier)

Example 34 with ComponentType

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

the class ComponentImplementationImpl method getAllModes.

/**
 * Returns all the mode objects of a given implementation, including
 * ancestor.
 *
 * @return EList of all mode objects
 */
// XXX: [AADL 1 -> AADL 2] Added to make instantiation and property lookup
// work.
public EList<Mode> getAllModes() {
    EList<Classifier> ancestors = getSelfPlusAllExtended();
    final BasicEList<Mode> returnlist = new BasicEList<Mode>();
    for (Iterator<Classifier> it = ancestors.iterator(); it.hasNext(); ) {
        final ComponentImplementation current = (ComponentImplementation) it.next();
        returnlist.addAll(current.getOwnedModes());
    }
    ComponentType type = getType();
    if (Aadl2Util.isNull(type)) {
        return returnlist;
    }
    ancestors = getType().getSelfPlusAllExtended();
    for (Iterator<Classifier> it = ancestors.iterator(); it.hasNext(); ) {
        final ComponentType current = (ComponentType) it.next();
        returnlist.addAll(current.getOwnedModes());
    }
    return returnlist;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) Mode(org.osate.aadl2.Mode) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier)

Example 35 with ComponentType

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

the class ComponentTypeImpl method getAllFeatures.

/**
 * get list of all features of a component type, including ancestor features
 * In case of refined features the refined feature is returned.
 *
 * @return List of feature objects
 */
// XXX: [AADL 1 -> AADL 2] Added to make instantiation work.
public EList<Feature> getAllFeatures() {
    final EList<Classifier> ancestors = getSelfPlusAllExtended();
    final BasicEList<Feature> returnlist = new BasicEList<Feature>();
    // Process from farthest ancestor to self
    for (ListIterator<Classifier> li = ancestors.listIterator(ancestors.size()); li.hasPrevious(); ) {
        final ComponentType current = (ComponentType) li.previous();
        final EList<Feature> currentFeatures = current.getOwnedFeatures();
        if (currentFeatures != null) {
            for (Iterator<Feature> i = currentFeatures.iterator(); i.hasNext(); ) {
                final Feature fe = i.next();
                final Feature rfe = fe.getRefined();
                if (rfe != null) {
                    returnlist.remove(rfe);
                }
                returnlist.add(fe);
            }
        }
    }
    return returnlist;
}
Also used : ComponentType(org.osate.aadl2.ComponentType) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier) Feature(org.osate.aadl2.Feature) AbstractFeature(org.osate.aadl2.AbstractFeature) ClassifierFeature(org.osate.aadl2.ClassifierFeature)

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