Search in sources :

Example 16 with SubprogramAccess

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

the class AbstractTypeImpl method createOwnedSubprogramAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramAccess createOwnedSubprogramAccess() {
    SubprogramAccess newOwnedSubprogramAccess = (SubprogramAccess) create(Aadl2Package.eINSTANCE.getSubprogramAccess());
    getOwnedSubprogramAccesses().add(newOwnedSubprogramAccess);
    return newOwnedSubprogramAccess;
}
Also used : SubprogramAccess(org.osate.aadl2.SubprogramAccess)

Example 17 with SubprogramAccess

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

the class DataTypeImpl method createOwnedSubprogramAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramAccess createOwnedSubprogramAccess() {
    SubprogramAccess newOwnedSubprogramAccess = (SubprogramAccess) create(Aadl2Package.eINSTANCE.getSubprogramAccess());
    getOwnedSubprogramAccesses().add(newOwnedSubprogramAccess);
    return newOwnedSubprogramAccess;
}
Also used : SubprogramAccess(org.osate.aadl2.SubprogramAccess)

Example 18 with SubprogramAccess

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

the class SystemTypeImpl method createOwnedSubprogramAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramAccess createOwnedSubprogramAccess() {
    SubprogramAccess newOwnedSubprogramAccess = (SubprogramAccess) create(Aadl2Package.eINSTANCE.getSubprogramAccess());
    getOwnedSubprogramAccesses().add(newOwnedSubprogramAccess);
    return newOwnedSubprogramAccess;
}
Also used : SubprogramAccess(org.osate.aadl2.SubprogramAccess)

Example 19 with SubprogramAccess

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

the class PropertiesLinkingService method findElementInContext.

