Search in sources :

Example 6 with BTSAssertion

use of org.sireum.hamr.ir.BTSAssertion in project osate-plugin by sireum.

the class BAVisitor method caseBehaviorTransition.

@Override
public Boolean caseBehaviorTransition(BehaviorTransition object) {
    Z value = Z$.MODULE$.apply(object.getPriority());
    Option<Z> priority = toSome(value);
    List<Name> _sourceStates = new ArrayList<>();
    BehaviorState src = object.getSourceState();
    String srcName = src.getName();
    _sourceStates.add(toSimpleName(srcName));
    BehaviorState dest = object.getDestinationState();
    // just need name
    String destName = dest.getName();
    Name destState = toSimpleName(destName);
    Name id = null;
    if (object.getName() != null) {
        id = toSimpleName(object.getName());
    } else {
        id = emptyName();
    }
    BTSTransitionLabel label = BTSTransitionLabel$.MODULE$.apply(id, priority);
    Option<BTSTransitionCondition> _transitionCondition = toNone();
    BehaviorCondition bc = object.getCondition();
    if (bc != null) {
        visit(bc);
        if (bc instanceof DispatchCondition) {
            _transitionCondition = toSome(pop());
        } else if (bc instanceof ValueExpression) {
            _transitionCondition = toSome(BTSExecuteConditionExp$.MODULE$.apply(pop()));
        } else {
            throw new RuntimeException("handle transition condition: " + bc);
        }
    }
    Option<BTSBehaviorActions> actions = toNone();
    if (object.getActionBlock() != null) {
        visit(object.getActionBlock());
        actions = toSome(pop());
    }
    // NA for BA
    Option<BTSAssertion> assertion = toNone();
    BTSTransition bt = BTSTransition$.MODULE$.apply(label, VisitorUtil.toISZ(_sourceStates), destState, _transitionCondition, actions, assertion);
    push(bt);
    return false;
}
Also used : BTSTransitionLabel(org.sireum.hamr.ir.BTSTransitionLabel) BTSTransitionCondition(org.sireum.hamr.ir.BTSTransitionCondition) ArrayList(java.util.ArrayList) Name(org.sireum.hamr.ir.Name) BTSAssertion(org.sireum.hamr.ir.BTSAssertion) DispatchCondition(org.osate.ba.aadlba.DispatchCondition) BTSDispatchCondition(org.sireum.hamr.ir.BTSDispatchCondition) BTSTransition(org.sireum.hamr.ir.BTSTransition) BehaviorCondition(org.osate.ba.aadlba.BehaviorCondition) ValueExpression(org.osate.ba.aadlba.ValueExpression) Z(org.sireum.Z) BehaviorState(org.osate.ba.aadlba.BehaviorState) BTSBehaviorActions(org.sireum.hamr.ir.BTSBehaviorActions)

Aggregations

BTSAssertion (org.sireum.hamr.ir.BTSAssertion)6 ArrayList (java.util.ArrayList)5 Name (org.sireum.hamr.ir.Name)3 BehaviorState (org.osate.ba.aadlba.BehaviorState)2 BTSAction (org.sireum.hamr.ir.BTSAction)2 BTSAssertedAction (org.sireum.hamr.ir.BTSAssertedAction)2 BTSBehaviorActions (org.sireum.hamr.ir.BTSBehaviorActions)2 BTSLiteralType (org.sireum.hamr.ir.BTSLiteralType)2 BTSStateDeclaration (org.sireum.hamr.ir.BTSStateDeclaration)2 BTSTransition (org.sireum.hamr.ir.BTSTransition)2 BTSType (org.sireum.hamr.ir.BTSType)2 BTSVariableDeclaration (org.sireum.hamr.ir.BTSVariableDeclaration)2 EObject (org.eclipse.emf.ecore.EObject)1 DataClassifier (org.osate.aadl2.DataClassifier)1 BehaviorAction (org.osate.ba.aadlba.BehaviorAction)1 BehaviorCondition (org.osate.ba.aadlba.BehaviorCondition)1 BehaviorTime (org.osate.ba.aadlba.BehaviorTime)1 BehaviorTransition (org.osate.ba.aadlba.BehaviorTransition)1 BehaviorVariable (org.osate.ba.aadlba.BehaviorVariable)1 DispatchCondition (org.osate.ba.aadlba.DispatchCondition)1