Search in sources :

Example 1 with Emv2Library

use of org.sireum.hamr.ir.Emv2Library 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

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 EList (org.eclipse.emf.common.util.EList)1 Classifier (org.osate.aadl2.Classifier)1 DirectionType (org.osate.aadl2.DirectionType)1 Element (org.osate.aadl2.Element)1 NamedElement (org.osate.aadl2.NamedElement)1 Property (org.osate.aadl2.Property)1 PropertyExpression (org.osate.aadl2.PropertyExpression)1 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)1 AllExpression (org.osate.xtext.aadl2.errormodel.errorModel.AllExpression)1 AndExpression (org.osate.xtext.aadl2.errormodel.errorModel.AndExpression)1 ConditionElement (org.osate.xtext.aadl2.errormodel.errorModel.ConditionElement)1