Search in sources :

Example 11 with SubprogramGroupAccess

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

the class FeatureGroupTypeImpl method createOwnedSubprogramGroupAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramGroupAccess createOwnedSubprogramGroupAccess() {
    SubprogramGroupAccess newOwnedSubprogramGroupAccess = (SubprogramGroupAccess) create(Aadl2Package.eINSTANCE.getSubprogramGroupAccess());
    getOwnedSubprogramGroupAccesses().add(newOwnedSubprogramGroupAccess);
    return newOwnedSubprogramGroupAccess;
}
Also used : SubprogramGroupAccess(org.osate.aadl2.SubprogramGroupAccess)

Example 12 with SubprogramGroupAccess

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

the class DeviceTypeImpl method createOwnedSubprogramGroupAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramGroupAccess createOwnedSubprogramGroupAccess() {
    SubprogramGroupAccess newOwnedSubprogramGroupAccess = (SubprogramGroupAccess) create(Aadl2Package.eINSTANCE.getSubprogramGroupAccess());
    getOwnedSubprogramGroupAccesses().add(newOwnedSubprogramGroupAccess);
    return newOwnedSubprogramGroupAccess;
}
Also used : SubprogramGroupAccess(org.osate.aadl2.SubprogramGroupAccess)

Example 13 with SubprogramGroupAccess

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

the class SystemTypeImpl method createOwnedSubprogramGroupAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramGroupAccess createOwnedSubprogramGroupAccess() {
    SubprogramGroupAccess newOwnedSubprogramGroupAccess = (SubprogramGroupAccess) create(Aadl2Package.eINSTANCE.getSubprogramGroupAccess());
    getOwnedSubprogramGroupAccesses().add(newOwnedSubprogramGroupAccess);
    return newOwnedSubprogramGroupAccess;
}
Also used : SubprogramGroupAccess(org.osate.aadl2.SubprogramGroupAccess)

Example 14 with SubprogramGroupAccess

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

the class SubprogramTypeImpl method createOwnedSubprogramGroupAccess.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramGroupAccess createOwnedSubprogramGroupAccess() {
    SubprogramGroupAccess newOwnedSubprogramGroupAccess = (SubprogramGroupAccess) create(Aadl2Package.eINSTANCE.getSubprogramGroupAccess());
    getOwnedSubprogramGroupAccesses().add(newOwnedSubprogramGroupAccess);
    return newOwnedSubprogramGroupAccess;
}
Also used : SubprogramGroupAccess(org.osate.aadl2.SubprogramGroupAccess)

Example 15 with SubprogramGroupAccess

use of org.osate.aadl2.SubprogramGroupAccess 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)

Aggregations

SubprogramGroupAccess (org.osate.aadl2.SubprogramGroupAccess)18 FeatureGroup (org.osate.aadl2.FeatureGroup)6 SubprogramAccess (org.osate.aadl2.SubprogramAccess)5 SubprogramSubcomponent (org.osate.aadl2.SubprogramSubcomponent)5 Subcomponent (org.osate.aadl2.Subcomponent)4 SubprogramGroupSubcomponent (org.osate.aadl2.SubprogramGroupSubcomponent)4 BusAccess (org.osate.aadl2.BusAccess)3 ComponentPrototype (org.osate.aadl2.ComponentPrototype)3 ConnectedElement (org.osate.aadl2.ConnectedElement)3 DataAccess (org.osate.aadl2.DataAccess)3 EClass (org.eclipse.emf.ecore.EClass)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 CallContext (org.osate.aadl2.CallContext)2 Classifier (org.osate.aadl2.Classifier)2 ComponentClassifier (org.osate.aadl2.ComponentClassifier)2 ComponentType (org.osate.aadl2.ComponentType)2 DataPrototype (org.osate.aadl2.DataPrototype)2