armodel 1.8.0__py3-none-any.whl → 1.8.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. armodel/models/M2/AUTOSARTemplates/AutosarTopLevelStructure.py +0 -1
  2. armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior.py +14 -14
  3. armodel/models/M2/AUTOSARTemplates/CommonStructure/FlatMap.py +2 -3
  4. armodel/models/M2/AUTOSARTemplates/CommonStructure/Implementation.py +1 -1
  5. armodel/models/M2/AUTOSARTemplates/CommonStructure/ImplementationDataTypes.py +7 -7
  6. armodel/models/M2/AUTOSARTemplates/CommonStructure/InternalBehavior.py +1 -1
  7. armodel/models/M2/AUTOSARTemplates/CommonStructure/ModeDeclaration.py +4 -4
  8. armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/__init__.py +3 -3
  9. armodel/models/M2/AUTOSARTemplates/CommonStructure/Timing/TimingConstraint/ExecutionOrderConstraint.py +3 -3
  10. armodel/models/M2/AUTOSARTemplates/CommonStructure/Timing/TimingConstraint/TimingExtensions.py +3 -3
  11. armodel/models/M2/AUTOSARTemplates/ECUCDescriptionTemplate.py +86 -9
  12. armodel/models/M2/AUTOSARTemplates/ECUCParameterDefTemplate.py +1249 -0
  13. armodel/models/M2/AUTOSARTemplates/GenericStructure/AbstractStructure.py +13 -10
  14. armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ARPackage.py +238 -225
  15. armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ArObject.py +5 -4
  16. armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/Identifiable.py +46 -25
  17. armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/PrimitiveTypes.py +33 -3
  18. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Components/__init__.py +18 -20
  19. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Datatype/Datatypes.py +23 -19
  20. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/EndToEndProtection.py +4 -4
  21. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/PortInterface/__init__.py +71 -27
  22. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/ServiceMapping.py +9 -9
  23. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/__init__.py +172 -128
  24. armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/CoreCommunication.py +11 -11
  25. armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/CoreTopology.py +8 -8
  26. armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/EcuInstance.py +2 -2
  27. armodel/models/M2/AUTOSARTemplates/SystemTemplate/NetworkManagement.py +6 -6
  28. armodel/models/M2/AUTOSARTemplates/SystemTemplate/__init__.py +6 -6
  29. armodel/models/M2/MSR/AsamHdo/AdminData.py +101 -8
  30. armodel/parser/abstract_arxml_parser.py +8 -5
  31. armodel/parser/arxml_parser.py +332 -16
  32. armodel/tests/test_armodel/models/test_ECUCParameterDefTemplate.py +116 -0
  33. armodel/tests/test_armodel/models/test_Identifiable.py +85 -0
  34. armodel/tests/test_armodel/models/test_ar_object.py +85 -86
  35. armodel/tests/test_armodel/models/test_ar_package.py +70 -70
  36. armodel/tests/test_armodel/models/test_ar_ref.py +36 -36
  37. armodel/tests/test_armodel/models/test_common_structure.py +37 -35
  38. armodel/tests/test_armodel/models/test_datatype.py +4 -4
  39. armodel/tests/test_armodel/models/test_general_structure.py +19 -18
  40. armodel/tests/test_armodel/models/test_port_interface.py +2 -6
  41. armodel/tests/test_armodel/parser/test_arxml_parser.py +8 -8
  42. armodel/writer/abstract_arxml_writer.py +6 -2
  43. armodel/writer/arxml_writer.py +376 -29
  44. {armodel-1.8.0.dist-info → armodel-1.8.1.dist-info}/METADATA +17 -1
  45. {armodel-1.8.0.dist-info → armodel-1.8.1.dist-info}/RECORD +49 -46
  46. {armodel-1.8.0.dist-info → armodel-1.8.1.dist-info}/LICENSE +0 -0
  47. {armodel-1.8.0.dist-info → armodel-1.8.1.dist-info}/WHEEL +0 -0
  48. {armodel-1.8.0.dist-info → armodel-1.8.1.dist-info}/entry_points.txt +0 -0
  49. {armodel-1.8.0.dist-info → armodel-1.8.1.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,11 @@
1
1
  from abc import ABCMeta
2
2
  from typing import Dict
3
3
 
4
- class ARObject(metaclass = ABCMeta):
4
+
5
+ class ARObject(metaclass=ABCMeta):
5
6
  def __init__(self):
6
- if type(self) == ARObject:
7
- raise NotImplementedError("ARObject is an abstract class.")
7
+ if type(self) is ARObject:
8
+ raise TypeError("ARObject is an abstract class.")
8
9
 
9
10
  self.parent = None # type: ARObject
10
11
  self.checksum = None # type: str
@@ -13,4 +14,4 @@ class ARObject(metaclass = ABCMeta):
13
14
  self.uuid = None # type: str
14
15
 
15
16
  def getTagName(self, tag: str, nsmap: Dict) -> str:
16
- return tag.replace("{%s}" % nsmap["xmlns"], "")
17
+ return tag.replace("{%s}" % nsmap["xmlns"], "")
@@ -6,14 +6,14 @@ from .....M2.MSR.Documentation.TextModel.MultilanguageData import MultiLanguageO
6
6
  from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
7
7
  from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARLiteral, CategoryString
8
8
  from abc import ABCMeta
9
- from typing import List
9
+ from typing import Dict, List
10
10
 
11
11
 
12
12
  class Referrable(ARObject, metaclass=ABCMeta):
13
13
  def __init__(self, parent: ARObject, short_name: str):
14
14
 
15
15
  if type(self) is Referrable:
16
- raise NotImplementedError("Referrable is an abstract class.")
16
+ raise TypeError("Referrable is an abstract class.")
17
17
 
18
18
  ARObject.__init__(self)
19
19
 
@@ -45,7 +45,7 @@ class Referrable(ARObject, metaclass=ABCMeta):
45
45
  class MultilanguageReferrable(Referrable, metaclass=ABCMeta):
46
46
  def __init__(self, parent: ARObject, short_name: str):
47
47
  if type(self) is MultilanguageReferrable:
48
- raise NotImplementedError("MultilanguageReferrable is an abstract class.")
48
+ raise TypeError("MultilanguageReferrable is an abstract class.")
49
49
 
50
50
  super().__init__(parent, short_name)
51
51
 
@@ -63,40 +63,61 @@ class MultilanguageReferrable(Referrable, metaclass=ABCMeta):
63
63
  class CollectableElement(ARObject, metaclass=ABCMeta):
64
64
  def __init__(self):
65
65
  if type(self) is CollectableElement:
66
- raise NotImplementedError("CollectableElement is an abstract class.")
66
+ raise TypeError("CollectableElement is an abstract class.")
67
67
 
68
- self.elements = {} # type: dict[str, Referrable]
68
+ # super().__init__()
69
+
70
+ self.elements: List[Referrable] = []
71
+ self.element_mappings: Dict[str, List[Referrable]] = {}
69
72
 
70
73
  def getTotalElement(self) -> int:
71
- # return len(list(filter(lambda a: not isinstance(a, ARPackage) , self.elements.values())))
72
- return len(self.elements.values())
73
-
74
- def removeElement(self, key):
75
- if key not in self.elements:
76
- raise KeyError("Invalid key <%s> for removing element" % key)
77
- self.elements.pop(key)
74
+ # return len(list(filter(lambda a: not isinstance(a, ARPackage) , self.elements)))
75
+ return len(self.elements)
76
+
77
+ def removeElement(self, short_name: str, type=None):
78
+ if short_name not in self.element_mappings:
79
+ raise KeyError("Invalid key <%s> for removing element" % short_name)
80
+ if type is None:
81
+ item = self.element_mappings[short_name][0]
82
+ else:
83
+ item = next(filter(lambda a: isinstance(a, type), self.element_mappings[short_name]))
84
+ if item is not None:
85
+ self.elements.remove(item)
86
+ self.element_mappings[short_name].remove(item)
78
87
 
79
88
  def getElements(self):
80
- return self.elements.values()
89
+ return self.elements
81
90
 
82
91
  def addElement(self, element: Referrable):
83
92
  short_name = element.getShortName()
84
- if not self.IsElementExists(short_name):
85
- self.elements[short_name] = element
86
-
87
- def getElement(self, short_name: str) -> Referrable:
88
- if (short_name not in self.elements):
93
+ if not self.IsElementExists(short_name, type(element)):
94
+ self.elements.append(element)
95
+ if short_name not in self.element_mappings:
96
+ self.element_mappings[short_name] = []
97
+ self.element_mappings[short_name].append(element)
98
+
99
+ def getElement(self, short_name: str, type=None) -> Referrable:
100
+ if (short_name not in self.element_mappings):
89
101
  return None
90
- return self.elements[short_name]
102
+ if type is not None:
103
+ result = list(filter(lambda a: isinstance(a, type), self.element_mappings[short_name]))
104
+ if len(result) == 0:
105
+ return None
106
+ return result[0]
107
+ return self.element_mappings[short_name][0]
91
108
 
92
- def IsElementExists(self, short_name: str) -> bool:
93
- return short_name in self.elements
109
+ def IsElementExists(self, short_name: str, type=None) -> bool:
110
+ if type is None:
111
+ return short_name in self.element_mappings
112
+ if short_name in self.element_mappings:
113
+ return any(isinstance(a, type) for a in self.element_mappings[short_name])
114
+ return False
94
115
 
95
116
 
96
117
  class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMeta):
