Search in sources :

Example 1 with BTSTransition

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

the class BAVisitor method caseBehaviorAnnex.

@Override
public Boolean caseBehaviorAnnex(BehaviorAnnex o) {
    // NA for BA
    boolean doNotProve = true;
    // NA for BA
    List<BTSAssertion> _assertions = new ArrayList<>();
    // NA for BA
    Option<BTSAssertion> _invariant = toNone();
    List<BTSVariableDeclaration> _variables = new ArrayList<>();
    if (o.getVariables() != null) {
        for (BehaviorVariable bv : o.getVariables()) {
            visit(bv);
            _variables.addAll(pop());
        }
    }
    List<BTSStateDeclaration> _states = new ArrayList<>();
    for (BehaviorState bs : o.getStates()) {
        visit(bs);
        _states.add(pop());
    }
    List<BTSTransition> _transitions = new ArrayList<>();
    for (BehaviorTransition bt : o.getTransitions()) {
        visit(bt);
        _transitions.add(pop());
    }
    BTSBLESSAnnexClause b = BTSBLESSAnnexClause$.MODULE$.apply(doNotProve, VisitorUtil.toISZ(_assertions), _invariant, VisitorUtil.toISZ(_variables), VisitorUtil.toISZ(_states), VisitorUtil.toISZ(_transitions));
    push(b);
    return false;
}
Also used : BehaviorVariable(org.osate.ba.aadlba.BehaviorVariable) ArrayList(java.util.ArrayList) BehaviorTransition(org.osate.ba.aadlba.BehaviorTransition) BTSAssertion(org.sireum.hamr.ir.BTSAssertion) BTSTransition(org.sireum.hamr.ir.BTSTransition) BTSVariableDeclaration(org.sireum.hamr.ir.BTSVariableDeclaration) BehaviorState(org.osate.ba.aadlba.BehaviorState) BTSStateDeclaration(org.sireum.hamr.ir.BTSStateDeclaration) BTSBLESSAnnexClause(org.sireum.hamr.ir.BTSBLESSAnnexClause)

Example 2 with BTSTransition

use of org.sireum.hamr.ir.BTSTransition 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

ArrayList (java.util.ArrayList)2 BehaviorState (org.osate.ba.aadlba.BehaviorState)2 BTSAssertion (org.sireum.hamr.ir.BTSAssertion)2 BTSTransition (org.sireum.hamr.ir.BTSTransition)2 BehaviorCondition (org.osate.ba.aadlba.BehaviorCondition)1 BehaviorTransition (org.osate.ba.aadlba.BehaviorTransition)1 BehaviorVariable (org.osate.ba.aadlba.BehaviorVariable)1 DispatchCondition (org.osate.ba.aadlba.DispatchCondition)1 ValueExpression (org.osate.ba.aadlba.ValueExpression)1 Z (org.sireum.Z)1 BTSBLESSAnnexClause (org.sireum.hamr.ir.BTSBLESSAnnexClause)1 BTSBehaviorActions (org.sireum.hamr.ir.BTSBehaviorActions)1 BTSDispatchCondition (org.sireum.hamr.ir.BTSDispatchCondition)1 BTSStateDeclaration (org.sireum.hamr.ir.BTSStateDeclaration)1 BTSTransitionCondition (org.sireum.hamr.ir.BTSTransitionCondition)1 BTSTransitionLabel (org.sireum.hamr.ir.BTSTransitionLabel)1 BTSVariableDeclaration (org.sireum.hamr.ir.BTSVariableDeclaration)1 Name (org.sireum.hamr.ir.Name)1