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;
}
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;
}
Aggregations