protected static <T> T findElementInContext(Element referencingObject, Context context, String name, Class<T> validSearchResultType) {
    NamedElement searchResult = null;
    if (context == null) {
        searchResult = AadlUtil.getContainingClassifier(referencingObject).findNamedElement(name);
    } else if (context instanceof FeatureGroup) {
        FeatureGroup featureGroup = (FeatureGroup) context;
        while (featureGroup.getFeatureGroupType() == null && featureGroup.getFeatureGroupPrototype() == null && featureGroup.getRefined() instanceof FeatureGroup) {
            featureGroup = (FeatureGroup) featureGroup.getRefined();
        }
        FeatureGroupType featureGroupType = null;
        if (featureGroup.getFeatureGroupType() != null) {
            featureGroupType = featureGroup.getFeatureGroupType();
        } else if (featureGroup.getFeatureGroupPrototype() != null) {
            featureGroupType = findFeatureGroupTypeForFeatureGroupPrototype(AadlUtil.getContainingClassifier(referencingObject), featureGroup.getFeatureGroupPrototype());
        }
        if (featureGroupType != null) {
            searchResult = featureGroupType.findNamedElement(name);
        }
    } else if (context instanceof Feature) {
        Feature feature = (Feature) context;
        while (feature.getClassifier() == null && feature.getPrototype() == null && feature.getRefined() != null) {
            feature = feature.getRefined();
        }
        Classifier featureClassifier = null;
        if (feature.getClassifier() != null) {
            featureClassifier = feature.getClassifier();
        } else if (feature.getPrototype() != null) {
            featureClassifier = findClassifierForComponentPrototype(AadlUtil.getContainingClassifier(referencingObject), feature.getPrototype());
        }
        if (featureClassifier != null) {
            searchResult = featureClassifier.findNamedElement(name);
        }
    } else if (context instanceof Subcomponent) {
        Subcomponent subcomponent = (Subcomponent) 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(referencingObject), (ComponentPrototype) subcomponent.getSubcomponentType());
        }
        if (subcomponentClassifier != null) {
            searchResult = subcomponentClassifier.findNamedElement(name);
        }
    } else if (context instanceof SubprogramCall) {
        SubprogramCall subprogramCall = (SubprogramCall) context;
        if (subprogramCall.getCalledSubprogram() instanceof ComponentClassifier) {
            searchResult = ((ComponentClassifier) subprogramCall.getCalledSubprogram()).findNamedElement(name);
        } else if (subprogramCall.getCalledSubprogram() instanceof SubprogramSubcomponent) {
            Subcomponent subcomponent = (SubprogramSubcomponent) subprogramCall.getCalledSubprogram();
            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(referencingObject), (ComponentPrototype) subcomponent.getSubcomponentType());
            }
            if (subcomponentClassifier != null) {
                searchResult = subcomponentClassifier.findNamedElement(name);
            }
        } else if (subprogramCall.getCalledSubprogram() instanceof SubprogramAccess) {
            Feature access = (SubprogramAccess) subprogramCall.getCalledSubprogram();
            while (access.getClassifier() == null && access.getPrototype() == null && access.getRefined() != null) {
                access = access.getRefined();
            }
            Classifier accessClassifier = null;
            if (access.getClassifier() != null) {
                accessClassifier = access.getClassifier();
            } else if (access.getPrototype() != null) {
                CallContext callContext = subprogramCall.getContext();
                if (callContext instanceof ComponentType) {
                    accessClassifier = findClassifierForComponentPrototype((ComponentType) callContext, access.getPrototype());
                } else if (callContext instanceof FeatureGroup) {
                    FeatureGroup callContextFeatureGroup = (FeatureGroup) callContext;
                    FeatureGroupType prototypeContext = null;
                    while (callContextFeatureGroup.getFeatureGroupType() == null && callContextFeatureGroup.getFeatureGroupPrototype() == null && callContextFeatureGroup.getRefined() instanceof FeatureGroup) {
                        callContextFeatureGroup = (FeatureGroup) callContextFeatureGroup.getRefined();
                    }
                    if (callContextFeatureGroup.getFeatureGroupType() != null) {
                        prototypeContext = callContextFeatureGroup.getFeatureGroupType();
                    } else if (callContextFeatureGroup.getFeatureGroupPrototype() != null) {
                        prototypeContext = findFeatureGroupTypeForFeatureGroupPrototype(AadlUtil.getContainingClassifier(referencingObject), callContextFeatureGroup.getFeatureGroupPrototype());
                    }
                    if (prototypeContext != null) {
                        accessClassifier = findClassifierForComponentPrototype(prototypeContext, access.getPrototype());
                    }
                } else if (callContext instanceof SubprogramGroupAccess) {
                    Feature callContextAccess = (SubprogramGroupAccess) callContext;
                    Classifier prototypeContext = null;
                    while (callContextAccess.getClassifier() == null && callContextAccess.getPrototype() == null && callContextAccess.getRefined() != null) {
                        callContextAccess = callContextAccess.getRefined();
                    }
                    if (callContextAccess.getClassifier() != null) {
                        prototypeContext = callContextAccess.getClassifier();
                    } else if (callContextAccess.getPrototype() != null) {
                        prototypeContext = findClassifierForComponentPrototype(AadlUtil.getContainingClassifier(referencingObject), callContextAccess.getPrototype());
                    }
                    if (prototypeContext != null) {
                        accessClassifier = findClassifierForComponentPrototype(prototypeContext, access.getPrototype());
                    }
                } else if (callContext instanceof SubprogramGroupSubcomponent) {
                    Subcomponent callContextSubcomponent = (SubprogramGroupSubcomponent) callContext;
                    while (callContextSubcomponent.getSubcomponentType() == null && callContextSubcomponent.getRefined() != null) {
                        callContextSubcomponent = callContextSubcomponent.getRefined();
                    }
                    if (callContextSubcomponent.getSubcomponentType() instanceof ComponentClassifier) {
                        if (callContextSubcomponent.getOwnedPrototypeBindings().isEmpty()) {
                            accessClassifier = findClassifierForComponentPrototype(callContextSubcomponent.getClassifier(), access.getPrototype());
                        } else {
                            accessClassifier = findClassifierForComponentPrototype(callContextSubcomponent.getClassifier(), callContextSubcomponent, access.getPrototype());
                        }
                    } else if (callContextSubcomponent.getSubcomponentType() instanceof ComponentPrototype) {
                        ComponentClassifier prototypeContext = findClassifierForComponentPrototype(AadlUtil.getContainingClassifier(referencingObject), callContextSubcomponent.getPrototype());
                        if (prototypeContext != null) {
                            accessClassifier = findClassifierForComponentPrototype(prototypeContext, access.getPrototype());
                        }
                    }
                } else // callContext is null.
                {
                    accessClassifier = findClassifierForComponentPrototype(AadlUtil.getContainingClassifier(referencingObject), access.getPrototype());
                }
            }
            if (accessClassifier != null) {
                searchResult = accessClassifier.findNamedElement(name);
            }
        } else if (subprogramCall.getCalledSubprogram() instanceof ComponentPrototype) {
            ComponentClassifier classifier = findClassifierForComponentPrototype(AadlUtil.getContainingClassifier(referencingObject), (ComponentPrototype) subprogramCall.getCalledSubprogram());
            if (classifier != null) {
                searchResult = classifier.findNamedElement(name);
            }
        }
    }
    if (validSearchResultType.isInstance(searchResult)) {
        return validSearchResultType.cast(searchResult);
    } else {
        return null;
    }
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) FeatureGroup(org.osate.aadl2.FeatureGroup) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) ComponentType(org.osate.aadl2.ComponentType) FeatureGroupType(org.osate.aadl2.FeatureGroupType) SubprogramGroupSubcomponent(org.osate.aadl2.SubprogramGroupSubcomponent) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Feature(org.osate.aadl2.Feature) CallContext(org.osate.aadl2.CallContext) SubprogramGroupAccess(org.osate.aadl2.SubprogramGroupAccess) ComponentPrototype(org.osate.aadl2.ComponentPrototype) SubprogramAccess(org.osate.aadl2.SubprogramAccess) 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) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) NamedElement(org.osate.aadl2.NamedElement) SubprogramCall(org.osate.aadl2.SubprogramCall)

