Search in sources :

Example 6 with QualifiedErrorBehaviorState

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);
    }
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) ErrorBehaviorStateMachine(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorStateMachine) Subcomponent(org.osate.aadl2.Subcomponent) QualifiedErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.QualifiedErrorBehaviorState)

Aggregations

QualifiedErrorBehaviorState (org.osate.xtext.aadl2.errormodel.errorModel.QualifiedErrorBehaviorState)5 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 AllExpression (org.osate.xtext.aadl2.errormodel.errorModel.AllExpression)2 AndExpression (org.osate.xtext.aadl2.errormodel.errorModel.AndExpression)2 EMV2Path (org.osate.xtext.aadl2.errormodel.errorModel.EMV2Path)2 OrExpression (org.osate.xtext.aadl2.errormodel.errorModel.OrExpression)2 OrmoreExpression (org.osate.xtext.aadl2.errormodel.errorModel.OrmoreExpression)2 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)2 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)2 LinkedList (java.util.LinkedList)1 List (java.util.List)1 BasicEList (org.eclipse.emf.common.util.BasicEList)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 EPackage (org.eclipse.emf.ecore.EPackage)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 ArrayRange (org.osate.aadl2.ArrayRange)1 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)1