Search in sources :

Example 1 with Name

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;
}
Also used : BTSExp(org.sireum.hamr.ir.BTSExp) Name(org.sireum.hamr.ir.Name)

Example 2 with Name

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

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

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));
}
Also used : Name(org.sireum.hamr.ir.Name)

Example 5 with Name

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);
}
Also used : ErrorTypes(org.osate.xtext.aadl2.errormodel.errorModel.ErrorTypes) Arrays(java.util.Arrays) Element(org.osate.aadl2.Element) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) Name(org.sireum.hamr.ir.Name) PropertyExpression(org.osate.aadl2.PropertyExpression) ErrorSink(org.osate.xtext.aadl2.errormodel.errorModel.ErrorSink) EventOrPropagation(org.osate.xtext.aadl2.errormodel.errorModel.EventOrPropagation) AnnexLib(org.sireum.hamr.ir.AnnexLib) Classifier(org.osate.aadl2.Classifier) Aadl2QualifiedNameProvider(org.osate.xtext.aadl2.naming.Aadl2QualifiedNameProvider) EMV2Properties(org.osate.xtext.aadl2.errormodel.util.EMV2Properties) OutgoingPropagationCondition(org.osate.xtext.aadl2.errormodel.errorModel.OutgoingPropagationCondition) ErrorAliasDef(org.sireum.hamr.ir.ErrorAliasDef) Annex(org.sireum.hamr.ir.Annex) OrmoreExpression(org.osate.xtext.aadl2.errormodel.errorModel.OrmoreExpression) AndExpression(org.osate.xtext.aadl2.errormodel.errorModel.AndExpression) Collection(java.util.Collection) ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) Collectors(java.util.stream.Collectors) BehaveStateMachine(org.sireum.hamr.ir.BehaveStateMachine) ErrorBehaviorStateMachine(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorStateMachine) List(java.util.List) Stream(java.util.stream.Stream) Property(org.osate.aadl2.Property) Optional(java.util.Optional) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ErrorTransition(org.sireum.hamr.ir.ErrorTransition) EMV2Path(org.osate.xtext.aadl2.errormodel.errorModel.EMV2Path) EMV2Util(org.osate.xtext.aadl2.errormodel.util.EMV2Util) Emv2BehaviorSection(org.sireum.hamr.ir.Emv2BehaviorSection) ConditionElement(org.osate.xtext.aadl2.errormodel.errorModel.ConditionElement) ErrorTypeDef(org.sireum.hamr.ir.ErrorTypeDef) ErrorBehaviorTransition(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorTransition) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) EMV2PropertyAssociation(org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation) OrExpression(org.osate.xtext.aadl2.errormodel.errorModel.OrExpression) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) ErrorSource(org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource) OrlessExpression(org.osate.xtext.aadl2.errormodel.errorModel.OrlessExpression) DirectionType(org.osate.aadl2.DirectionType) AllExpression(org.osate.xtext.aadl2.errormodel.errorModel.AllExpression) ConditionExpression(org.osate.xtext.aadl2.errormodel.errorModel.ConditionExpression) ErrorTypeSetDef(org.sireum.hamr.ir.ErrorTypeSetDef) FeatureorPPReference(org.osate.xtext.aadl2.errormodel.errorModel.FeatureorPPReference) ErrorPropagationImpl(org.osate.xtext.aadl2.errormodel.errorModel.impl.ErrorPropagationImpl) EList(org.eclipse.emf.common.util.EList) ErrorBehaviorEvent(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorEvent) ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ErrorModelLibrary(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelLibrary) NamedElement(org.osate.aadl2.NamedElement) Emv2Library(org.sireum.hamr.ir.Emv2Library) Collections(java.util.Collections) ErrorType(org.osate.xtext.aadl2.errormodel.errorModel.ErrorType) BehaveStateMachine(org.sireum.hamr.ir.BehaveStateMachine) ErrorTypeSetDef(org.sireum.hamr.ir.ErrorTypeSetDef) ErrorAliasDef(org.sireum.hamr.ir.ErrorAliasDef) ErrorTypeDef(org.sireum.hamr.ir.ErrorTypeDef) Name(org.sireum.hamr.ir.Name)

Aggregations

Name (org.sireum.hamr.ir.Name)23 ArrayList (java.util.ArrayList)17 NamedElement (org.osate.aadl2.NamedElement)11 DirectionType (org.osate.aadl2.DirectionType)10 ErrorModelLibrary (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelLibrary)10 Arrays (java.util.Arrays)9 Collection (java.util.Collection)9 Collections (java.util.Collections)9 LinkedHashMap (java.util.LinkedHashMap)9 List (java.util.List)9 Optional (java.util.Optional)9 Collectors (java.util.stream.Collectors)9 Stream (java.util.stream.Stream)9 EList (org.eclipse.emf.common.util.EList)9 Classifier (org.osate.aadl2.Classifier)9 Element (org.osate.aadl2.Element)9 Property (org.osate.aadl2.Property)9 PropertyExpression (org.osate.aadl2.PropertyExpression)9 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)9 AllExpression (org.osate.xtext.aadl2.errormodel.errorModel.AllExpression)9