Skip to content

Commit db36811

Browse files
[WIP] All Assignment cases supported in multiple alternatives
1 parent 64d946e commit db36811

27 files changed

+544
-157
lines changed

SysML2.NET.CodeGenerator/HandleBarHelpers/RulesHelper.cs

Lines changed: 239 additions & 113 deletions
Large diffs are not rendered by default.

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssertConstraintUsageTextualNotationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void BuildAssertConstraintUsage(SysML2.NET.Core.POCO.Systems.Const
4848

4949
if (poco.IsNegated)
5050
{
51-
stringBuilder.Append("not");
51+
stringBuilder.Append(" not ");
5252
stringBuilder.Append(' ');
5353
}
5454

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ClassifierTextualNotationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static void BuildClassifierDeclaration(SysML2.NET.Core.POCO.Core.Classifi
7676

7777
if (poco.IsSufficient)
7878
{
79-
stringBuilder.Append("all");
79+
stringBuilder.Append(" all ");
8080
stringBuilder.Append(' ');
8181
}
8282

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DecisionNodeTextualNotationBuilder.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public static partial class DecisionNodeTextualNotationBuilder
4343
public static void BuildDecisionNode(SysML2.NET.Core.POCO.Systems.Actions.IDecisionNode poco, StringBuilder stringBuilder)
4444
{
4545
OccurrenceUsageTextualNotationBuilder.BuildControlNodePrefix(poco, stringBuilder);
46-
stringBuilder.Append("decide");
46+
if (poco.IsComposite)
47+
{
48+
stringBuilder.Append(" decide ");
49+
}
4750
UsageTextualNotationBuilder.BuildUsageDeclaration(poco, stringBuilder);
4851
TypeTextualNotationBuilder.BuildActionBody(poco, stringBuilder);
4952

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DefinitionTextualNotationBuilder.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,15 @@ public static void BuildDefinitionExtensionKeyword(SysML2.NET.Core.POCO.Systems.
6060
/// <param name="stringBuilder">The <see cref="StringBuilder" /> that contains the entire textual notation</param>
6161
public static void BuildDefinitionPrefix(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition poco, StringBuilder stringBuilder)
6262
{
63-
throw new System.NotSupportedException("Multiple alternatives with only AssignmentElement not implemented yet");
63+
if (poco.IsAbstract)
64+
{
65+
stringBuilder.Append(" abstract ");
66+
}
67+
else if (poco.IsVariation)
68+
{
69+
stringBuilder.Append(" variation ");
70+
}
71+
6472
BuildDefinitionExtensionKeyword(poco, stringBuilder);
6573

6674
}
@@ -86,7 +94,15 @@ public static void BuildDefinitionDeclaration(SysML2.NET.Core.POCO.Systems.Defin
8694
/// <param name="stringBuilder">The <see cref="StringBuilder" /> that contains the entire textual notation</param>
8795
public static void BuildExtendedDefinition(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition poco, StringBuilder stringBuilder)
8896
{
89-
throw new System.NotSupportedException("Multiple alternatives with only AssignmentElement not implemented yet");
97+
if (poco.IsAbstract)
98+
{
99+
stringBuilder.Append(" abstract ");
100+
}
101+
else if (poco.IsVariation)
102+
{
103+
stringBuilder.Append(" variation ");
104+
}
105+
90106
BuildDefinitionExtensionKeyword(poco, stringBuilder);
91107
stringBuilder.Append("def ");
92108
BuildDefinition(poco, stringBuilder);

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DifferencingTextualNotationBuilder.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,21 @@ public static partial class DifferencingTextualNotationBuilder
4242
/// <param name="stringBuilder">The <see cref="StringBuilder" /> that contains the entire textual notation</param>
4343
public static void BuildDifferencing(SysML2.NET.Core.POCO.Core.Types.IDifferencing poco, StringBuilder stringBuilder)
4444
{
45-
throw new System.NotSupportedException("Multiple alternatives with only AssignmentElement not implemented yet");
45+
using var ownedRelatedElementOfFeatureIterator = poco.OwnedRelatedElement.OfType<SysML2.NET.Core.POCO.Core.Features.Feature>().GetEnumerator();
46+
if (poco.DifferencingType != null)
47+
{
48+
stringBuilder.Append(poco.DifferencingType.qualifiedName);
49+
stringBuilder.Append(' ');
50+
}
51+
else if (ownedRelatedElementOfFeatureIterator.MoveNext())
52+
{
53+
54+
if (ownedRelatedElementOfFeatureIterator.Current != null)
55+
{
56+
FeatureTextualNotationBuilder.BuildOwnedFeatureChain(ownedRelatedElementOfFeatureIterator.Current, stringBuilder);
57+
}
58+
}
59+
4660
}
4761
}
4862
}

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureTextualNotationBuilder.cs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,15 @@ public static void BuildEndFeaturePrefix(SysML2.NET.Core.POCO.Core.Features.IFea
462462

463463
if (poco.IsConstant)
464464
{
465-
stringBuilder.Append("const");
465+
stringBuilder.Append(" const ");
466466
// NonParsing Assignment Element : isVariable = true => Does not have to be process
467467
stringBuilder.Append(' ');
468468
}
469469

470-
stringBuilder.Append("end");
470+
if (poco.IsEnd)
471+
{
472+
stringBuilder.Append(" end ");
473+
}
471474

472475
}
473476

@@ -489,18 +492,26 @@ public static void BuildBasicFeaturePrefix(SysML2.NET.Core.POCO.Core.Features.IF
489492

490493
if (poco.IsDerived)
491494
{
492-
stringBuilder.Append("derived");
495+
stringBuilder.Append(" derived ");
493496
stringBuilder.Append(' ');
494497
}
495498

496499

497500
if (poco.IsAbstract)
498501
{
499-
stringBuilder.Append("abstract");
502+
stringBuilder.Append(" abstract ");
500503
stringBuilder.Append(' ');
501504
}
502505

503-
throw new System.NotSupportedException("Multiple alternatives with only AssignmentElement not implemented yet");
506+
if (poco.IsComposite)
507+
{
508+
stringBuilder.Append(" composite ");
509+
}
510+
else if (poco.IsPortion)
511+
{
512+
stringBuilder.Append(" portion ");
513+
}
514+
504515
throw new System.NotSupportedException("Multiple alternatives not implemented yet");
505516

506517
}
@@ -516,7 +527,7 @@ public static void BuildFeatureDeclaration(SysML2.NET.Core.POCO.Core.Features.IF
516527

517528
if (poco.IsSufficient)
518529
{
519-
stringBuilder.Append("all");
530+
stringBuilder.Append(" all ");
520531
stringBuilder.Append(' ');
521532
}
522533

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ForkNodeTextualNotationBuilder.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public static partial class ForkNodeTextualNotationBuilder
4343
public static void BuildForkNode(SysML2.NET.Core.POCO.Systems.Actions.IForkNode poco, StringBuilder stringBuilder)
4444
{
4545
OccurrenceUsageTextualNotationBuilder.BuildControlNodePrefix(poco, stringBuilder);
46-
stringBuilder.Append("fork");
46+
if (poco.IsComposite)
47+
{
48+
stringBuilder.Append(" fork ");
49+
}
4750
UsageTextualNotationBuilder.BuildUsageDeclaration(poco, stringBuilder);
4851
TypeTextualNotationBuilder.BuildActionBody(poco, stringBuilder);
4952

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ImportTextualNotationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static void BuildImport(SysML2.NET.Core.POCO.Root.Namespaces.IImport poco
6767

6868
if (poco.IsImportAll)
6969
{
70-
stringBuilder.Append("all");
70+
stringBuilder.Append(" all ");
7171
stringBuilder.Append(' ');
7272
}
7373

SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IntersectingTextualNotationBuilder.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,21 @@ public static partial class IntersectingTextualNotationBuilder
4242
/// <param name="stringBuilder">The <see cref="StringBuilder" /> that contains the entire textual notation</param>
4343
public static void BuildIntersecting(SysML2.NET.Core.POCO.Core.Types.IIntersecting poco, StringBuilder stringBuilder)
4444
{
45-
throw new System.NotSupportedException("Multiple alternatives with only AssignmentElement not implemented yet");
45+
using var ownedRelatedElementOfFeatureIterator = poco.OwnedRelatedElement.OfType<SysML2.NET.Core.POCO.Core.Features.Feature>().GetEnumerator();
46+
if (poco.IntersectingType != null)
47+
{
48+
stringBuilder.Append(poco.IntersectingType.qualifiedName);
49+
stringBuilder.Append(' ');
50+
}
51+
else if (ownedRelatedElementOfFeatureIterator.MoveNext())
52+
{
53+
54+
if (ownedRelatedElementOfFeatureIterator.Current != null)
55+
{
56+
FeatureTextualNotationBuilder.BuildOwnedFeatureChain(ownedRelatedElementOfFeatureIterator.Current, stringBuilder);
57+
}
58+
}
59+
4660
}
4761
}
4862
}

0 commit comments

Comments
 (0)