Search in sources :

Example 1 with BTSAssertion

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

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

the class BAVisitor method caseBehaviorState.

@Override
public Boolean caseBehaviorState(BehaviorState object) {
    Name id = toSimpleName(object.getName());
    List<BTSStateCategory.Type> categories = new ArrayList<>();
    if (object.isInitial()) {
        categories.add(BTSStateCategory.byName("Initial").get());
    }
    if (object.isComplete()) {
        categories.add(BTSStateCategory.byName("Complete").get());
    }
    if (object.isFinal()) {
        categories.add(BTSStateCategory.byName("Final").get());
    }
    if (categories.isEmpty()) {
        categories.add(BTSStateCategory.byName("Execute").get());
    }
    // NA for BA
    Option<BTSAssertion> assertion = toNone();
    BTSStateDeclaration bsd = BTSStateDeclaration$.MODULE$.apply(id, VisitorUtil.toISZ(categories), assertion);
    push(bsd);
    return false;
}
Also used : BTSAssertion(org.sireum.hamr.ir.BTSAssertion) BTSType(org.sireum.hamr.ir.BTSType) BTSLiteralType(org.sireum.hamr.ir.BTSLiteralType) ArrayList(java.util.ArrayList) Name(org.sireum.hamr.ir.Name) BTSStateDeclaration(org.sireum.hamr.ir.BTSStateDeclaration)

Example 3 with BTSAssertion

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

the class BAVisitor method caseBehaviorVariable.

@Override
public Boolean caseBehaviorVariable(BehaviorVariable object) {
    Option<BTSVariableCategory.Type> category = toNone();
    List<BTSVariableDeclaration> names = new ArrayList<>();
    DataClassifier dc = object.getDataClassifier();
    this.v.processDataType(dc);
    Classifier c = Classifier$.MODULE$.apply(dc.getQualifiedName());
    BTSType varType = BTSClassifier$.MODULE$.apply(c);
    Name name = toSimpleName(object.getName());
    Option<BTSExp> assignExpression = toNone();
    assert object.getOwnedValueConstant() == null : "Need to handle ba variable const init " + object;
    Option<BLESSIntConst> arraySize = toNone();
    // NA for BA
    Option<BTSAssertion> variableAssertion = toNone();
    BTSVariableDeclaration vd = BTSVariableDeclaration$.MODULE$.apply(name, category, varType, assignExpression, arraySize, variableAssertion);
    names.add(vd);
    push(names);
    return false;
}
Also used : ArrayList(java.util.ArrayList) DataClassifier(org.osate.aadl2.DataClassifier) Classifier(org.sireum.hamr.ir.Classifier) DataClassifier(org.osate.aadl2.DataClassifier) BLESSIntConst(org.sireum.hamr.ir.BLESSIntConst) Name(org.sireum.hamr.ir.Name) BTSType(org.sireum.hamr.ir.BTSType) BTSAssertion(org.sireum.hamr.ir.BTSAssertion) BTSType(org.sireum.hamr.ir.BTSType) BTSLiteralType(org.sireum.hamr.ir.BTSLiteralType) BTSVariableDeclaration(org.sireum.hamr.ir.BTSVariableDeclaration) BTSExp(org.sireum.hamr.ir.BTSExp)

Example 4 with BTSAssertion

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

the class BAVisitor method caseBehaviorActionBlock.

@Override
public Boolean caseBehaviorActionBlock(BehaviorActionBlock object) {
    BehaviorTime bt = object.getTimeout();
    assert bt == null : "Need to handle " + bt;
    visit(object.getContent());
    Object r = pop();
    if (r instanceof BTSBehaviorActions) {
        push(r);
    } else {
        BTSAction baa = (BTSAction) r;
        Option<BTSAssertion> pre = toNone();
        Option<BTSAssertion> post = toNone();
        BTSAssertedAction baa2 = BTSAssertedAction$.MODULE$.apply(pre, baa, post);
        push(BTSBehaviorActions$.MODULE$.apply(Sequential, VisitorUtil.toISZ(baa2)));
    }
    return false;
}
Also used : BTSAssertion(org.sireum.hamr.ir.BTSAssertion) BehaviorTime(org.osate.ba.aadlba.BehaviorTime) BTSAction(org.sireum.hamr.ir.BTSAction) EObject(org.eclipse.emf.ecore.EObject) BTSAssertedAction(org.sireum.hamr.ir.BTSAssertedAction) BTSBehaviorActions(org.sireum.hamr.ir.BTSBehaviorActions)

Example 5 with BTSAssertion

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

the class BAVisitor method caseBehaviorActionCollection.

@Override
public Boolean caseBehaviorActionCollection(BehaviorActionCollection object) {
    List<BTSAssertedAction> actions = new ArrayList<>();
    for (BehaviorAction ba : object.getActions()) {
        visit(ba);
        BTSAction action = pop();
        // NA for BA
        Option<BTSAssertion> pre = toNone();
        // NA for BA
        Option<BTSAssertion> post = toNone();
        actions.add(BTSAssertedAction$.MODULE$.apply(pre, action, post));
    }
    // TODO: how to determine execution order
    push(BTSBehaviorActions$.MODULE$.apply(Sequential, VisitorUtil.toISZ(actions)));
    return false;
}
Also used : BTSAssertion(org.sireum.hamr.ir.BTSAssertion) BehaviorAction(org.osate.ba.aadlba.BehaviorAction) BTSAction(org.sireum.hamr.ir.BTSAction) ArrayList(java.util.ArrayList) BTSAssertedAction(org.sireum.hamr.ir.BTSAssertedAction)

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