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