97
118
  def __init__(self, parent: ARObject, short_name: str):
98
119
  if type(self) is Identifiable:
99
- raise NotImplementedError("Identifiable is an abstract class.")
120
+ raise TypeError("Identifiable is an abstract class.")
100
121
 
101
122
  MultilanguageReferrable.__init__(self, parent, short_name)
102
123
  CollectableElement.__init__(self)
@@ -153,21 +174,21 @@ class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMet
153
174
  class PackageableElement(Identifiable, metaclass=ABCMeta):
154
175
  def __init__(self, parent: ARObject, short_name: str):
155
176
  if type(self) is PackageableElement:
156
- raise NotImplementedError("PackageableElement is an abstract class.")
177
+ raise TypeError("PackageableElement is an abstract class.")
157
178
  super().__init__(parent, short_name)
158
179
 
159
180
 
160
181
  class ARElement(PackageableElement, metaclass=ABCMeta):
161
182
  def __init__(self, parent: ARObject, short_name: str):
162
183
  if type(self) is ARElement:
163
- raise NotImplementedError("ARElement is an abstract class.")
184
+ raise TypeError("ARElement is an abstract class.")
164
185
  super().__init__(parent, short_name)
165
186
 
166
187
 
167
188
  class Describable(ARObject, metaclass=ABCMeta):