Example 20 with SubprogramAccess

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

the class ThreadTypeImpl method createOwnedSubprogramAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramAccess createOwnedSubprogramAccess() {
    SubprogramAccess newOwnedSubprogramAccess = (SubprogramAccess) create(Aadl2Package.eINSTANCE.getSubprogramAccess());
    getOwnedSubprogramAccesses().add(newOwnedSubprogramAccess);
    return newOwnedSubprogramAccess;
}
Also used : SubprogramAccess(org.osate.aadl2.SubprogramAccess)

Aggregations

SubprogramAccess (org.osate.aadl2.SubprogramAccess)19 SubprogramSubcomponent (org.osate.aadl2.SubprogramSubcomponent)7 SubprogramGroupAccess (org.osate.aadl2.SubprogramGroupAccess)5 FeatureGroup (org.osate.aadl2.FeatureGroup)4 BusAccess (org.osate.aadl2.BusAccess)3 DataAccess (org.osate.aadl2.DataAccess)3 Subcomponent (org.osate.aadl2.Subcomponent)3 ArrayList (java.util.ArrayList)2 EOperation (org.eclipse.emf.ecore.EOperation)2 Aadl2Package (org.osate.aadl2.Aadl2Package)2 AadlString (org.osate.aadl2.AadlString)2 AbstractFeature (org.osate.aadl2.AbstractFeature)2 AbstractSubcomponent (org.osate.aadl2.AbstractSubcomponent)2 AccessConnection (org.osate.aadl2.AccessConnection)2 Classifier (org.osate.aadl2.Classifier)2 ComponentClassifier (org.osate.aadl2.ComponentClassifier)2 ComponentPrototype (org.osate.aadl2.ComponentPrototype)2 ConnectedElement (org.osate.aadl2.ConnectedElement)2 DataClassifier (org.osate.aadl2.DataClassifier)2 EventDataPort (org.osate.aadl2.EventDataPort)2