Search in sources :

Example 1 with BTSExp

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

the class BAVisitor method caseSimpleExpression.

@Override
public Boolean caseSimpleExpression(SimpleExpression object) {
    assert (object.getTerms().size() > 0);
    List<BinaryAddingOperator> binOps = object.getBinaryAddingOperators();
    UnaryAddingOperator unaryOp = object.getUnaryAddingOperator();
    List<BTSExp> expressions = new ArrayList<>();
    for (Term t : object.getTerms()) {
        visit(t);
        expressions.add(pop());
    }
    if (expressions.size() > 1) {
        push(convertToBinaryExp(expressions, binOps));
    } else {
        if (BAUtils.isNoneEnumerator(unaryOp)) {
            push(expressions.get(0));
        } else {
            push(BAUtils.convertToUnaryExp(expressions.get(0), unaryOp));
        }
    }
    return false;
}
Also used : UnaryAddingOperator(org.osate.ba.aadlba.UnaryAddingOperator) BinaryAddingOperator(org.osate.ba.aadlba.BinaryAddingOperator) ArrayList(java.util.ArrayList) BTSExp(org.sireum.hamr.ir.BTSExp) Term(org.osate.ba.aadlba.Term)

Example 2 with BTSExp

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

the class BAVisitor method casePortSendAction.

@Override
public Boolean casePortSendAction(PortSendAction object) {
    Name name = toName(object.getPort().getPort().getName());
    Option<BTSExp> exp = toNone();
    if (object.getValueExpression() != null) {
        visit(object.getValueExpression());
        exp = toSome(pop());
    }
    push(BTSPortOutAction$.MODULE$.apply(name, exp));
    return false;
}
Also used : BTSExp(org.sireum.hamr.ir.BTSExp) Name(org.sireum.hamr.ir.Name)

Example 3 with BTSExp

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

the class BAVisitor method caseAssignmentAction.

@Override
public Boolean caseAssignmentAction(AssignmentAction object) {
    visit(object.getTarget());
    BTSExp lhs = pop();
    visit(object.getValueExpression());
    BTSExp rhs = pop();
    push(BTSAssignmentAction$.MODULE$.apply(lhs, rhs));
    return false;
}
Also used : BTSExp(org.sireum.hamr.ir.BTSExp)

Example 4 with BTSExp

use of org.sireum.hamr.ir.BTSExp 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 5 with BTSExp

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

the class BAVisitor method caseValueExpression.

@Override
public Boolean caseValueExpression(ValueExpression object) {
    assert (object.getRelations().size() >= 1);
    List<BTSExp> expressions = new ArrayList<>();
    for (Relation r : object.getRelations()) {
        visit(r);
        expressions.add(pop());
    }
    if (expressions.size() > 1) {
        push(convertToBinaryExp(expressions, object.getLogicalOperators()));
    } else {
        push(expressions.get(0));
    }
    return false;
}
Also used : Relation(org.osate.ba.aadlba.Relation) ArrayList(java.util.ArrayList) BTSExp(org.sireum.hamr.ir.BTSExp)

Aggregations

BTSExp (org.sireum.hamr.ir.BTSExp)10 ArrayList (java.util.ArrayList)6 Name (org.sireum.hamr.ir.Name)3 BTSBinaryOp (org.sireum.hamr.ir.BTSBinaryOp)2 EObject (org.eclipse.emf.ecore.EObject)1 DataClassifier (org.osate.aadl2.DataClassifier)1 Feature (org.osate.aadl2.Feature)1 BinaryAddingOperator (org.osate.ba.aadlba.BinaryAddingOperator)1 BinaryNumericOperator (org.osate.ba.aadlba.BinaryNumericOperator)1 CalledSubprogramHolder (org.osate.ba.aadlba.CalledSubprogramHolder)1 ElseStatement (org.osate.ba.aadlba.ElseStatement)1 Factor (org.osate.ba.aadlba.Factor)1 IfStatement (org.osate.ba.aadlba.IfStatement)1 MultiplyingOperator (org.osate.ba.aadlba.MultiplyingOperator)1 Relation (org.osate.ba.aadlba.Relation)1 SubprogramSubcomponentHolder (org.osate.ba.aadlba.SubprogramSubcomponentHolder)1 Term (org.osate.ba.aadlba.Term)1 UnaryAddingOperator (org.osate.ba.aadlba.UnaryAddingOperator)1 UnaryBooleanOperator (org.osate.ba.aadlba.UnaryBooleanOperator)1 BLESSIntConst (org.sireum.hamr.ir.BLESSIntConst)1