168
189
  def __init__(self):
169
190
  if type(self) is Describable:
170
- raise NotImplementedError("Describable is an abstract class.")
191
+ raise TypeError("Describable is an abstract class.")
171
192
 
172
193
  super().__init__()
173
194
 
@@ -465,7 +465,7 @@ class TRefType(RefType):
465
465
 
466
466
 
467
467
  class DiagRequirementIdString(ARLiteral):
468
- '''
468
+ r'''
469
469
  This string denotes an Identifier for a requirement.
470
470
 
471
471
  Tags:
@@ -491,7 +491,7 @@ class ArgumentDirectionEnum(AREnum):
491
491
 
492
492
 
493
493
  class Ip4AddressString(ARLiteral):
494
- '''
494
+ r'''
495
495
  This is used to specify an IP4 address. Notation: 255.255.255.255
496
496
 
497
497
  Tags
@@ -504,7 +504,7 @@ class Ip4AddressString(ARLiteral):
504
504
 
505
505
 
506
506
  class Ip6AddressString(ARLiteral):
507
- '''
507
+ r'''
508
508
  This is used to specify an IP6 address. Notation: FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF
509
509
  Alternative notations, short-cuts with duplicate colons like ::, etc. or mixtures using colons and dots, are
510
510
  not allowed.
@@ -550,3 +550,33 @@ class CategoryString(ARLiteral):
550
550
  class ByteOrderEnum(AREnum):
551
551
  def __init__(self):
552
552
  super().__init__([])
553
+
554
+
555
+ class DateTime(ARLiteral):
556
+ r'''
557
+ A datatype representing a timestamp. The smallest granularity is 1 second.
558
+ This datatype represents a timestamp in the format yyyy-mm-dd followed by an optional time. The lead-in
559
+ character for the time is "T" and the format is hh:mm:ss. In addition, a time zone designator shall be
560
+ specified. The time zone designator can either be "Z" (for UTC) or the time offset to UTC, i.e. (+|-)hh:mm.
561
+
562
+ Examples:
563
+ 2009-07-23
564
+ 2009-07-23T14:38:00+01:00
565
+ 2009-07-23T13:38:00Z
566
+ Tags:
567
+ xml.xsd.customType=DATE
568
+ xml.xsd.pattern=([0-9]{4}-[0-9]{2}-[0-9]{2})(T[0-9]{2}:[0-9]{2}:[0-9]{2}(Z|([+\-][0-9]{2}:[0-9]{2})))?
569
+ xml.xsd.type=string
570
+ '''
571
+ def __init__(self):
572
+ super().__init__()
573
+
574
+
575
+ class VerbatimString(ARLiteral):
576
+ def __init__(self):
577
+ super().__init__()
578
+
579
+
580
+ class RegularExpression(ARLiteral):
581
+ def __init__(self):
582
+ super().__init__()
@@ -310,13 +310,11 @@ class AtomicSwComponentType(SwComponentType, metaclass=ABCMeta):
310
310
  return self.internalBehavior
