Skip to content

Commit 1ab7bbc

Browse files
[WIP] : i tseams that the redefinition/subset mechanisms is broken and needs to be fixed again. The old state was producing infinite loop. For now, the redefinition mechanism is broken and had to be restored. Ownership guard is ok but most of changes on the PropertyHelper.cs breaks UML redefintion rules. Following task is to revert those change to be on a UML strict redefintiion rule but update extend implemenation to not enter into infinite loop
1 parent 5f6c111 commit 1ab7bbc

195 files changed

Lines changed: 1403 additions & 1016 deletions

File tree

Some content is hidden

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

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenExtensions/ElementExtensions.cs

Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -117,43 +117,24 @@ public static bool QueryIsValidContainmentOwner(this IRelationship bridgeRelatio
117117
{
118118
return bridgeRelationship switch
119119
{
120-
SysML2.NET.Core.POCO.Systems.Requirements.IActorMembership => source is SysML2.NET.Core.POCO.Systems.Parts.IPartUsage,
121-
SysML2.NET.Core.POCO.Systems.Requirements.IFramedConcernMembership => source is SysML2.NET.Core.POCO.Systems.Requirements.IConcernUsage,
122-
SysML2.NET.Core.POCO.Systems.VerificationCases.IRequirementVerificationMembership => source is SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage,
123-
SysML2.NET.Core.POCO.Systems.Requirements.IStakeholderMembership => source is SysML2.NET.Core.POCO.Systems.Parts.IPartUsage,
124-
SysML2.NET.Core.POCO.Systems.Requirements.ISubjectMembership => source is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage,
125-
SysML2.NET.Core.POCO.Kernel.Associations.IAssociation => source is SysML2.NET.Core.POCO.Core.Types.IType,
126-
SysML2.NET.Core.POCO.Kernel.Connectors.IConnector => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
127-
SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
128-
SysML2.NET.Core.POCO.Systems.Cases.IObjectiveMembership => source is SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage,
129-
SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
130-
SysML2.NET.Core.POCO.Systems.Requirements.IRequirementConstraintMembership => source is SysML2.NET.Core.POCO.Systems.Constraints.IConstraintUsage,
131-
SysML2.NET.Core.POCO.Kernel.Functions.IResultExpressionMembership => source is SysML2.NET.Core.POCO.Kernel.Functions.IExpression,
132-
SysML2.NET.Core.POCO.Systems.States.IStateSubactionMembership => source is SysML2.NET.Core.POCO.Systems.Actions.IActionUsage,
133-
SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership => source is SysML2.NET.Core.POCO.Kernel.Behaviors.IStep,
134-
SysML2.NET.Core.POCO.Systems.Views.IViewRenderingMembership => source is SysML2.NET.Core.POCO.Systems.Views.IRenderingUsage,
135-
SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortTyping => source is SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortDefinition,
136120
SysML2.NET.Core.POCO.Core.Features.ICrossSubsetting => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
137-
SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership => source is SysML2.NET.Core.POCO.Kernel.Functions.IExpression,
138-
SysML2.NET.Core.POCO.Core.Types.IFeatureMembership => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
139-
SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue => source is SysML2.NET.Core.POCO.Kernel.Functions.IExpression,
140-
SysML2.NET.Core.POCO.Core.Features.IRedefinition => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
121+
SysML2.NET.Core.POCO.Core.Types.IFeatureMembership => source is SysML2.NET.Core.POCO.Core.Types.IType,
122+
SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
141123
SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
142-
SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IVariantMembership => source is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage,
143-
SysML2.NET.Core.POCO.Core.Features.IFeatureTyping => source is SysML2.NET.Core.POCO.Core.Types.IType,
144-
SysML2.NET.Core.POCO.Root.Namespaces.IMembershipImport => source is SysML2.NET.Core.POCO.Root.Namespaces.IMembership,
145-
SysML2.NET.Core.POCO.Root.Namespaces.INamespaceImport => source is SysML2.NET.Core.POCO.Root.Namespaces.INamespace,
146-
SysML2.NET.Core.POCO.Systems.Ports.IPortConjugation => source is SysML2.NET.Core.POCO.Systems.Ports.IPortDefinition,
124+
SysML2.NET.Core.POCO.Core.Features.IFeatureTyping => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
125+
SysML2.NET.Core.POCO.Systems.Ports.IPortConjugation => source is SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortDefinition,
147126
SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification => source is SysML2.NET.Core.POCO.Core.Classifiers.IClassifier,
148127
SysML2.NET.Core.POCO.Core.Features.ISubsetting => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
149128
SysML2.NET.Core.POCO.Core.Types.IConjugation => source is SysML2.NET.Core.POCO.Core.Types.IType,
150129
SysML2.NET.Core.POCO.Core.Types.IDifferencing => source is SysML2.NET.Core.POCO.Core.Types.IType,
151130
SysML2.NET.Core.POCO.Core.Types.IDisjoining => source is SysML2.NET.Core.POCO.Core.Types.IType,
152131
SysML2.NET.Core.POCO.Core.Features.IFeatureChaining => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
153132
SysML2.NET.Core.POCO.Core.Features.IFeatureInverting => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
133+
SysML2.NET.Core.POCO.Root.Namespaces.IImport => source is SysML2.NET.Core.POCO.Root.Namespaces.INamespace,
154134
SysML2.NET.Core.POCO.Core.Types.IIntersecting => source is SysML2.NET.Core.POCO.Core.Types.IType,
135+
SysML2.NET.Core.POCO.Root.Namespaces.IMembership => source is SysML2.NET.Core.POCO.Root.Namespaces.INamespace,
155136
SysML2.NET.Core.POCO.Core.Types.ISpecialization => source is SysML2.NET.Core.POCO.Core.Types.IType,
156-
SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing => source is SysML2.NET.Core.POCO.Core.Types.IType,
137+
SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing => source is SysML2.NET.Core.POCO.Core.Features.IFeature,
157138
SysML2.NET.Core.POCO.Core.Types.IUnioning => source is SysML2.NET.Core.POCO.Core.Types.IType,
158139
_ => true,
159140
};
@@ -170,43 +151,24 @@ public static string ExpectedContainmentOwnerTypeName(this IRelationship bridgeR
170151
{
171152
return bridgeRelationship switch
172153
{
173-
SysML2.NET.Core.POCO.Systems.Requirements.IActorMembership => nameof(SysML2.NET.Core.POCO.Systems.Parts.IPartUsage),
174-
SysML2.NET.Core.POCO.Systems.Requirements.IFramedConcernMembership => nameof(SysML2.NET.Core.POCO.Systems.Requirements.IConcernUsage),
175-
SysML2.NET.Core.POCO.Systems.VerificationCases.IRequirementVerificationMembership => nameof(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage),
176-
SysML2.NET.Core.POCO.Systems.Requirements.IStakeholderMembership => nameof(SysML2.NET.Core.POCO.Systems.Parts.IPartUsage),
177-
SysML2.NET.Core.POCO.Systems.Requirements.ISubjectMembership => nameof(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage),
178-
SysML2.NET.Core.POCO.Kernel.Associations.IAssociation => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
179-
SysML2.NET.Core.POCO.Kernel.Connectors.IConnector => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
180-
SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
181-
SysML2.NET.Core.POCO.Systems.Cases.IObjectiveMembership => nameof(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage),
182-
SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
183-
SysML2.NET.Core.POCO.Systems.Requirements.IRequirementConstraintMembership => nameof(SysML2.NET.Core.POCO.Systems.Constraints.IConstraintUsage),
184-
SysML2.NET.Core.POCO.Kernel.Functions.IResultExpressionMembership => nameof(SysML2.NET.Core.POCO.Kernel.Functions.IExpression),
185-
SysML2.NET.Core.POCO.Systems.States.IStateSubactionMembership => nameof(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage),
186-
SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership => nameof(SysML2.NET.Core.POCO.Kernel.Behaviors.IStep),
187-
SysML2.NET.Core.POCO.Systems.Views.IViewRenderingMembership => nameof(SysML2.NET.Core.POCO.Systems.Views.IRenderingUsage),
188-
SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortTyping => nameof(SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortDefinition),
189154
SysML2.NET.Core.POCO.Core.Features.ICrossSubsetting => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
190-
SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership => nameof(SysML2.NET.Core.POCO.Kernel.Functions.IExpression),
191-
SysML2.NET.Core.POCO.Core.Types.IFeatureMembership => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
192-
SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue => nameof(SysML2.NET.Core.POCO.Kernel.Functions.IExpression),
193-
SysML2.NET.Core.POCO.Core.Features.IRedefinition => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
155+
SysML2.NET.Core.POCO.Core.Types.IFeatureMembership => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
156+
SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
194157
SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
195-
SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IVariantMembership => nameof(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage),
196-
SysML2.NET.Core.POCO.Core.Features.IFeatureTyping => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
197-
SysML2.NET.Core.POCO.Root.Namespaces.IMembershipImport => nameof(SysML2.NET.Core.POCO.Root.Namespaces.IMembership),
198-
SysML2.NET.Core.POCO.Root.Namespaces.INamespaceImport => nameof(SysML2.NET.Core.POCO.Root.Namespaces.INamespace),
199-
SysML2.NET.Core.POCO.Systems.Ports.IPortConjugation => nameof(SysML2.NET.Core.POCO.Systems.Ports.IPortDefinition),
158+
SysML2.NET.Core.POCO.Core.Features.IFeatureTyping => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
159+
SysML2.NET.Core.POCO.Systems.Ports.IPortConjugation => nameof(SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortDefinition),
200160
SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification => nameof(SysML2.NET.Core.POCO.Core.Classifiers.IClassifier),
201161
SysML2.NET.Core.POCO.Core.Features.ISubsetting => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
202162
SysML2.NET.Core.POCO.Core.Types.IConjugation => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
203163
SysML2.NET.Core.POCO.Core.Types.IDifferencing => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
204164
SysML2.NET.Core.POCO.Core.Types.IDisjoining => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
205165
SysML2.NET.Core.POCO.Core.Features.IFeatureChaining => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
206166
SysML2.NET.Core.POCO.Core.Features.IFeatureInverting => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
167+
SysML2.NET.Core.POCO.Root.Namespaces.IImport => nameof(SysML2.NET.Core.POCO.Root.Namespaces.INamespace),
207168
SysML2.NET.Core.POCO.Core.Types.IIntersecting => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
169+
SysML2.NET.Core.POCO.Root.Namespaces.IMembership => nameof(SysML2.NET.Core.POCO.Root.Namespaces.INamespace),
208170
SysML2.NET.Core.POCO.Core.Types.ISpecialization => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
209-
SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
171+
SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing => nameof(SysML2.NET.Core.POCO.Core.Features.IFeature),
210172
SysML2.NET.Core.POCO.Core.Types.IUnioning => nameof(SysML2.NET.Core.POCO.Core.Types.IType),
211173
_ => nameof(IElement),
212174
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public Association()
150150
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674959_326391_43166")]
151151
[RedefinedByProperty("IAssociation.AssociationEnd")]
152152
[Implements(implementation: "IType.EndFeature")]
153-
List<IFeature> Core.Types.IType.endFeature => [.. this.associationEnd];
153+
List<IFeature> Core.Types.IType.endFeature => this.ComputeEndFeature();
154154

155155
/// <summary>
156156
/// The ownedMemberFeatures of the featureMemberships of this Type.
@@ -542,7 +542,7 @@ public Association()
542542
[Property(xmiId: "_18_5_3_12e503d9_1533160674961_132339_43177", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: true, isDerivedUnion: false, isUnique: false, defaultValue: null)]
543543
[RedefinedByProperty("IAssociation.RelatedType")]
544544
[Implements(implementation: "IRelationship.RelatedElement")]
545-
List<IElement> Root.Elements.IRelationship.relatedElement => [.. this.relatedType];
545+
List<IElement> Root.Elements.IRelationship.relatedElement => this.ComputeRelatedElement();
546546

547547
/// <summary>
548548
/// The types of the associationEnds of the Association, which are the relatedElements of the

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ bool Systems.DefinitionAndUsage.IDefinition.IsVariation
819819
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674979_259543_43268")]
820820
[RedefinedByProperty("IEnumerationDefinition.EnumeratedValue")]
821821
[Implements(implementation: "IDefinition.Variant")]
822-
List<IUsage> Systems.DefinitionAndUsage.IDefinition.variant => [.. this.enumeratedValue];
822+
List<IUsage> Systems.DefinitionAndUsage.IDefinition.variant => this.ComputeVariant();
823823

824824
/// <summary>
825825
/// The ownedMemberships of this Definition that are VariantMemberships. If isVariation = true, then

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ IType Core.Types.ISpecialization.General
266266
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674982_253967_43281")]
267267
[RedefinedByProperty("IFeatureTyping.OwningFeature")]
268268
[Implements(implementation: "ISpecialization.OwningType")]
269-
IType Core.Types.ISpecialization.owningType => this.owningFeature;
269+
IType Core.Types.ISpecialization.owningType => this.ComputeOwningType();
270270

271271
/// <summary>
272272
/// 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/Flow.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public Flow()
8787
[RedefinedProperty(propertyName: "_18_5_3_12e503d9_1533160674969_376003_43216")]
8888
[RedefinedByProperty("IFlow.Interaction")]
8989
[Implements(implementation: "IConnector.Association")]
90-
List<IAssociation> Kernel.Connectors.IConnector.association => [.. this.interaction];
90+
List<IAssociation> Kernel.Connectors.IConnector.association => this.ComputeAssociation();
9191

9292
/// <summary>
9393
/// The Behaviors that type this Step.
@@ -96,7 +96,7 @@ public Flow()
9696
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674969_376003_43216")]
9797
[RedefinedByProperty("IFlow.Interaction")]
9898
[Implements(implementation: "IStep.Behavior")]
99-
List<IBehavior> Kernel.Behaviors.IStep.behavior => [.. this.interaction];
99+
List<IBehavior> Kernel.Behaviors.IStep.behavior => this.ComputeBehavior();
100100

101101
/// <summary>
102102
/// The Feature that are chained together to determine the values of this Feature, derived from the
@@ -176,7 +176,7 @@ public Flow()
176176
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674959_326391_43166")]
177177
[RedefinedByProperty("IStep.Parameter")]
178178
[Implements(implementation: "IType.DirectedFeature")]
179-
List<IFeature> Core.Types.IType.directedFeature => [.. this.parameter];
179+
List<IFeature> Core.Types.IType.directedFeature => this.ComputeDirectedFeature();
180180

181181
/// <summary>
182182
/// Indicates how values of this Feature are determined or used (as specified for the
@@ -210,7 +210,7 @@ public Flow()
210210
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674959_326391_43166")]
211211
[RedefinedByProperty("IConnector.ConnectorEnd")]
212212
[Implements(implementation: "IType.EndFeature")]
213-
List<IFeature> Core.Types.IType.endFeature => [.. this.connectorEnd];
213+
List<IFeature> Core.Types.IType.endFeature => this.ComputeEndFeature();
214214

215215
/// <summary>
216216
/// The Type that is related to this Feature by an EndFeatureMembership in which the Feature is an
@@ -825,7 +825,7 @@ public Flow()
825825
[Property(xmiId: "_18_5_3_12e503d9_1533160674961_132339_43177", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: true, isDerivedUnion: false, isUnique: false, defaultValue: null)]
826826
[RedefinedByProperty("IConnector.RelatedFeature")]
827827
[Implements(implementation: "IRelationship.RelatedElement")]
828-
List<IElement> Root.Elements.IRelationship.relatedElement => [.. this.relatedFeature];
828+
List<IElement> Root.Elements.IRelationship.relatedElement => this.ComputeRelatedElement();
829829

830830
/// <summary>
831831
/// The Features that are related by this Connector considered as a Relationship and that restrict the
@@ -925,7 +925,7 @@ List<IElement> Root.Elements.IRelationship.Target
925925
[Property(xmiId: "_18_5_3_12e503d9_1533160674969_376003_43216", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: true, isDerivedUnion: false, isUnique: true, defaultValue: null)]
926926
[RedefinedByProperty("IConnector.Association")]
927927
[Implements(implementation: "IFeature.Type")]
928-
List<IType> Core.Features.IFeature.type => [.. ((SysML2.NET.Core.POCO.Kernel.Connectors.IConnector)this).association];
928+
List<IType> Core.Features.IFeature.type => this.ComputeType();
929929

930930
/// <summary>
931931
/// The interpretations of a Type with unioningTypes are asserted to be the same as those of all the

0 commit comments

Comments
 (0)