use of org.sireum.hamr.ir.Name 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;
}
use of org.sireum.hamr.ir.Name 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;
}
use of org.sireum.hamr.ir.Name 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;
}
use of org.sireum.hamr.ir.Name in project osate-plugin by sireum.
the class Emv2Visitor method errorType.
private org.sireum.hamr.ir.ErrorTypeDef errorType(ErrorType et) {
Name etn = getErrorType(et).get();
Name st = null;
if (et.getSuperType() != null) {
st = getErrorType(et.getSuperType()).get();
}
return factory.errorTypeDef(etn, st, VisitorUtil.getUriFragment(et));
}
use of org.sireum.hamr.ir.Name in project osate-plugin by sireum.
the class Emv2Visitor method emv2Lib.
private Emv2Library emv2Lib(ErrorModelLibrary eml) {
Name name = factory.name(VisitorUtil.toIList(EMV2Util.getLibraryName(eml)), VisitorUtil.buildPosInfo(eml));
List<String> useTypes = eml.getUseTypes().stream().map(ut -> ut.getName()).collect(Collectors.toList());
List<String> useExtends = eml.getExtends().stream().map(ue -> ue.getName()).collect(Collectors.toList());
List<ErrorTypeDef> etds = eml.getTypes().stream().map(et -> errorType(et)).collect(Collectors.toList());
List<ErrorTypeSetDef> etsds = eml.getTypesets().stream().map(ets -> errorTypeSet(ets)).collect(Collectors.toList());
List<ErrorAliasDef> etads = eml.getTypes().stream().filter(et -> et.getAliasedType() != null).map(et -> errorAliasType(et)).collect(Collectors.toList());
List<ErrorAliasDef> etsads = eml.getTypesets().stream().filter(ets -> ets.getAliasedType() != null).map(ets -> errorAliasTypeDef(ets)).collect(Collectors.toList());
List<BehaveStateMachine> bsms = eml.getBehaviors().stream().map(bs -> errorBehaviorStateMachine(bs)).collect(Collectors.toList());
return factory.emv2Library(name, VisitorUtil.addAll(useTypes, useExtends), etds, etsds, VisitorUtil.addAll(etads, etsads), bsms);
}
Aggregations