311
311
 
312
312
  def createSwcInternalBehavior(self, short_name) -> SwcInternalBehavior:
313
- if (short_name not in self.elements):
314
- if (len(list(filter(lambda e: isinstance(e, SwcInternalBehavior), self.elements.values()))) >= 1):
315
- raise ValueError("The internal behavior of <%s> can not more than 1" % self.short_name)
313
+ if (not self.IsElementExists(short_name)):
316
314
  behavior = SwcInternalBehavior(self, short_name)
317
- self.elements[short_name] = behavior
315
+ self.addElement(behavior)
318
316
  self.internalBehavior = behavior
319
- return self.elements[short_name]
317
+ return self.getElement(short_name, SwcInternalBehavior)
320
318
 
321
319
  def getSymbolProps(self):
322
320
  return self.symbolProps
@@ -329,7 +327,7 @@ class AtomicSwComponentType(SwComponentType, metaclass=ABCMeta):
329
327
  '''
330
328
  @property
331
329
  def internal_behavior(self) -> SwcInternalBehavior:
332
- return next(filter(lambda e: isinstance(e, SwcInternalBehavior), self.elements.values()))
330
+ return next(filter(lambda e: isinstance(e, SwcInternalBehavior), self.elements))
333
331
  '''
334
332
 
335
333
 
@@ -418,42 +416,42 @@ class CompositionSwComponentType(SwComponentType):
418
416
 
419
417
  def removeAllAssemblySwConnector(self):
420
418
  for sw_connector in self.getAssemblySwConnectors():
421
- self.elements.pop(sw_connector.short_name)
419
+ self.elements.remove(sw_connector)
422
420
 
423
421
  def removeAllDelegationSwConnector(self):
424
422
  for sw_connector in self.getDelegationSwConnectors():
425
- self.elements.pop(sw_connector.short_name)
423
+ self.elements.remove(sw_connector)
426
424
 
427
425
  def createAssemblySwConnector(self, short_name: str) -> AssemblySwConnector:
428
- if (short_name not in self.elements):
426
+ if not self.IsElementExists(short_name):
429
427
  connector = AssemblySwConnector(self, short_name)
430
- self.elements[short_name] = connector
431
- return self.elements[short_name]
428
+ self.addElement(connector)
429
+ return self.getElement(short_name, AssemblySwConnector)
432
430
 
433
431
  def createDelegationSwConnector(self, short_name: str) -> DelegationSwConnector:
434
- if short_name not in self.elements:
432
+ if not self.IsElementExists(short_name):
435
433
  connector = DelegationSwConnector(self, short_name)
436
- self.elements[short_name] = connector
437
- return self.elements[short_name]
434
+ self.addElement(connector)
435
+ return self.getElement(short_name, DelegationSwConnector)
438
436
 
439
437
  def getAssemblySwConnectors(self) -> List[AssemblySwConnector]:
440
- return list(sorted(filter(lambda e: isinstance(e, AssemblySwConnector), self.elements.values()), key=lambda c: c.short_name))
438
+ return list(sorted(filter(lambda e: isinstance(e, AssemblySwConnector), self.elements), key=lambda c: c.short_name))
441
439
 
442
440
  def getDelegationSwConnectors(self) -> List[DelegationSwConnector]:
443
- return list(sorted(filter(lambda e: isinstance(e, DelegationSwConnector), self.elements.values()), key=lambda c: c.short_name))
441
+ return list(sorted(filter(lambda e: isinstance(e, DelegationSwConnector), self.elements), key=lambda c: c.short_name))
444
442
 
445
443
  # def getSwConnectors(self) -> List[SwConnector]:
446
- # return list(sorted(filter(lambda e: isinstance(e, SwConnector), self.elements.values()), key=lambda c: c.short_name))
444
+ # return list(sorted(filter(lambda e: isinstance(e, SwConnector), self.elements), key=lambda c: c.short_name))
447
445
 
448
446
  def getSwConnectors(self) -> List[SwConnector]:
449
- return list(filter(lambda e: isinstance(e, SwConnector), self.elements.values()))
447
+ return list(filter(lambda e: isinstance(e, SwConnector), self.elements))
450
448
 
451
449
  def createSwComponentPrototype(self, short_name: str) -> SwComponentPrototype:
