use of org.osate.xtext.aadl2.errormodel.errorModel.QualifiedErrorBehaviorState in project osate2 by osate.
the class EMV2Util method findErrorBehaviorState.
/**
* find Error Behavior State utilizing use behavior or within EBSM
*
* @param context context of the reference to the state
* @param name String
* @return ErrorBehavior State
*/
public static ErrorBehaviorState findErrorBehaviorState(Element context, String name) {
ErrorBehaviorStateMachine ebsm;
if (context instanceof QualifiedErrorBehaviorState) {
// look up state in state machine of subcomponent
QualifiedErrorBehaviorState qualifiedState = (QualifiedErrorBehaviorState) context;
Subcomponent sub = qualifiedState.getSubcomponent().getSubcomponent();
ComponentClassifier subcl = sub.getAllClassifier();
if (subcl == null) {
return null;
}
return findErrorBehaviorState(subcl, name);
} else {
// // first see if it is in type bindings
// EList<ErrorBehaviorState> typebindings = getErrorBehaviorStateTypeBindings(context);
// if (typebindings != null){
// for (ErrorBehaviorState ebs : typebindings) {
// if (name.equalsIgnoreCase(ebs.getName())){
// return ebs;
// }
// }
// }
// resolve in local context, which is assumed to be an EBSM
ebsm = EMV2Util.getErrorBehaviorStateMachine(context);
return findErrorBehaviorStateInEBSM(ebsm, name);
}
}
Aggregations