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;
}
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;
}
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;
}
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;
}
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;
}
}
Aggregations