452
- if (not self.IsElementExists(short_name)):
450
+ if not self.IsElementExists(short_name):
453
451
  prototype = SwComponentPrototype(self, short_name)
454
452
  self.addElement(prototype)
455
453
  self.components.append(prototype)
456
- return self.getElement(short_name)
454
+ return self.getElement(short_name, SwComponentPrototype)
457
455
 
458
456
  def getComponents(self) -> List[SwComponentPrototype]:
459
457
  return self.components
@@ -8,10 +8,11 @@ from .....M2.AUTOSARTemplates.SWComponentTemplate.Datatype.DataPrototypes import
8
8
  from .....M2.MSR.DataDictionary.DataDefProperties import SwDataDefProps
9
9
  from abc import ABCMeta
10
10
 
11
- class AutosarDataType(AtpType, metaclass = ABCMeta):
11
+
12
+ class AutosarDataType(AtpType, metaclass=ABCMeta):
12
13
  def __init__(self, parent: ARObject, short_name: str):
13
- if type(self) == AutosarDataType:
14
- raise NotImplementedError("AutosarDataType is an abstract class.")
14
+ if type(self) is AutosarDataType:
15
+ raise TypeError("AutosarDataType is an abstract class.")
15
16
 
16
17
  super().__init__(parent, short_name)
17
18
 
@@ -25,10 +26,10 @@ class AutosarDataType(AtpType, metaclass = ABCMeta):
25
26
  return self
26
27
 
27
28
 
28
- class ApplicationDataType(AutosarDataType, metaclass = ABCMeta):
29
+ class ApplicationDataType(AutosarDataType, metaclass=ABCMeta):
29
30
  def __init__(self, parent: ARObject, short_name: str):
30
- if type(self) == ApplicationDataType:
31
- raise NotImplementedError("ApplicationDataType is an abstract class.")
31
+ if type(self) is ApplicationDataType:
32
+ raise TypeError("ApplicationDataType is an abstract class.")
32
33
 
33
34
  super().__init__(parent, short_name)
34
35
 
@@ -40,8 +41,8 @@ class ApplicationPrimitiveDataType(ApplicationDataType):
40
41
 
41
42
  class ApplicationCompositeDataType(ApplicationDataType, metaclass=ABCMeta):
42
43
  def __init__(self, parent: ARObject, short_name: str):
43
- if type(self) == ApplicationCompositeDataType:
44
- raise NotImplementedError("ApplicationCompositeDataType is an abstract class.")
44
+ if type(self) is ApplicationCompositeDataType:
45
+ raise TypeError("ApplicationCompositeDataType is an abstract class.")
45
46
 
46
47
  super().__init__(parent, short_name)
47
48
 
@@ -62,24 +63,25 @@ class ApplicationArrayDataType(ApplicationCompositeDataType):
62
63
  return self
63
64
 
64
65
  def createApplicationArrayElement(self, short_name: str) -> ApplicationArrayElement:
65
- if (short_name not in self.elements):
66
+ if not self.IsElementExists(short_name):
66
67
  array_element = ApplicationArrayElement(self, short_name)
67
- self.elements[short_name] = array_element
68
- self.element = self.elements[short_name]
69
- return self.elements[short_name]
68
+ self.addElement(array_element)
69
+ self.element = array_element
70
+ return self.getElement(short_name, ApplicationArrayElement)
71
+
70
72
 
71
73
  class ApplicationRecordDataType(ApplicationCompositeDataType):
72
74
  def __init__(self, parent: ARObject, short_name: str):
73
75
  super().__init__(parent, short_name)
74
76
 
75
- self.record_elements = []
77
+ self.record_elements: List[ApplicationRecordElement] = []
76
78
 
77
79
  def createApplicationRecordElement(self, short_name: str) -> ApplicationRecordElement:
78
- if (short_name not in self.elements):
80
+ if (not self.IsElementExists(short_name)):
79
81
  record_element = ApplicationRecordElement(self, short_name)
80
- self.elements[short_name] = record_element
81
- self.record_elements.append(self.elements[short_name])
82
- return self.elements[short_name]
82
+ self.addElement(record_element)
83
+ self.record_elements.append(record_element)
84
+ return self.getElement(short_name, ApplicationRecordElement)
83
85
 
84
86
  def getApplicationRecordElements(self) -> List[ApplicationRecordElement]:
85
87
  return self.record_elements
@@ -105,12 +107,14 @@ class DataTypeMap(ARObject):
105
107
  self.implementationDataTypeRef = value
106
108
  return self
