Skip to content

Commit bd24ed7

Browse files
Fix #75: Containmnet principle implemented (#78)
* Fix #75: Containmnet principle implemented * Rename * Update doc
1 parent 41dfa43 commit bd24ed7

File tree

764 files changed

+8326
-3401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

764 files changed

+8326
-3401
lines changed

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/AnnotatingElement.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace SysML2.NET.Core.POCO.Root.Annotations
3131

3232
using SysML2.NET.Core.POCO.Root.Elements;
3333
using SysML2.NET.Core.POCO.Root.Namespaces;
34+
using SysML2.NET.Collections;
3435
using SysML2.NET.Decorators;
3536

3637
/// <summary>
@@ -40,8 +41,19 @@ namespace SysML2.NET.Core.POCO.Root.Annotations
4041
/// </summary>
4142
[Class(xmiId: "_19_0_2_12e503d9_1594145576693_532940_27", isAbstract: false, isFinalSpecialization: false, isActive: false)]
4243
[GeneratedCode("SysML2.NET", "latest")]
43-
public partial class AnnotatingElement : IAnnotatingElement
44+
public partial class AnnotatingElement : IAnnotatingElement, IContainedElement
4445
{
46+
/// <summary>
47+
/// Initialize a new instance of <see cref="AnnotatingElement" />
48+
/// </summary>
49+
public AnnotatingElement()
50+
{
51+
((IContainedElement)this).OwnedRelationship = new ContainerList<IElement, IRelationship>(this,
52+
(relationship, element) => ((IContainedRelationship)relationship).OwningRelatedElement = element,
53+
relationship => relationship.OwningRelatedElement);
54+
55+
}
56+
4557
/// <summary>
4658
/// Gets or sets the unique identifier
4759
/// </summary>
@@ -170,7 +182,10 @@ public partial class AnnotatingElement : IAnnotatingElement
170182
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
171183
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
172184
[Implements(implementation: "IElement.OwnedRelationship")]
173-
public List<IRelationship> OwnedRelationship { get; set; } = [];
185+
public IReadOnlyCollection<IRelationship> OwnedRelationship => ((IContainedElement)this).OwnedRelationship;
186+
187+
/// <summary>Backing field for IElement.OwnedRelationship</summary>
188+
ContainerList<IElement, IRelationship> IContainedElement.OwnedRelationship { get; set; }
174189

175190
/// <summary>
176191
/// The owner of this Element, derived as the owningRelatedElement of the owningRelationship of this
@@ -213,7 +228,10 @@ public partial class AnnotatingElement : IAnnotatingElement
213228
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_482273_43303", aggregation: AggregationKind.None, lowerValue: 0, upperValue: 1, isOrdered: false, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
214229
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
215230
[Implements(implementation: "IElement.OwningRelationship")]
216-
public IRelationship OwningRelationship { get; set; }
231+
public IRelationship OwningRelationship => ((IContainedElement)this).OwningRelationship;
232+
233+
/// <summary>Backing field for IElement.OwningRelationship</summary>
234+
IRelationship IContainedElement.OwningRelationship { get; set; }
217235

218236
/// <summary>
219237
/// The full ownership-qualified name of this Element, represented in a form that is valid according to

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/Association.cs

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Associations
3535
using SysML2.NET.Core.POCO.Root.Annotations;
3636
using SysML2.NET.Core.POCO.Root.Elements;
3737
using SysML2.NET.Core.POCO.Root.Namespaces;
38+
using SysML2.NET.Collections;
3839
using SysML2.NET.Decorators;
3940

4041
/// <summary>
@@ -44,8 +45,23 @@ namespace SysML2.NET.Core.POCO.Kernel.Associations
4445
/// </summary>
4546
[Class(xmiId: "_18_5_3_12e503d9_1533160651716_116234_42240", isAbstract: false, isFinalSpecialization: false, isActive: false)]
4647
[GeneratedCode("SysML2.NET", "latest")]
47-
public partial class Association : IAssociation
48+
public partial class Association : IAssociation, IContainedRelationship
4849
{
50+
/// <summary>
51+
/// Initialize a new instance of <see cref="Association" />
52+
/// </summary>
53+
public Association()
54+
{
55+
((IContainedElement)this).OwnedRelationship = new ContainerList<IElement, IRelationship>(this,
56+
(relationship, element) => ((IContainedRelationship)relationship).OwningRelatedElement = element,
57+
relationship => relationship.OwningRelatedElement);
58+
59+
((IContainedRelationship)this).OwnedRelatedElement = new ContainerList<IRelationship, IElement>(this,
60+
(element, relationship) => ((IContainedElement)element).OwningRelationship = relationship,
61+
element => element.OwningRelationship);
62+
63+
}
64+
4965
/// <summary>
5066
/// Gets or sets the unique identifier
5167
/// </summary>
@@ -413,15 +429,21 @@ public partial class Association : IAssociation
413429
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_59873_43302", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
414430
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
415431
[Implements(implementation: "IRelationship.OwnedRelatedElement")]
416-
public List<IElement> OwnedRelatedElement { get; set; } = [];
432+
public IReadOnlyCollection<IElement> OwnedRelatedElement => ((IContainedRelationship)this).OwnedRelatedElement;
433+
434+
/// <summary>Backing field for IRelationship.OwnedRelatedElement</summary>
435+
ContainerList<IRelationship, IElement> IContainedRelationship.OwnedRelatedElement { get; set; }
417436

418437
/// <summary>
419438
/// The Relationships for which this Element is the owningRelatedElement.
420439
/// </summary>
421440
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
422441
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
423442
[Implements(implementation: "IElement.OwnedRelationship")]
424-
public List<IRelationship> OwnedRelationship { get; set; } = [];
443+
public IReadOnlyCollection<IRelationship> OwnedRelationship => ((IContainedElement)this).OwnedRelationship;
444+
445+
/// <summary>Backing field for IElement.OwnedRelationship</summary>
446+
ContainerList<IElement, IRelationship> IContainedElement.OwnedRelationship { get; set; }
425447

426448
/// <summary>
427449
/// The ownedRelationships of this Type that are Specializations, for which the Type is the specific
@@ -483,15 +505,21 @@ public partial class Association : IAssociation
483505
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_693018_16749", aggregation: AggregationKind.None, lowerValue: 0, upperValue: 1, isOrdered: false, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
484506
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
485507
[Implements(implementation: "IRelationship.OwningRelatedElement")]
486-
public IElement OwningRelatedElement { get; set; }
508+
public IElement OwningRelatedElement => ((IContainedRelationship)this).OwningRelatedElement;
509+
510+
/// <summary>Backing field for IRelationship.OwningRelatedElement</summary>
511+
IElement IContainedRelationship.OwningRelatedElement { get; set; }
487512

488513
/// <summary>
489514
/// The Relationship for which this Element is an ownedRelatedElement, if any.
490515
/// </summary>
491516
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_482273_43303", aggregation: AggregationKind.None, lowerValue: 0, upperValue: 1, isOrdered: false, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
492517
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
493518
[Implements(implementation: "IElement.OwningRelationship")]
494-
public IRelationship OwningRelationship { get; set; }
519+
public IRelationship OwningRelationship => ((IContainedElement)this).OwningRelationship;
520+
521+
/// <summary>Backing field for IElement.OwningRelationship</summary>
522+
IRelationship IContainedElement.OwningRelationship { get; set; }
495523

496524
/// <summary>
497525
/// The full ownership-qualified name of this Element, represented in a form that is valid according to

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/Dependency.cs

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace SysML2.NET.Core.POCO.Root.Dependencies
3232
using SysML2.NET.Core.POCO.Root.Annotations;
3333
using SysML2.NET.Core.POCO.Root.Elements;
3434
using SysML2.NET.Core.POCO.Root.Namespaces;
35+
using SysML2.NET.Collections;
3536
using SysML2.NET.Decorators;
3637

3738
/// <summary>
@@ -43,8 +44,23 @@ namespace SysML2.NET.Core.POCO.Root.Dependencies
4344
/// </summary>
4445
[Class(xmiId: "_19_0_2_12e503d9_1594006219028_628649_74", isAbstract: false, isFinalSpecialization: false, isActive: false)]
4546
[GeneratedCode("SysML2.NET", "latest")]
46-
public partial class Dependency : IDependency
47+
public partial class Dependency : IDependency, IContainedRelationship
4748
{
49+
/// <summary>
50+
/// Initialize a new instance of <see cref="Dependency" />
51+
/// </summary>
52+
public Dependency()
53+
{
54+
((IContainedRelationship)this).OwnedRelatedElement = new ContainerList<IRelationship, IElement>(this,
55+
(element, relationship) => ((IContainedElement)element).OwningRelationship = relationship,
56+
element => element.OwningRelationship);
57+
58+
((IContainedElement)this).OwnedRelationship = new ContainerList<IElement, IRelationship>(this,
59+
(relationship, element) => ((IContainedRelationship)relationship).OwningRelatedElement = element,
60+
relationship => relationship.OwningRelatedElement);
61+
62+
}
63+
4864
/// <summary>
4965
/// Gets or sets the unique identifier
5066
/// </summary>
@@ -161,15 +177,21 @@ public partial class Dependency : IDependency
161177
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_59873_43302", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
162178
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
163179
[Implements(implementation: "IRelationship.OwnedRelatedElement")]
164-
public List<IElement> OwnedRelatedElement { get; set; } = [];
180+
public IReadOnlyCollection<IElement> OwnedRelatedElement => ((IContainedRelationship)this).OwnedRelatedElement;
181+
182+
/// <summary>Backing field for IRelationship.OwnedRelatedElement</summary>
183+
ContainerList<IRelationship, IElement> IContainedRelationship.OwnedRelatedElement { get; set; }
165184

166185
/// <summary>
167186
/// The Relationships for which this Element is the owningRelatedElement.
168187
/// </summary>
169188
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
170189
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
171190
[Implements(implementation: "IElement.OwnedRelationship")]
172-
public List<IRelationship> OwnedRelationship { get; set; } = [];
191+
public IReadOnlyCollection<IRelationship> OwnedRelationship => ((IContainedElement)this).OwnedRelationship;
192+
193+
/// <summary>Backing field for IElement.OwnedRelationship</summary>
194+
ContainerList<IElement, IRelationship> IContainedElement.OwnedRelationship { get; set; }
173195

174196
/// <summary>
175197
/// The owner of this Element, derived as the owningRelatedElement of the owningRelationship of this
@@ -203,15 +225,21 @@ public partial class Dependency : IDependency
203225
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_693018_16749", aggregation: AggregationKind.None, lowerValue: 0, upperValue: 1, isOrdered: false, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
204226
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
205227
[Implements(implementation: "IRelationship.OwningRelatedElement")]
206-
public IElement OwningRelatedElement { get; set; }
228+
public IElement OwningRelatedElement => ((IContainedRelationship)this).OwningRelatedElement;
229+
230+
/// <summary>Backing field for IRelationship.OwningRelatedElement</summary>
231+
IElement IContainedRelationship.OwningRelatedElement { get; set; }
207232

208233
/// <summary>
209234
/// The Relationship for which this Element is an ownedRelatedElement, if any.
210235
/// </summary>
211236
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_482273_43303", aggregation: AggregationKind.None, lowerValue: 0, upperValue: 1, isOrdered: false, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
212237
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
213238
[Implements(implementation: "IElement.OwningRelationship")]
214-
public IRelationship OwningRelationship { get; set; }
239+
public IRelationship OwningRelationship => ((IContainedElement)this).OwningRelationship;
240+
241+
/// <summary>Backing field for IElement.OwningRelationship</summary>
242+
IRelationship IContainedElement.OwningRelationship { get; set; }
215243

216244
/// <summary>
217245
/// The full ownership-qualified name of this Element, represented in a form that is valid according to

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/EnumerationDefinition.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ namespace SysML2.NET.Core.POCO.Systems.Enumerations
5656
using SysML2.NET.Core.POCO.Systems.UseCases;
5757
using SysML2.NET.Core.POCO.Systems.VerificationCases;
5858
using SysML2.NET.Core.POCO.Systems.Views;
59+
using SysML2.NET.Collections;
5960
using SysML2.NET.Decorators;
6061

6162
/// <summary>
@@ -65,8 +66,19 @@ namespace SysML2.NET.Core.POCO.Systems.Enumerations
6566
/// </summary>
6667
[Class(xmiId: "_19_0_4_12e503d9_1606946467364_179493_153", isAbstract: false, isFinalSpecialization: false, isActive: false)]
6768
[GeneratedCode("SysML2.NET", "latest")]
68-
public partial class EnumerationDefinition : IEnumerationDefinition
69+
public partial class EnumerationDefinition : IEnumerationDefinition, IContainedElement
6970
{
71+
/// <summary>
72+
/// Initialize a new instance of <see cref="EnumerationDefinition" />
73+
/// </summary>
74+
public EnumerationDefinition()
75+
{
76+
((IContainedElement)this).OwnedRelationship = new ContainerList<IElement, IRelationship>(this,
77+
(relationship, element) => ((IContainedRelationship)relationship).OwningRelatedElement = element,
78+
relationship => relationship.OwningRelatedElement);
79+
80+
}
81+
7082
/// <summary>
7183
/// Gets or sets the unique identifier
7284
/// </summary>
@@ -603,7 +615,10 @@ bool Systems.DefinitionAndUsage.IDefinition.IsVariation
603615
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
604616
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
605617
[Implements(implementation: "IElement.OwnedRelationship")]
606-
public List<IRelationship> OwnedRelationship { get; set; } = [];
618+
public IReadOnlyCollection<IRelationship> OwnedRelationship => ((IContainedElement)this).OwnedRelationship;
619+
620+
/// <summary>Backing field for IElement.OwnedRelationship</summary>
621+
ContainerList<IElement, IRelationship> IContainedElement.OwnedRelationship { get; set; }
607622

608623
/// <summary>
609624
/// The RenderingUsages that are ownedUsages of this Definition.
@@ -737,7 +752,10 @@ bool Systems.DefinitionAndUsage.IDefinition.IsVariation
737752
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_482273_43303", aggregation: AggregationKind.None, lowerValue: 0, upperValue: 1, isOrdered: false, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
738753
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
739754
[Implements(implementation: "IElement.OwningRelationship")]
740-
public IRelationship OwningRelationship { get; set; }
755+
public IRelationship OwningRelationship => ((IContainedElement)this).OwningRelationship;
756+
757+
/// <summary>Backing field for IElement.OwningRelationship</summary>
758+
IRelationship IContainedElement.OwningRelationship { get; set; }
741759

742760
/// <summary>
743761
/// The full ownership-qualified name of this Element, represented in a form that is valid according to

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/Feature.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace SysML2.NET.Core.POCO.Core.Features
3434
using SysML2.NET.Core.POCO.Root.Annotations;
3535
using SysML2.NET.Core.POCO.Root.Elements;
3636
using SysML2.NET.Core.POCO.Root.Namespaces;
37+
using SysML2.NET.Collections;
3738
using SysML2.NET.Decorators;
3839

3940
/// <summary>
@@ -56,8 +57,19 @@ namespace SysML2.NET.Core.POCO.Core.Features
5657
/// </summary>
5758
[Class(xmiId: "_18_5_3_12e503d9_1533160651684_893483_42160", isAbstract: false, isFinalSpecialization: false, isActive: false)]
5859
[GeneratedCode("SysML2.NET", "latest")]
59-
public partial class Feature : IFeature
60+
public partial class Feature : IFeature, IContainedElement
6061
{
62+
/// <summary>
63+
/// Initialize a new instance of <see cref="Feature" />
64+
/// </summary>
65+
public Feature()
66+
{
67+
((IContainedElement)this).OwnedRelationship = new ContainerList<IElement, IRelationship>(this,
68+
(relationship, element) => ((IContainedRelationship)relationship).OwningRelatedElement = element,
69+
relationship => relationship.OwningRelatedElement);
70+
71+
}
72+
6173
/// <summary>
6274
/// Gets or sets the unique identifier
6375
/// </summary>
@@ -578,7 +590,10 @@ public partial class Feature : IFeature
578590
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
579591
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
580592
[Implements(implementation: "IElement.OwnedRelationship")]
581-
public List<IRelationship> OwnedRelationship { get; set; } = [];
593+
public IReadOnlyCollection<IRelationship> OwnedRelationship => ((IContainedElement)this).OwnedRelationship;
594+
595+
/// <summary>Backing field for IElement.OwnedRelationship</summary>
596+
ContainerList<IElement, IRelationship> IContainedElement.OwnedRelationship { get; set; }
582597

583598
/// <summary>
584599
/// The ownedRelationships of this Type that are Specializations, for which the Type is the specific
@@ -669,7 +684,10 @@ public partial class Feature : IFeature
669684
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_482273_43303", aggregation: AggregationKind.None, lowerValue: 0, upperValue: 1, isOrdered: false, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
670685
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
671686
[Implements(implementation: "IElement.OwningRelationship")]
672-
public IRelationship OwningRelationship { get; set; }
687+
public IRelationship OwningRelationship => ((IContainedElement)this).OwningRelationship;
688+
689+
/// <summary>Backing field for IElement.OwningRelationship</summary>
690+
IRelationship IContainedElement.OwningRelationship { get; set; }
673691

674692
/// <summary>
675693
/// The Type that is the owningType of the owningFeatureMembership of this Feature.

0 commit comments

Comments
 (0)