107
109
 
110
+
108
111
  class DataTypeMappingSet(ARElement):
109
112
  def __init__(self, parent: ARObject, short_name: str):
110
113
  super().__init__(parent, short_name)
111
114
 
112
115
  self.dataTypeMaps = [] # type: List[DataTypeMap]
113
- self.modeRequestTypeMaps = [] # type: List[ModeRequestTypeMap]
116
+ # type: List[ModeRequestTypeMap]
117
+ self.modeRequestTypeMaps = []
114
118
 
115
119
  def addDataTypeMap(self, type_map: DataTypeMap):
116
120
  self.dataTypeMaps.append(type_map)
@@ -124,4 +128,4 @@ class DataTypeMappingSet(ARElement):
124
128
  return self
125
129
 
126
130
  def getModeRequestTypeMaps(self) -> List[ModeRequestTypeMap]:
127
- return self.modeRequestTypeMaps
131
+ return self.modeRequestTypeMaps
@@ -175,10 +175,10 @@ class EndToEndProtectionSet(Identifiable):
175
175
  super().__init__(parent, short_name)
176
176
 
177
177
  def createEndToEndProtection(self, short_name: str) -> EndToEndProtection:
178
- if (short_name not in self.elements):
178
+ if not self.IsElementExists(short_name):
179
179
  protection = EndToEndProtection(self, short_name)
180
- self.elements[short_name] = protection
181
- return self.elements[short_name]
180
+ self.addElement(protection)
181
+ return self.getElement(short_name, EndToEndProtection)
182
182
 
183
183
  def getEndToEndProtections(self) -> List[EndToEndProtection]:
184
- return sorted(filter(lambda c: isinstance(c, EndToEndProtection), self.elements.values()), key=lambda e: e.short_name)
184
+ return sorted(filter(lambda c: isinstance(c, EndToEndProtection), self.elements), key=lambda e: e.short_name)
@@ -2,7 +2,7 @@ from abc import ABCMeta
2
2
  from typing import List
3
3
 
4
4
  from .....M2.AUTOSARTemplates.CommonStructure import TextValueSpecification
5
- from .....M2.AUTOSARTemplates.CommonStructure.TriggerDeclaration import Trigger
5
+ from .....M2.AUTOSARTemplates.CommonStructure.TriggerDeclaration import Trigger, TriggerMapping
6
6
  from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import ARElement, Identifiable
7
7
  from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
8
8
  from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARLiteral, ARNumerical, ArgumentDirectionEnum, Boolean
@@ -164,21 +164,16 @@ class SenderReceiverInterface(DataInterface):
164
164
  return self
165
165
 
166
166
  def createDataElement(self, short_name) -> VariableDataPrototype:
167
- if (short_name not in self.elements):
167
+ if (not self.IsElementExists(short_name)):
168
168
  data_element = VariableDataPrototype(self, short_name)
169
- self.elements[short_name] = data_element
170
- return self.elements[short_name]
169
+ self.addElement(data_element)
170
+ return self.getElement(short_name, VariableDataPrototype)
171
171
 
172
172
  def getDataElements(self) -> List[VariableDataPrototype]:
173
- return list(filter(lambda c: isinstance(c, VariableDataPrototype), self.elements.values()))
173
+ return list(filter(lambda c: isinstance(c, VariableDataPrototype), self.elements))
174
174
 
175
175
  def getDataElement(self, short_name) -> VariableDataPrototype:
176
- if (short_name in self.elements):
177
- data_element = self.elements[short_name]
178
- # if (not isinstance(data_element, VariableDataPrototype)):
179
- # raise IndexError("%s is not data element." % short_name)
180
- return data_element
181
- raise IndexError("data element <%s> can not be found." % short_name)
176
+ return self.getElement(short_name, VariableDataPrototype)
182
177
 
183
178
  def createInvalidationPolicy(self) -> InvalidationPolicy:
184
179
  policy = InvalidationPolicy(self)
@@ -193,7 +188,7 @@ class ArgumentDataPrototype(AutosarDataPrototype):
193
188
  def __init__(self, parent: ARObject, short_name: str):
194
189
  super().__init__(parent, short_name)
195
190
 
196
- self.direction = None # type: ArgumentDirectionEnum
191
+ self.direction: ArgumentDirectionEnum = None
197
192
  self.serverArgumentImplPolicy = None # type: ServerArgumentImplPolicyEnum
198
193
 
199
194
  def getDirection(self):
@@ -286,22 +281,22 @@ class ClientServerInterface(PortInterface):
286
281
  super().__init__(parent, short_name)
287
282
 
288
283
  def createOperation(self, short_name: str) -> ClientServerOperation:
289
- if (short_name not in self.elements):
284
+ if (not self.IsElementExists(short_name)):
290
285
  operation = ClientServerOperation(self, short_name)
291
- self.elements[short_name] = operation
292
- return self.elements[short_name]
286
+ self.addElement(operation)
287
+ return self.getElement(short_name, ClientServerOperation)
293
288
 
294
289
  def createApplicationError(self, short_name: str) -> ApplicationError:
295
- if (short_name not in self.elements):
290
+ if (not self.IsElementExists(short_name)):
296
291
  error = ApplicationError(self, short_name)
297
- self.elements[short_name] = error
298
- return self.elements[short_name]
292
+ self.addElement(error)
293
+ return self.getElement(short_name, ApplicationError)
299
294
 
300
295
  def getOperations(self) -> List[ClientServerOperation]:
301
- return list(filter(lambda c: isinstance(c, ClientServerOperation), self.elements.values()))
296
+ return list(filter(lambda c: isinstance(c, ClientServerOperation), self.elements))
302
297
 
303
298
  def getPossibleErrors(self) -> List[ApplicationError]:
304
- return list(filter(lambda c: isinstance(c, ApplicationError), self.elements.values()))
299
+ return list(filter(lambda c: isinstance(c, ApplicationError), self.elements))
305
300
 
306
301
 
307
302
  class TriggerInterface(PortInterface):
@@ -318,13 +313,13 @@ class ModeSwitchInterface(PortInterface):
318
313
  self._modeGroup = [] # type: List[ModeDeclarationGroupPrototype]
319
314
 
320
315
  def createModeGroup(self, short_name: str) -> ModeDeclarationGroupPrototype:
321
- prototype = ModeDeclarationGroupPrototype(self, short_name)
322
- if (short_name not in self.elements):
323
- self.elements[short_name] = prototype
324
- return self.elements[short_name]
316
+ if not self.IsElementExists(short_name):
317
+ prototype = ModeDeclarationGroupPrototype(self, short_name)
318
+ self.addElement(prototype)
319
+ return self.getElement(short_name, ModeDeclarationGroupPrototype)
325
320
 
326
321
  def getModeGroups(self) -> List[ModeDeclarationGroupPrototype]:
327
- return list(sorted(filter(lambda c: isinstance(c, ModeDeclarationGroupPrototype), self.elements.values()), key=lambda o: o.short_name))
322
+ return list(sorted(filter(lambda c: isinstance(c, ModeDeclarationGroupPrototype), self.elements), key=lambda o: o.short_name))
328
323
 
329
324
 
330
325
  class PortInterfaceMapping(Identifiable, metaclass=ABCMeta):
@@ -505,9 +500,58 @@ class TriggerInterfaceMapping(PortInterfaceMapping):
505
500
  def __init__(self, parent: ARObject, short_name: str):
506
501
  super().__init__(parent, short_name)
507
502
 
508
- self.triggerMapping = [] # type: List[TriggerMapping]
503
+ self.triggerMapping: List[TriggerMapping] = []
504
+
505
+ def getTriggerMapping(self) -> List[TriggerMapping]:
506
+ return self.triggerMapping
507
+
508
+ def setTriggerMapping(self, value: List[TriggerMapping]):
509
+ if value is not None:
510
+ self.triggerMapping = value
511
+ return self
512
+
513
+
514
+ class ModeDeclarationMapping(Identifiable):
515
+ def __init__(self, parent: ARObject, short_name: str):
516
+ super().__init__(parent, short_name)
517
+
518
+ self.firstModeRefs: List[RefType] = []
519
+ self.secondModeRef: RefType = []
520
+
521
+ def getFirstModeRefs(self) -> List[RefType]:
522
+ return self.firstModeRefs
523
+
524
+ def addFirstModeRef(self, value: List[RefType]):
525
+ if value is not None:
526
+ self.firstModeRefs.append(value)
527
+ return self
528
+
529
+ def getSecondModeRef(self) -> RefType:
530
+ return self.secondModeRef
531
+
532
+ def setSecondModeRef(self, value: RefType):
533
+ if value is not None:
534
+ self.secondModeRef = value
535
+ return self
536
+
537
+
538
+ class ModeDeclarationMappingSet(ARElement):
539
+ def __init__(self, parent: ARObject, short_name: str):
540
+ super().__init__(parent, short_name)
541
+
542
+ self.modeDeclarationMappings: List[ModeDeclarationMapping] = []
543
+
544
+ def getModeDeclarationMappings(self) -> List[ModeDeclarationMapping]:
545
+ return self.modeDeclarationMappings
546
+
547
+ def createModeDeclarationMapping(self, short_name: str) -> ModeDeclarationMapping:
548
+ if (not self.IsElementExists(short_name)):
549
+ mapping = ModeDeclarationMapping(self, short_name)
550
+ self.addElement(mapping)
551
+ self.modeDeclarationMappings.append(mapping)
552
+ return self.getElement(short_name)
553
+
509
554
 
510
-
511
555
  class PortInterfaceMappingSet(ARElement):
512
556
  def __init__(self, parent: ARObject, short_name: str):
513
557
  super().__init__(parent, short_name)
@@ -110,28 +110,28 @@ class SwcServiceDependency(ServiceDependency):
110
110
  return self.getElement(short_name)
111
111
 
112
112
  def getNvBlockNeeds(self) -> List[NvBlockNeeds]:
113
- return sorted(filter(lambda c: isinstance(c, NvBlockNeeds), self.elements.values()), key=lambda e: e.short_name)
113
+ return sorted(filter(lambda c: isinstance(c, NvBlockNeeds), self.elements), key=lambda e: e.short_name)
114
114
 
115
115
  def getDiagnosticCommunicationManagerNeeds(self) -> List[DiagnosticCommunicationManagerNeeds]:
116
- return sorted(filter(lambda c: isinstance(c, DiagnosticCommunicationManagerNeeds), self.elements.values()), key=lambda e: e.short_name)
116
+ return sorted(filter(lambda c: isinstance(c, DiagnosticCommunicationManagerNeeds), self.elements), key=lambda e: e.short_name)
117
117
 
118
118
  def getDiagnosticRoutineNeeds(self) -> List[DiagnosticRoutineNeeds]:
119
- return sorted(filter(lambda c: isinstance(c, DiagnosticRoutineNeeds), self.elements.values()), key=lambda e: e.short_name)
119
+ return sorted(filter(lambda c: isinstance(c, DiagnosticRoutineNeeds), self.elements), key=lambda e: e.short_name)
120
120
 
121
121
  def getDiagnosticEventNeeds(self) -> List[DiagnosticEventNeeds]:
122
- return sorted(filter(lambda c: isinstance(c, DiagnosticEventNeeds), self.elements.values()), key=lambda e: e.short_name)
122
+ return sorted(filter(lambda c: isinstance(c, DiagnosticEventNeeds), self.elements), key=lambda e: e.short_name)
123
123
 
124
124
  def getCryptoServiceNeeds(self) -> List[CryptoServiceNeeds]:
125
- return sorted(filter(lambda c: isinstance(c, CryptoServiceNeeds), self.elements.values()), key=lambda e: e.short_name)
125
+ return sorted(filter(lambda c: isinstance(c, CryptoServiceNeeds), self.elements), key=lambda e: e.short_name)
126
126
 
127
127
  def getEcuStateMgrUserNeeds(self) -> List[EcuStateMgrUserNeeds]:
128
- return sorted(filter(lambda c: isinstance(c, EcuStateMgrUserNeeds), self.elements.values()), key=lambda e: e.short_name)
128
+ return sorted(filter(lambda c: isinstance(c, EcuStateMgrUserNeeds), self.elements), key=lambda e: e.short_name)
129
129
 
130
130
  def getDtcStatusChangeNotificationNeeds(self) -> List[DtcStatusChangeNotificationNeeds]:
131
- return sorted(filter(lambda c: isinstance(c, DtcStatusChangeNotificationNeeds), self.elements.values()), key=lambda e: e.short_name)
131
+ return sorted(filter(lambda c: isinstance(c, DtcStatusChangeNotificationNeeds), self.elements), key=lambda e: e.short_name)
132
132
 
133
133
  def getDltUserNeeds(self) -> List[DltUserNeeds]:
134
- return sorted(filter(lambda c: isinstance(c, DltUserNeeds), self.elements.values()), key=lambda e: e.short_name)
134
+ return sorted(filter(lambda c: isinstance(c, DltUserNeeds), self.elements), key=lambda e: e.short_name)
135
135
 
136
136
  def getServiceNeeds(self) -> List[ServiceNeeds]:
137
- return sorted(filter(lambda c: isinstance(c, ServiceNeeds), self.elements.values()), key=lambda e: e.short_name)
137
+ return sorted(filter(lambda c: isinstance(c, ServiceNeeds), self.elements), key=lambda e: e.short_name)