diff --git a/CLAUDE.md b/CLAUDE.md index af2fe8f9..a8c8ac9d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -35,6 +35,7 @@ Test framework: **NUnit**. Test classes use `[TestFixture]` and `[Test]` attribu - favour duplicated code in codegeneration to have staticaly defined methods that provide performance over reflection based code. - code generation is done by processing the UML model and creating handlebars templates +- **When working on the grammar/textual notation code generator** (`SysML2.NET.CodeGenerator/HandleBarHelpers/RulesHelper.cs` and related grammar processing): read `SysML2.NET.CodeGenerator/GRAMMAR.md` for the KEBNF grammar model, cursor/builder conventions, and code-gen patterns already handled. ### Code Generation Pipeline @@ -118,3 +119,4 @@ Auto-generated DTOs use structured namespaces reflecting the KerML/SysML package - Prefer switch expressions/statements over if-else chains when applicable - Prefer indexer syntax (e.g., 'list[^1]') and range syntax (e.g., 'array[1..^1]') over LINQ methods (e.g., 'list.Last()', 'list.Skip(1).Take(n)') when applicable - Use meaningful variable names instead of single-letter names in any context (e.g., 'charIndex' instead of 'i', 'currentChar' instead of 'c', 'element' instead of 'e') +- Use 'NotSupportedException' (not 'NotImplementedException') for placeholder/stub methods that require manual implementation diff --git a/Resources/KerML-textual-bnf.kebnf b/Resources/KerML-textual-bnf.kebnf new file mode 100644 index 00000000..2837bcfd --- /dev/null +++ b/Resources/KerML-textual-bnf.kebnf @@ -0,0 +1,1467 @@ +// Manual corrections by HP de Koning + +// Part 1 - Kernel Modeling Language (KerML) + +// Clause 8.2 Concrete Syntax + +// Clause 8.2.1 Concrete Syntax Overview + +// Clause 8.2.2 Lexical Structure + +// Clause 8.2.2.1 Line Terminators and White Space + +LINE_TERMINATOR = + '\n' | '\r' | '\r\n' +// implementation defined character sequence + +LINE_TEXT = + '[^\r\n]*' +// character sequence excluding LINE_TERMINATORs + +WHITE_SPACE = + ' ' | '\t' | '\f' | LINE_TERMINATOR +// space | tab | form_feed | LINE_TERMINATOR + +// Notes: +// 1. Notation text is divided up into lines separated by line terminators. A line terminator may be a single character (such as a line feed) or a sequence of characters (such as a carriage return/line feed combination). This specification does not require any specific encoding for a line terminator, but any encoding used must be consistent throughout any specific input text. +// 2. Any characters in text line that are not a part of the line terminator are referred to as line text. +// 3. A white space character is a space, tab, form feed or line terminator. Any contiguous sequence of white space characters can be used to separate tokens that would otherwise be considered to be part of a single token. It is otherwise ignored, with the single exception that a line terminator is used to mark the end of a single-line note (see 8.2.2.2). + +// Clause 8.2.2.2 Notes and Comments + +SINGLE_LINE_NOTE = + '//' LINE_TEXT + +MULTILINE_NOTE = + '//*' COMMENT_TEXT '*/' + +REGULAR_COMMENT = + '/*' COMMENT_TEXT '*/' + +COMMENT_TEXT = + ( COMMENT_LINE_TEXT | LINE_TERMINATOR )* + +COMMENT_LINE_TEXT = + '.*(?=(\r|\n|\*/))' +// LINE_TEXT excluding the sequence '*/' + +// Clause 8.2.2.3 Names + +NAME = + BASIC_NAME | UNRESTRICTED_NAME + +BASIC_NAME = + BASIC_INITIAL_CHARACTER BASIC_NAME_CHARACTER* + +SINGLE_QUOTE = + '#x27' + +UNRESTRICTED_NAME = + SINGLE_QUOTE ( NAME_CHARACTER | ESCAPE_SEQUENCE )* SINGLE_QUOTE + +// (See Note 1) + +BASIC_INITIAL_CHARACTER = + ALPHABETIC_CHARACTER | '_' + +BASIC_NAME_CHARACTER = + BASIC_INITIAL_CHARACTER | DECIMAL_DIGIT + +ALPHABETIC_CHARACTER = + 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | + 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' +// any character 'a' through 'z' or 'A' through 'Z' + +DECIMAL_DIGIT = + '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' + +NAME_CHARACTER = + 'any printable character other than backslash or single_quote' + +ESCAPE_SEQUENCE = + '\f' | '\n' | '\t' | '\r' | '\v' +// (See Note 2) + +// Notes: +// 1. The single_quote character is '. The name represented by an UNRESTRICTED_NAME shall consist of the characters within the single quotes, with escape characters resolved as described below. The surrounding single quote characters are not part of the represented name. +// 2. An ESCAPE_SEQUENCE is a sequence of two text characters starting with a backslash that actually denotes only a single character, except for the newline escape sequence, which represents however many characters is necessary to represent an end of line in a specific implementation (see also 8.2.2.1). Table 4 shows the meaning of the allowed escape sequences. The ESCAPE_SEQUENCES in an UNRESTRICTED_NAME shall be replaced by the characters specified as their meanings in the actual represented name. + +// Clause 8.2.2.4 Numeric Values + +DECIMAL_VALUE = + DECIMAL_DIGIT+ + +EXPONENTIAL_VALUE = + DECIMAL_VALUE ('e' | 'E') ('+' | '-')? DECIMAL_VALUE + +// Notes: +// 1. A DECIMAL_VALUE may specify a natural literal, or it may be part of the specification of a real literal (see 8.2.5.8.4). Note that a DECIMAL_VALUE does not include a sign, because negating a literal is an operator in the KerML Expression syntax. +// 2. An EXPONENTIAL_VALUE may be used in the specification of a real literal (see 8.2.5.8.4). Note that a decimal point and fractional part are not included in the lexical structure of an exponential value. They are handled as part of the syntax of real literals. + +// Clause 8.2.2.5 String Value + +STRING_VALUE = + '"' ( STRING_CHARACTER | ESCAPE_SEQUENCE )* '"' + +STRING_CHARACTER = + 'any printable character other than backslash or "' + +// Notes: +// 1. ESCAPE_SEQUENCE is specified in 8.2.2.3. + +// Clause 8.2.2.6 Reserved Words + +RESERVED_KEYWORD = + 'about' | 'abstract' | 'alias' | 'all' | 'and' | 'as' | 'assoc' | 'behavior' | 'binding' | 'bool' | 'by' | 'chains' + | 'class' | 'classifier' | 'comment' | 'composite' | 'conjugate' | 'conjugates' | 'conjugation' | 'connector' + | 'const' | 'crosses' | 'datatype' | 'default' | 'dependency' | 'derived' | 'differences' | 'disjoining' | 'disjoint' + | 'doc' | 'else' | 'end' | 'expr' | 'false' | 'feature' | 'featured' | 'featuring' | 'filter' | 'first' | 'flow' + | 'for' | 'from' | 'function' | 'hastype' | 'if' | 'implies' | 'import' | 'in' | 'inout' | 'interaction' + | 'intersects' | 'inv' | 'inverse' | 'inverting' | 'istype' | 'language' | 'library' | 'locale' | 'member' | 'meta' + | 'metaclass' | 'metadata' | 'multiplicity' | 'namespace' | 'nonunique' | 'not' | 'null' | 'of' | 'or' | 'ordered' + | 'out' | 'package' | 'portion' | 'predicate' | 'private' | 'protected' | 'public' | 'redefines' | 'redefinition' + | 'references' | 'rep' | 'return' | 'specialization' | 'specializes' | 'standard' | 'step' | 'struct' + | 'subclassifier' | 'subset' | 'subsets' | 'subtype' | 'succession' | 'then' | 'to' | 'true' | 'type' | 'typed' + | 'typing' | 'unions' | 'var' | 'xor' + +// Clause 8.2.2.7 Symbols + +RESERVED_SYMBOL = + '~' | '}' | '|' | '{' | '^' | ']' | '[' | '@' | '??' | '?' | '>=' | '>' | '=>' | '===' | '==' | '=' | '<=' | '<' + | ';' | ':>>' | ':>' | ':=' | '::>' | '::' | ':' | '/' | '.?' | '..' | '.' | '->' | '-' | ',' | '+' | '**' | '*' | ')' + | '(' | '&' | '%' | '$' | '#' | '!==' | '!=' + +TYPED_BY = ':' | 'typed' 'by' + +SPECIALIZES = ':>' | 'specializes' + +SUBSETS = ':>' | 'subsets' + +REFERENCES = '::>' | 'references' + +CROSSES = '=>' | 'crosses' + +REDEFINES = ':>>' | 'redefines' + +CONJUGATES = '~' | 'conjugates' + +// Clause 8.2.3 Root Concrete Syntax + +// Clause 8.2.3.1 Elements and Relationships Concrete Syntax + +Identification : Element = + ( '<' declaredShortName = NAME '>' )? + ( declaredName = NAME )? + +RelationshipBody : Relationship = + ';' | '{' RelationshipOwnedElement* '}' + +RelationshipOwnedElement : Relationship = + ownedRelatedElement += OwnedRelatedElement + | ownedRelationship += OwnedAnnotation + +OwnedRelatedElement : Element = + NonFeatureElement | FeatureElement + +// Clause 8.2.3.2 Dependencies Concrete Syntax + +Dependency = + ( ownedRelationship += PrefixMetadataAnnotation )* + 'dependency' ( Identification? 'from' )? + client += [QualifiedName] ( ',' client += [QualifiedName] )* 'to' + supplier += [QualifiedName] ( ',' supplier += [QualifiedName] )* + RelationshipBody + +// Notes: +// 1. PrefixMetadataAnnotation is defined in the Kernel layer (see 8.2.5.12). + +// Clause 8.2.3.3 Annotations Concrete Syntax + +// Clause 8.2.3.3.1 Annotations + +Annotation = + annotatedElement = [QualifiedName] + +OwnedAnnotation : Annotation = + ownedRelatedElement += AnnotatingElement + +AnnotatingElement = + Comment + | Documentation + | TextualRepresentation + | MetadataFeature + +// Notes: +// 1. MetadataFeature is defined in the Kernel layer (see 8.2.5.12). + +// Clause 8.2.3.3.2 Comments and Documentation + +Comment = + ( 'comment' Identification + ( 'about' ownedRelationship += Annotation + ( ',' ownedRelationship += Annotation )* + )? + )? + ( 'locale' locale = STRING_VALUE )? + body = REGULAR_COMMENT + +Documentation = + 'doc' Identification + ( 'locale' locale = STRING_VALUE )? + body = REGULAR_COMMENT + +// Notes: +// 1. The text of a lexical REGULAR_COMMENT or PREFIX_COMMENT shall be processed as follows before it is included as the body of a Comment or Documentation: +// • Remove the initial /* and final */ characters. +// • Remove any white space immediately after the initial /*, up to and including the first line terminator (if any). +// • On each subsequent line of the text: +// • Strip initial white space other than line terminators. +// • Then, if the first remaining character is "*", remove it. +// • Then, if the first remaining character is now a space, remove it. +// 2. The body text of a Comment can include markup information (such as HTML), and a conforming tool may display such text as rendered according to the markup. However, marked up "rich text" for a Comment written using the KerML textual concrete syntax shall be stored in the Comment body in plain text including all mark up text, with all line terminators and white space included as entered, other than what is removed according to the rules above. + +// Clause 8.2.3.3.3 Textual Representation + +TextualRepresentation = + ( 'rep' Identification )? + 'language' language = STRING_VALUE + body = REGULAR_COMMENT + +// Notes: +// 1. The lexical text of a REGULAR_COMMENT shall be processed as specified in 8.2.3.3.2 for Comments before being included as the body of a TextualRepresentation. +// 2. See also 8.3.2.3.6 on the standard language names recognized for a TextualRepresentation. + +// Clause 8.2.3.4 Namespaces Concrete Syntax + +// Clause 8.2.3.4.1 Namespaces + +RootNamespace : Namespace = + NamespaceBodyElement* + +// (See Note 1) + +Namespace = + ( ownedRelationship += PrefixMetadataMember )* + NamespaceDeclaration NamespaceBody + +// (See Note 2) + +NamespaceDeclaration : Namespace = + 'namespace' Identification + +NamespaceBody : Namespace = + ';' | '{' NamespaceBodyElement* '}' + +NamespaceBodyElement : Namespace = + ownedRelationship += NamespaceMember + | ownedRelationship += AliasMember + | ownedRelationship += Import + +MemberPrefix : Membership = + ( visibility = VisibilityIndicator )? + +VisibilityIndicator : VisibilityKind = + 'public' | 'private' | 'protected' + +NamespaceMember : OwningMembership = + NonFeatureMember + | NamespaceFeatureMember + +NonFeatureMember : OwningMembership = + MemberPrefix + ownedRelatedElement += MemberElement + +NamespaceFeatureMember : OwningMembership = + MemberPrefix + ownedRelatedElement += FeatureElement + +AliasMember : Membership = + MemberPrefix + 'alias' ( '<' memberShortName = NAME '>' )? + ( memberName = NAME )? + 'for' memberElement = [QualifiedName] + RelationshipBody + +QualifiedName = + ( '$' '::' )? ( NAME '::' )* NAME + +// (See Note 3) + +// Notes: +// 1. A root Namespace is a Namespace that has no owningNamespace (see 8.3.2.4). Every Element other than a root Namespace must be contained, directly or indirectly, within some root Namespace. Therefore, every valid KerML concrete syntax text can be parsed starting from the RootNamespace production. +// 2. PrefixMetadataMember is defined in the Kernel layer (see 8.2.5.12). +// 3. A qualified name is notated as a sequence of segment names separated by "::" punctuation, optionally with the global scope qualifier "$" as an initial segment. An unqualified name can be considered the degenerate case of a qualified name with a single segment name. A qualified name is used in the KerML textual concrete syntax to identify an Element that is being referred to in the representation of another Element. A qualified name used in this way does not appear in the corresponding abstract syntax—instead, the abstract syntax representation contains an actual reference to the identified Element. Name resolution is the process of determining the Element that is identified by a qualified name. The segment names of the qualified name other than the last identify a sequence of nested Namespaces that provide the context for resolving the final segment name (see 8.2.3.5). The notation [QualifiedName] is used in concrete syntax grammar productions to indicate the result of resolving text parsed as a QualifiedName (see also 8.2.1). + +// Clause 8.2.3.4.2 Imports + +Import = + visibility = VisibilityIndicator + 'import' ( isImportAll ?= 'all' )? + ImportDeclaration RelationshipBody + +ImportDeclaration : Import = + MembershipImport | NamespaceImport + +MembershipImport = + importedMembership = [QualifiedName] + ( '::' isRecursive ?= '**' )? + +// (See Note 1) + +NamespaceImport = + importedNamespace = [QualifiedName] '::' '*' + ( '::' isRecursive ?= '**' )? + | importedNamespace = FilterPackage + { ownedRelatedElement += importedNamespace } + +FilterPackage : Package = + ownedRelationship += ImportDeclaration + ( ownedRelationship += FilterPackageMember )+ + +FilterPackageMember : ElementFilterMembership = + '[' ownedRelatedElement += OwnedExpression ']' + +// Notes: +// 1. The importedMembership of a MembershipImport is the single case in which the Element required from the resolution [QualifiedName] is the actual Membership identified by the QualifedName, not the memberElement of that Membership (see 8.2.3.5). + +// Clause 8.2.3.4.3 Namespace Elements + +MemberElement : Element = + AnnotatingElement | NonFeatureElement + +NonFeatureElement : Element = + Dependency + | Namespace + | Type + | Classifier + | DataType + | Class + | Structure + | Metaclass + | Association + | AssociationStructure + | Interaction + | Behavior + | Function + | Predicate + | Multiplicity + | Package + | LibraryPackage + | Specialization + | Conjugation + | Subclassification + | Disjoining + | FeatureInverting + | FeatureTyping + | Subsetting + | Redefinition + | TypeFeaturing + +FeatureElement : Feature = + Feature + | Step + | Expression + | BooleanExpression + | Invariant + | Connector + | BindingConnector + | Succession + | Flow + | SuccessionFlow + +// Clause 8.2.3.5 Name Resolution + +// Clause 8.2.3.5.1 Name Resolution Overview + +// Clause 8.2.3.5.2 Local and Global Namespaces + +// Clause 8.2.3.5.3 Local and Visible Resolution + +// Clause 8.2.3.5.4 Full Resolution + +// Clause 8.2.4 Core Concrete Syntax + +// Clause 8.2.4.1 Types Concrete Syntax + +// Clause 8.2.4.1.1 Types + +Type = + TypePrefix 'type' + TypeDeclaration TypeBody + +TypePrefix : Type = + ( isAbstract ?= 'abstract' )? + ( ownedRelationship += PrefixMetadataMember )* + +TypeDeclaration : Type = + ( isSufficient ?= 'all' )? Identification + ( ownedRelationship += OwnedMultiplicity )? + ( SpecializationPart | ConjugationPart )+ + TypeRelationshipPart* + +SpecializationPart : Type = + SPECIALIZES ownedRelationship += OwnedSpecialization + ( ',' ownedRelationship += OwnedSpecialization )* + +ConjugationPart : Type = + CONJUGATES ownedRelationship += OwnedConjugation + +TypeRelationshipPart : Type = + DisjoiningPart + | UnioningPart + | IntersectingPart + | DifferencingPart + +DisjoiningPart : Type = + 'disjoint' 'from' ownedRelationship += OwnedDisjoining + ( ',' ownedRelationship += OwnedDisjoining )* + +UnioningPart : Type = + 'unions' ownedRelationship += Unioning + ( ',' ownedRelationship += Unioning )* + +IntersectingPart : Type = + 'intersects' ownedRelationship += Intersecting + ( ',' ownedRelationship += Intersecting )* + +DifferencingPart : Type = + 'differences' ownedRelationship += Differencing + ( ',' ownedRelationship += Differencing )* + +TypeBody : Type = + ';' | '{' TypeBodyElement* '}' + +TypeBodyElement : Type = + ownedRelationship += NonFeatureMember + | ownedRelationship += FeatureMember + | ownedRelationship += AliasMember + | ownedRelationship += Import + +// Clause 8.2.4.1.2 Specialization + +Specialization = + ( 'specialization' Identification )? + 'subtype' SpecificType + SPECIALIZES GeneralType + RelationshipBody + +OwnedSpecialization : Specialization = + GeneralType + +SpecificType : Specialization = + specific = [QualifiedName] + | specific += OwnedFeatureChain + { ownedRelatedElement += specific } + +GeneralType : Specialization = + general = [QualifiedName] + | general += OwnedFeatureChain + { ownedRelatedElement += general } + +// Clause 8.2.4.1.3 Conjugation + +Conjugation = + ( 'conjugation' Identification )? + 'conjugate' + ( conjugatedType = [QualifiedName] + | conjugatedType = FeatureChain + { ownedRelatedElement += conjugatedType } + ) + CONJUGATES + ( originalType = [QualifiedName] + | originalType = FeatureChain + { ownedRelatedElement += originalType } + ) + RelationshipBody + +OwnedConjugation : Conjugation = + originalType = [QualifiedName] + | originalType = FeatureChain + { ownedRelatedElement += originalType } + +// Clause 8.2.4.1.4 Disjoining + +Disjoining = + ( 'disjoining' Identification )? + 'disjoint' + ( typeDisjoined = [QualifiedName] + | typeDisjoined = FeatureChain + { ownedRelatedElement += typeDisjoined } + ) + 'from' + ( disjoiningType = [QualifiedName] + | disjoiningType = FeatureChain + { ownedRelatedElement += disjoiningType } + ) + RelationshipBody + +OwnedDisjoining : Disjoining = + disjoiningType = [QualifiedName] + | disjoiningType = FeatureChain + { ownedRelatedElement += disjoiningType } + +// Clause 8.2.4.1.5 Unioning, Intersecting and Differencing + +Unioning = + unioningType = [QualifiedName] + | ownedRelatedElement += OwnedFeatureChain + +Intersecting = + intersectingType = [QualifiedName] + | ownedRelatedElement += OwnedFeatureChain + +Differencing = + differencingType = [QualifiedName] + | ownedRelatedElement += OwnedFeatureChain + +// Clause 8.2.4.1.6 Feature Membership + +FeatureMember : OwningMembership = + TypeFeatureMember + | OwnedFeatureMember + +TypeFeatureMember : OwningMembership = + MemberPrefix 'member' ownedRelatedElement += FeatureElement + +OwnedFeatureMember : FeatureMembership = + MemberPrefix ownedRelatedElement += FeatureElement + +// Clause 8.2.4.2 Classifiers Concrete Syntax + +// Clause 8.2.4.2.1 Classifiers + +Classifier = + TypePrefix 'classifier' + ClassifierDeclaration TypeBody + +ClassifierDeclaration : Classifier = + ( isSufficient ?= 'all' )? Identification + ( ownedRelationship += OwnedMultiplicity )? + ( SuperclassingPart | ConjugationPart )? + TypeRelationshipPart* + +SuperclassingPart : Classifier = + SPECIALIZES ownedRelationship += OwnedSubclassification + ( ',' ownedRelationship += OwnedSubclassification )* + +// Clause 8.2.4.2.2 Subclassification + +Subclassification = + ( 'specialization' Identification )? + 'subclassifier' subclassifier = [QualifiedName] + SPECIALIZES superclassifier = [QualifiedName] + RelationshipBody + +OwnedSubclassification : Subclassification = + superclassifier = [QualifiedName] + +// Clause 8.2.4.3 Features Concrete Syntax + +// Clause 8.2.4.3.1 Features + +Feature = + ( FeaturePrefix + ( 'feature' | ownedRelationship += PrefixMetadataMember ) + FeatureDeclaration? + | ( EndFeaturePrefix | BasicFeaturePrefix ) + FeatureDeclaration + ) + ValuePart? TypeBody + +// (See Note 1) + +EndFeaturePrefix : Feature = + ( isConstant ?= 'const' { isVariable = true } )? + isEnd ?= 'end' + +BasicFeaturePrefix : Feature = + ( direction = FeatureDirection )? + ( isDerived ?= 'derived' )? + ( isAbstract ?= 'abstract' )? + ( isComposite ?= 'composite' | isPortion ?= 'portion' )? + ( isVariable ?= 'var' | isConstant ?= 'const' { isVariable = true } )? + +FeaturePrefix = + ( EndFeaturePrefix ( ownedRelationship += OwnedCrossFeatureMember )? + | BasicFeaturePrefix + ) + ( ownedRelationship += PrefixMetadataMember )* + +// (See Note 1) + +OwnedCrossFeatureMember : OwningMembership = + ownedRelatedElement += OwnedCrossFeature + +OwnedCrossFeature : Feature = + BasicFeaturePrefix FeatureDeclaration + +FeatureDirection : FeatureDirectionKind = + 'in' | 'out' | 'inout' + +FeatureDeclaration : Feature = + ( isSufficient ?= 'all' )? + ( FeatureIdentification + ( FeatureSpecializationPart | ConjugationPart )? + | FeatureSpecializationPart + | ConjugationPart + ) + FeatureRelationshipPart* + +FeatureIdentification : Feature = + '<' declaredShortName = NAME '>' ( declaredName = NAME )? + | declaredName = NAME + +FeatureRelationshipPart : Feature = + TypeRelationshipPart + | ChainingPart + | InvertingPart + | TypeFeaturingPart + +ChainingPart : Feature = + 'chains' + ( ownedRelationship += OwnedFeatureChaining + | FeatureChain ) + +InvertingPart : Feature = + 'inverse' 'of' ownedRelationship += OwnedFeatureInverting + +TypeFeaturingPart : Feature = + 'featured' 'by' ownedRelationship += OwnedTypeFeaturing + ( ',' ownedTypeFeaturing += OwnedTypeFeaturing )* + +FeatureSpecializationPart : Feature = + FeatureSpecialization+ MultiplicityPart? FeatureSpecialization* + | MultiplicityPart FeatureSpecialization* + +MultiplicityPart : Feature = + ownedRelationship += OwnedMultiplicity + | ( ownedRelationship += OwnedMultiplicity )? + ( isOrdered ?= 'ordered' ( {isUnique = false} 'nonunique' )? + | {isUnique = false} 'nonunique' ( isOrdered ?= 'ordered' )? ) + +FeatureSpecialization : Feature = + Typings | Subsettings | References | Crosses | Redefinitions + +Typings : Feature = + TypedBy ( ',' ownedRelationship += OwnedFeatureTyping )* + +TypedBy : Feature = + TYPED_BY ownedRelationship += OwnedFeatureTyping + +Subsettings : Feature = + Subsets ( ',' ownedRelationship += OwnedSubsetting )* + +Subsets : Feature = + SUBSETS ownedRelationship += OwnedSubsetting + +References : Feature = + REFERENCES ownedRelationship += OwnedReferenceSubsetting + +Crosses : Feature = + CROSSES ownedRelationship += OwnedCrossSubsetting + +Redefinitions : Feature = + Redefines ( ',' ownedRelationship += OwnedRedefinition )* + +Redefines : Feature = + REDEFINES ownedRelationship += OwnedRedefinition + +// Notes: +// 1. PrefixMetadataMember is defined in the Kernel layer (see 8.3.4.12). + +// Clause 8.2.4.3.2 Feature Typing + +FeatureTyping = + ( 'specialization' Identification )? + 'typing' typedFeature = [QualifiedName] + TYPED_BY GeneralType + RelationshipBody + +OwnedFeatureTyping : FeatureTyping = + GeneralType + +// Clause 8.2.4.3.3 Subsetting + +Subsetting = + ( 'specialization' Identification )? + 'subset' SpecificType + SUBSETS GeneralType + RelationshipBody + +OwnedSubsetting : Subsetting = + GeneralType + +OwnedReferenceSubsetting : ReferenceSubsetting = + GeneralType + +OwnedCrossSubsetting : CrossSubsetting = + GeneralType + +// Clause 8.2.4.3.4 Redefinition + +Redefinition = + ( 'specialization' Identification )? + 'redefinition' SpecificType + REDEFINES GeneralType + RelationshipBody + +OwnedRedefinition : Redefinition = + GeneralType + +// Clause 8.2.4.3.5 Feature Chaining + +OwnedFeatureChain : Feature = + FeatureChain + +FeatureChain : Feature = + ownedRelationship += OwnedFeatureChaining + ( '.' ownedRelationship += OwnedFeatureChaining )+ + +OwnedFeatureChaining : FeatureChaining = + chainingFeature = [QualifiedName] + +// Clause 8.2.4.3.6 Feature Inverting + +FeatureInverting = + ( 'inverting' Identification? )? + 'inverse' + ( featureInverted = [QualifiedName] + | featureInverted = OwnedFeatureChain + { ownedRelatedElement += featureInverted } + ) + 'of' + ( invertingFeature = [QualifiedName] + | ownedRelatedElement += OwnedFeatureChain + { ownedRelatedElement += invertingFeature } + ) + RelationshipBody + +OwnedFeatureInverting : FeatureInverting = + invertingFeature = [QualifiedName] + | invertingFeature = OwnedFeatureChain + { ownedRelatedElement += invertingFeature } + +// Clause 8.2.4.3.7 Type Featuring + +TypeFeaturing = + 'featuring' ( Identification 'of' )? + featureOfType = [QualifiedName] + 'by' featuringType = [QualifiedName] + RelationshipBody + +OwnedTypeFeaturing : TypeFeaturing = + featuringType = [QualifiedName] + +// Clause 8.2.5 Kernel Concrete Syntax + +// Clause 8.2.5.1 Data Types Concrete Syntax + +DataType = + TypePrefix 'datatype' + ClassifierDeclaration TypeBody + +// Clause 8.2.5.2 Classes Concrete Syntax + +Class = + TypePrefix 'class' + ClassifierDeclaration TypeBody + +// Clause 8.2.5.3 Structures Concrete Syntax + +Structure = + TypePrefix 'struct' + ClassifierDeclaration TypeBody + +// Clause 8.2.5.4 Associations Concrete Syntax + +Association = + TypePrefix 'assoc' + ClassifierDeclaration TypeBody + +AssociationStructure = + TypePrefix 'assoc' 'struct' + ClassifierDeclaration TypeBody + +// Clause 8.2.5.5 Connectors Concrete Syntax + +// Clause 8.2.5.5.1 Connectors + +Connector = + FeaturePrefix 'connector' + ( FeatureDeclaration? ValuePart? + | ConnectorDeclaration + ) + TypeBody + +ConnectorDeclaration : Connector = + BinaryConnectorDeclaration | NaryConnectorDeclaration + +BinaryConnectorDeclaration : Connector = + ( FeatureDeclaration? 'from' | isSufficient ?= 'all' 'from'? )? + ownedRelationship += ConnectorEndMember 'to' + ownedRelationship += ConnectorEndMember + +NaryConnectorDeclaration : Connector = + FeatureDeclaration? + '(' ownedRelationship += ConnectorEndMember ',' + ownedRelationship += ConnectorEndMember + ( ',' ownedRelationship += ConnectorEndMember )* + ')' + +ConnectorEndMember : EndFeatureMembership = + ownedRelatedElement += ConnectorEnd + +ConnectorEnd : Feature = + ( ownedRelationship += OwnedCrossMultiplicityMember )? + ( declaredName = NAME REFERENCES )? + ownedRelationship += OwnedReferenceSubsetting + +OwnedCrossMultiplicityMember : OwningMembership = + ownedRelatedElement += OwnedCrossMultiplicity + +OwnedCrossMultiplicity : Feature = + ownedRelationship += OwnedMultiplicity + +// Clause 8.2.5.5.2 Binding Connectors + +BindingConnector = + FeaturePrefix 'binding' + BindingConnectorDeclaration TypeBody + +BindingConnectorDeclaration : BindingConnector = + FeatureDeclaration + ( 'of' ownedRelationship += ConnectorEndMember + '=' ownedRelationship += ConnectorEndMember )? + | ( isSufficient ?= 'all' )? + ( 'of'? ownedRelationship += ConnectorEndMember + '=' ownedRelationship += ConnectorEndMember )? + +// Clause 8.2.5.5.3 Successions + +Succession = + FeaturePrefix 'succession' + SuccessionDeclaration TypeBody + +SuccessionDeclaration : Succession = + FeatureDeclaration + ( 'first' ownedRelationship += ConnectorEndMember + 'then' ownedRelationship += ConnectorEndMember )? + | ( s.isSufficient ?= 'all' )? + ( 'first'? ownedRelationship += ConnectorEndMember + 'then' ownedRelationship += ConnectorEndMember )? + +// Clause 8.2.5.6 Behaviors Concrete Syntax + +// Clause 8.2.5.6.1 Behaviors + +Behavior = + TypePrefix 'behavior' + ClassifierDeclaration TypeBody + +// Clause 8.2.5.6.2 Steps + +Step = + FeaturePrefix + 'step' FeatureDeclaration ValuePart? + TypeBody + +// Clause 8.2.5.7 Functions Concrete Syntax + +// Clause 8.2.5.7.1 Functions + +Function = + TypePrefix 'function' + ClassifierDeclaration FunctionBody + +FunctionBody : Type = + ';' | '{' FunctionBodyPart '}' + +FunctionBodyPart : Type = + ( TypeBodyElement + | ownedRelationship += ReturnFeatureMember + )* + ( ownedRelationship += ResultExpressionMember )? + +ReturnFeatureMember : ReturnParameterMembership = + MemberPrefix 'return' + ownedRelatedElement += FeatureElement + +ResultExpressionMember : ResultExpressionMembership = + MemberPrefix + ownedRelatedElement += OwnedExpression + +// Clause 8.2.5.7.2 Expressions + +Expression = + FeaturePrefix + 'expr' FeatureDeclaration ValuePart? + FunctionBody + +// Clause 8.2.5.7.3 Predicates + +Predicate = + TypePrefix 'predicate' + ClassifierDeclaration FunctionBody + +// Clause 8.2.5.7.4 Boolean Expressions and Invariants + +BooleanExpression = + FeaturePrefix + 'bool' FeatureDeclaration ValuePart? + FunctionBody + +Invariant = + FeaturePrefix + 'inv' ( 'true' | isNegated ?= 'false' )? + FeatureDeclaration ValuePart? + FunctionBody + +// Clause 8.2.5.8 Expressions Concrete Syntax + +// Clause 8.2.5.8.1 Operator Expressions + +OwnedExpressionReferenceMember : FeatureMembership = + ownedRelationship += OwnedExpressionReference + +OwnedExpressionReference : FeatureReferenceExpression = + ownedRelationship += OwnedExpressionMember + +OwnedExpressionMember : FeatureMembership = + ownedFeatureMember = OwnedExpression + +OwnedExpression : Expression = + ConditionalExpression + | ConditionalBinaryOperatorExpression + | BinaryOperatorExpression + | UnaryOperatorExpression + | ClassificationExpression + | MetaclassificationExpression + | ExtentExpression + | PrimaryExpression + +ConditionalExpression : OperatorExpression = + operator = 'if' + ownedRelationship += ArgumentMember '?' + ownedRelationship += ArgumentExpressionMember 'else' + ownedRelationship += ArgumentExpressionMember + ownedRelationship += EmptyResultMember + +ConditionalBinaryOperatorExpression : OperatorExpression = + ownedRelationship += ArgumentMember + operator = ConditionalBinaryOperator + ownedRelationship += ArgumentExpressionMember + ownedRelationship += EmptyResultMember + +ConditionalBinaryOperator = + '??' | 'or' | 'and' | 'implies' + +BinaryOperatorExpression : OperatorExpression = + ownedRelationship += ArgumentMember + operator = BinaryOperator + ownedRelationship += ArgumentMember + ownedRelationship += EmptyResultMember + +BinaryOperator = + '|' | '&' | 'xor' | '..' + | '==' | '!=' | '===' | '!==' + | '<' | '>' | '<=' | '>=' + | '+' | '-' | '*' | '/' + | '%' | '^' | '**' + +UnaryOperatorExpression : OperatorExpression = + operator = UnaryOperator + ownedRelationship += ArgumentMember + ownedRelationship += EmptyResultMember + +UnaryOperator = + '+' | '-' | '~' | 'not' + +ClassificationExpression : OperatorExpression = + ( ownedRelationship += ArgumentMember )? + ( operator = ClassificationTestOperator + ownedRelationship += TypeReferenceMember + | operator = CastOperator + ownedRelationship += TypeResultMember + ) + ownedRelationship += EmptyResultMember + +ClassificationTestOperator = + 'istype' | 'hastype' | '@' + +CastOperator = + 'as' + +MetaclassificationExpression : OperatorExpression = + ownedRelationship += MetadataArgumentMember + ( operator = ClassificationTestOperator + ownedRelationship += TypeReferenceMember + | operator = MetaCastOperator + ownedRelationship += TypeResultMember + ) + ownedRelationship += EmptyResultMember + +ArgumentMember : ParameterMembership = + ownedMemberParameter = Argument + +Argument : Feature = + ownedRelationship += ArgumentValue + +ArgumentValue : FeatureValue = + value = OwnedExpression + +ArgumentExpressionMember : FeatureMembership = + ownedRelatedElement += ArgumentExpression + +ArgumentExpression : Feature = + ownedRelationship += ArgumentExpressionValue + +ArgumentExpressionValue : FeatureValue = + value = OwnedExpressionReference + +MetadataArgumentMember : ParameterMembership = + ownedRelatedElement += MetadataArgument + +MetadataArgument : Feature = + ownedRelationship += MetadataValue + +MetadataValue : FeatureValue = + value = MetadataReference + +MetadataReference : MetadataAccessExpression = + ownedRelationship += ElementReferenceMember + +MetaclassificationTestOperator = + '@@' + +MetaCastOperator = + 'meta' + +ExtentExpression : OperatorExpression = + operator = 'all' + ownedRelationship += TypeReferenceMember + +TypeReferenceMember : ParameterMembership = + ownedMemberFeature = TypeReference + +TypeResultMember : ResultParameterMembership = + ownedMemberFeature = TypeReference + +TypeReference : Feature = + ownedRelationship += ReferenceTyping + +ReferenceTyping : FeatureTyping = + type = [QualifiedName] + +EmptyResultMember : ReturnParameterMembership = + ownedRelatedElement += EmptyFeature + +EmptyFeature : Feature = + { } + +// Notes: +// 1. OperatorExpressions provide a shorthand notation for InvocationExpressions that invoke a library Function represented as an operator symbol. Table 5 shows the mapping from operator symbols to the Functions they represent from the Kernel Model Library (see Clause 9). An OperatorExpression contains subexpressions called its operands that generally correspond to the argument Expressions of the OperatorExpression, except in the case of operators representing control Functions, in which case the evaluation of certain operands is as determined by the Function (see 8.4.4.9 for details). +// 2. Though not directly expressed in the syntactic productions given above, in any OperatorExpression containing nested OperatorExpressions, the nested OperatorExpressions shall be implicitly grouped according to the precedence of the operators involved, as given in Table 6. OperatorExpressions with higher precedence operators shall be grouped more tightly than those with lower precedence operators. Further, all BinaryOperators other than exponentiation are left-associative (i.e, they group to the left), while the exponentiation operators (^ and **) are right-associative (i.e., they group to the right). +// 3. The unary operator symbol ~ maps to the library Function DataFunctions::'~', as shown in Table 5. This abstract Function may be given a concrete definition in a domain-specific Function library, but no default definition is provided in the Kernel Functions Library. If no domain-specific definition is available, a tool should give a warning if this operator is used. + +// Clause 8.2.5.8.2 Primary Expressions + +PrimaryExpression : Expression = + FeatureChainExpression + | NonFeatureChainPrimaryExpression + +PrimaryArgumentValue : FeatureValue = + value = PrimaryExpression + +PrimaryArgument : Feature = + ownedRelationship += PrimaryArgumentValue + +PrimaryArgumentMember : ParameterMembership = + ownedMemberParameter = PrimaryArgument + +NonFeatureChainPrimaryExpression : Expression = + BracketExpression + | IndexExpression + | SequenceExpression + | SelectExpression + | CollectExpression + | FunctionOperationExpression + | BaseExpression + +NonFeatureChainPrimaryArgumentValue : FeatureValue = + value = NonFeatureChainPrimaryExpression + +NonFeatureChainPrimaryArgument : Feature = + ownedRelationship += NonFeatureChainPrimaryArgumentValue + +NonFeatureChainPrimaryArgumentMember : ParameterMembership = + ownedMemberParameter = PrimaryArgument + +BracketExpression : OperatorExpression = + ownedRelationship += PrimaryArgumentMember + operator = '[' + ownedRelationship += SequenceExpressionListMember ']' + +IndexExpression = + ownedRelationship += PrimaryArgumentMember '#' + '(' ownedRelationship += SequenceExpressionListMember ')' + +SequenceExpression : Expression = + '(' SequenceExpressionList ')' + +SequenceExpressionList : Expression = + OwnedExpression ','? | SequenceOperatorExpression + +SequenceOperatorExpression : OperatorExpression = + ownedRelationship += OwnedExpressionMember + operator = ',' + ownedRelationship += SequenceExpressionListMember + +SequenceExpressionListMember : FeatureMembership = + ownedMemberFeature = SequenceExpressionList + +FeatureChainExpression = + ownedRelationship += NonFeatureChainPrimaryArgumentMember '.' + ownedRelationship += FeatureChainMember + +CollectExpression = + ownedRelationship += PrimaryArgumentMember '.' + ownedRelationship += BodyArgumentMember + +SelectExpression = + ownedRelationship += PrimaryArgumentMember '.?' + ownedRelationship += BodyArgumentMember + +FunctionOperationExpression : InvocationExpression = + ownedRelationship += PrimaryArgumentMember '->' + ownedRelationship += InvocationTypeMember + ( ownedRelationship += BodyArgumentMember + | ownedRelationship += FunctionReferenceArgumentMember + | ArgumentList ) + ownedRelationship += EmptyResultMember + +BodyArgumentMember : ParameterMembership = + ownedMemberParameter = BodyArgument + +BodyArgument : Feature = + ownedRelationship += BodyArgumentValue + +BodyArgumentValue : FeatureValue = + value = BodyExpression + +FunctionReferenceArgumentMember : ParameterMembership = + ownedMemberParameter = FunctionReferenceArgument + +FunctionReferenceArgument : Feature = + ownedRelationship += FunctionReferenceArgumentValue + +FunctionReferenceArgumentValue : FeatureValue = + value = FunctionReferenceExpression + +FunctionReferenceExpression : FeatureReferenceExpression = + ownedRelationship += FunctionReferenceMember + +FunctionReferenceMember : FeatureMembership = + ownedMemberFeature = FunctionReference + +FunctionReference : Expression = + ownedRelationship += ReferenceTyping + +FeatureChainMember : Membership = + FeatureReferenceMember + | OwnedFeatureChainMember + +OwnedFeatureChainMember : OwningMembership = + ownedMemberElement = FeatureChain + +// Notes: +// 1. Primary expressions provide additional shorthand notations for certain kinds of InvocationExpressions. For those cases in which the InvocationExpression is an OperatorExpression, its operator shall be resolved to the appropriate library function as given in Table 7. Note also that, for a CollectionExpression or SelectExpression, the abstract syntax constrains the operator to be collect and select, respectively, separately from the . and .? symbols used in their concrete syntax notation (see 8.3.4.8.2 and 8.3.4.8.18). +// 2. The grammar allows a bracket syntax [...]that parses to an invocation of the library Function BaseFunctions::'[', as shown in Table 7. This notation is available for use with domain-specific library models that given a concrete definition to the abstract base '[' Function, but no default definition is provided in the Kernel Functions Library. If no domain-specific definition is available, a tool should give a warning if this operator is used. + +// Clause 8.2.5.8.3 Base Expressions + +BaseExpression : Expression = + NullExpression + | LiteralExpression + | FeatureReferenceExpression + | MetadataAccessExpression + | InvocationExpression + | ConstructorExpression + | BodyExpression + +NullExpression : NullExpression = + 'null' | '(' ')' + +FeatureReferenceExpression : FeatureReferenceExpression = + ownedRelationship += FeatureReferenceMember + ownedRelationship += EmptyResultMember + +FeatureReferenceMember : Membership = + memberElement = FeatureReference + +FeatureReference : Feature = + [QualifiedName] + +MetadataAccessExpression = + ownedRelationship += ElementReferenceMember '.' 'metadata' + +ElementReferenceMember : Membership = + memberElement = [QualifiedName] + +InvocationExpression : InvocationExpression = + ownedRelationship += InstantiatedTypeMember + ArgumentList + ownedRelationship += EmptyResultMember + +ConstructorExpression = + 'new' ownedRelationship += InstantiatedTypeMember + ownedRelationship += ConstructorResultMember + +ConstructorResultMember : ReturnParameterMembership = + ownedRelatedElement += ConstructorResult + +ConstructorResult : Feature = + ArgumentList + +InstantiatedTypeMember : Membership = + memberElement = InstantiatedTypeReference + | OwnedFeatureChainMember + +InstantiatedTypeReference : Type = + [QualifiedName] + +ArgumentList : Feature = + '(' ( PositionalArgumentList | NamedArgumentList )? ')' + +PositionalArgumentList : Feature = + e.ownedRelationship += ArgumentMember + ( ',' e.ownedRelationship += ArgumentMember )* + +NamedArgumentList : Feature = + ownedRelationship += NamedArgumentMember + ( ',' ownedRelationship += NamedArgumentMember )* + +NamedArgumentMember : FeatureMembership = + ownedMemberFeature = NamedArgument + +NamedArgument : Feature = + ownedRelationship += ParameterRedefinition '=' + ownedRelationship += ArgumentValue + +ParameterRedefinition : Redefinition = + redefinedFeature = [QualifiedName] + +BodyExpression : FeatureReferenceExpression = + ownedRelationship += ExpressionBodyMember + +ExpressionBodyMember : FeatureMembership = + ownedMemberFeature = ExpressionBody + +ExpressionBody : Expression = + '{' FunctionBodyPart '}' + +// Clause 8.2.5.8.4 Literal Expressions + +LiteralExpression = + LiteralBoolean + | LiteralString + | LiteralInteger + | LiteralReal + | LiteralInfinity + +LiteralBoolean = + value = BooleanValue + +BooleanValue : Boolean = + 'true' | 'false' + +LiteralString = + value = STRING_VALUE + +LiteralInteger = + value = DECIMAL_VALUE + +LiteralReal = + value = RealValue + +RealValue : Real = + DECIMAL_VALUE? '.' ( DECIMAL_VALUE | EXPONENTIAL_VALUE ) + | EXPONENTIAL_VALUE + +LiteralInfinity = + '*' + +// Clause 8.2.5.9 Interactions Concrete Syntax + +// Clause 8.2.5.9.1 Interactions + +Interaction = + TypePrefix 'interaction' + ClassifierDeclaration TypeBody + +// Clause 8.2.5.9.2 Flows + +Flow = + FeaturePrefix 'flow' + FlowDeclaration TypeBody + +SuccessionFlow = + FeaturePrefix 'succession' 'flow' + FlowDeclaration TypeBody + +FlowDeclaration : Flow = + FeatureDeclaration ValuePart? + ( 'of' ownedRelationship += PayloadFeatureMember )? + ( 'from' ownedRelationship += FlowEndMember + 'to' ownedRelationship += FlowEndMember )? + | ( isSufficient ?= 'all' )? + ownedRelationship += FlowEndMember 'to' + ownedRelationship += FlowEndMember + +PayloadFeatureMember : FeatureMembership = + ownedRelatedElement = PayloadFeature + +PayloadFeature = + Identification PayloadFeatureSpecializationPart ValuePart? + | Identification ValuePart + | ownedRelationship += OwnedFeatureTyping + ( ownedRelationship += OwnedMultiplicity )? + | ownedRelationship += OwnedMultiplicity + ( ownedRelationship += OwnedFeatureTyping )? + +PayloadFeatureSpecializationPart : Feature = + FeatureSpecialization+ MultiplicityPart? + FeatureSpecialization* + | MultiplicityPart FeatureSpecialization+ + +FlowEndMember : EndFeatureMembership = + ownedRelatedElement += FlowEnd + +FlowEnd = + ( ownedRelationship += OwnedReferenceSubsetting '.' )? + ownedRelationship += FlowFeatureMember + +FlowFeatureMember : FeatureMembership = + ownedRelatedElement += FlowFeature + +FlowFeature : Feature = + ownedRelationship += FlowFeatureRedefinition + +// (See Note 1) + +FlowFeatureRedefinition : Redefinition = + redefinedFeature = [QualifiedName] + +// Notes: +// 1. To ensure that an FlowFeature passes the validateRedefinitionDirectionConformance constraint (see 8.3.3.3.8), its direction must be set to the direction of its redefinedFeature, relative to its owning FlowEnd, that is, the result of the following OCL expression: owningType.directionOf(ownedRedefinition->at(1).redefinedFeature) + +// Clause 8.2.5.10 Feature Values Concrete Syntax + +ValuePart : Feature = + ownedRelationship += FeatureValue + +FeatureValue = + ( '=' + | isInitial ?= ':=' + | isDefault ?= 'default' ( '=' | isInitial ?= ':=' )? + ) + ownedRelatedElement += OwnedExpression + +// Clause 8.2.5.11 Multiplicities Concrete Syntax + +Multiplicity = + MultiplicitySubset | MultiplicityRange + +MultiplicitySubset : Multiplicity = + 'multiplicity' Identification Subsets + TypeBody + +MultiplicityRange = + 'multiplicity' Identification MultiplicityBounds + TypeBody + +OwnedMultiplicity : OwningMembership = + ownedRelatedElement += OwnedMultiplicityRange + +OwnedMultiplicityRange : MultiplicityRange = + MultiplicityBounds + +MultiplicityBounds : MultiplicityRange = + '[' ( ownedRelationship += MultiplicityExpressionMember '..' )? + ownedRelationship += MultiplicityExpressionMember ']' + +MultiplicityExpressionMember : OwningMembership = + ownedRelatedElement += ( LiteralExpression | FeatureReferenceExpression ) + +// Clause 8.2.5.12 Metadata Concrete Syntax + +Metaclass = + TypePrefix 'metaclass' + ClassifierDeclaration TypeBody + +PrefixMetadataAnnotation : Annotation = + '#' ownedRelatedElement += PrefixMetadataFeature + +PrefixMetadataMember : OwningMembership = + '#' ownedRelatedElement += PrefixMetadataFeature + +PrefixMetadataFeature : MetadataFeature = + ownedRelationship += OwnedFeatureTyping + +MetadataFeature = + ( ownedRelationship += PrefixMetadataMember )* + ( '@' | 'metadata' ) + MetadataFeatureDeclaration + ( 'about' ownedRelationship += Annotation + ( ',' ownedRelationship += Annotation )* + )? + MetadataBody + +MetadataFeatureDeclaration : MetadataFeature = + ( Identification ( ':' | 'typed' 'by' ) )? + ownedRelationship += OwnedFeatureTyping + +MetadataBody : Feature = + ';' | '{' ( ownedRelationship += MetadataBodyElement )* '}' + +MetadataBodyElement : Membership = + NonFeatureMember + | MetadataBodyFeatureMember + | AliasMember + | Import + +MetadataBodyFeatureMember : FeatureMembership = + ownedMemberFeature = MetadataBodyFeature + +MetadataBodyFeature : Feature = + 'feature'? ( ':>>' | 'redefines')? ownedRelationship += OwnedRedefinition + FeatureSpecializationPart? ValuePart? + MetadataBody + +// Clause 8.2.5.13 Packages Concrete Syntax + +Package = + ( ownedRelationship += PrefixMetadataMember )* + PackageDeclaration PackageBody + +LibraryPackage = + ( isStandard ?= 'standard' ) 'library' + ( ownedRelationship += PrefixMetadataMember )* + PackageDeclaration PackageBody + +PackageDeclaration : Package = + 'package' Identification + +PackageBody : Package = + ';' + | '{' ( NamespaceBodyElement + | ownedRelationship += ElementFilterMember + )* + '}' + +ElementFilterMember : ElementFilterMembership = + MemberPrefix + 'filter' condition = OwnedExpression ';' + +// End of BNF + + diff --git a/Resources/SysML-textual-bnf.kebnf b/Resources/SysML-textual-bnf.kebnf new file mode 100644 index 00000000..e5c771e9 --- /dev/null +++ b/Resources/SysML-textual-bnf.kebnf @@ -0,0 +1,1705 @@ +// Manual corrections by HP de Koning + +// Part 2 - Systems Modeling Language (SysML) + +// Clause 8.2.2 Textual Notation + +// Clause 8.2.2.1 Textual Notation Overview + +// Clause 8.2.2.1.1 EBNF Conventions + +// Clause 8.2.2.1.2 Lexical Structure + +RESERVED_KEYWORD = + 'about' | 'abstract' | 'accept' | 'action' | 'actor' | 'after' | 'alias' | 'all' | 'allocate' | 'allocation' + | 'analysis' | 'and' | 'as' | 'assert' | 'assign' | 'assume' | 'at' | 'attribute' | 'bind' | 'binding' | 'by' | 'calc' + | 'case' | 'comment' | 'concern' | 'connect' | 'connection' | 'constant' | 'constraint' | 'crosses' | 'decide' + | 'def' | 'default' | 'defined' | 'dependency' | 'derived' | 'do' | 'doc' | 'else' | 'end' | 'entry' | 'enum' + | 'event' | 'exhibit' | 'exit' | 'expose' | 'false' | 'filter' | 'first' | 'flow' | 'for' | 'fork' | 'frame' | 'from' + | 'hastype' | 'if' | 'implies' | 'import' | 'in' | 'include' | 'individual' | 'inout' | 'interface' | 'istype' + | 'item' | 'join' | 'language' | 'library' | 'locale' | 'loop' | 'merge' | 'message' | 'meta' | 'metadata' + | 'nonunique' | 'not' | 'null' | 'objective' | 'occurrence' | 'of' | 'or' | 'ordered' | 'out' | 'package' | 'parallel' + | 'part' | 'perform' | 'port' | 'private' | 'protected' | 'public' | 'redefines' | 'ref' | 'references' | 'render' + | 'rendering' | 'rep' | 'require' | 'requirement' | 'return' | 'satisfy' | 'send' | 'snapshot' | 'specializes' + | 'stakeholder' | 'standard' | 'state' | 'subject' | 'subsets' | 'succession' | 'terminate' | 'then' | 'timeslice' + | 'to' | 'transition' | 'true' | 'until' | 'use' | 'variant' | 'variation' | 'verification' | 'verify' | 'via' + | 'view' | 'viewpoint' | 'when' | 'while' | 'xor' + +DEFINED_BY = ':' | 'defined' 'by' + +SPECIALIZES = ':>' | 'specializes' + +SUBSETS = ':>' | 'subsets' + +REFERENCES = '::>' | 'references' + +CROSSES = '=>' | 'crosses' + +REDEFINES = ':>>' | 'redefines' + +// Clause 8.2.2.2 Elements and Relationships Textual Notation + +Identification : Element = + ( '<' declaredShortName = NAME '>' )? + ( declaredName = NAME )? + +RelationshipBody : Relationship = + ';' | '{' ( ownedRelationship += OwnedAnnotation )* '}' + +// Clause 8.2.2.3 Dependencies Textual Notation + +Dependency = + ( ownedRelationship += PrefixMetadataAnnotation )* + 'dependency' DependencyDeclaration + RelationshipBody + +DependencyDeclaration = + ( Identification 'from' )? + client += [QualifiedName] ( ',' client += [QualifiedName] )* 'to' + supplier += [QualifiedName] ( ',' supplier += [QualifiedName] )* + +// Clause 8.2.2.4 Annotations Textual Notation + +// Clause 8.2.2.4.1 Annotations + +Annotation = + annotatedElement = [QualifiedName] + +OwnedAnnotation : Annotation = + ownedRelatedElement += AnnotatingElement + +AnnotatingMember : OwningMembership = + ownedRelatedElement += AnnotatingElement + +AnnotatingElement = + Comment + | Documentation + | TextualRepresentation + | MetadataFeature + +// Clause 8.2.2.4.2 Comments and Documentation + +Comment = + ( 'comment' Identification + ( 'about' ownedRelationship += Annotation + ( ',' ownedRelationship += Annotation )* + )? + )? + ( 'locale' locale = STRING_VALUE )? + body = REGULAR_COMMENT + +Documentation = + 'doc' Identification + ( 'locale' locale = STRING_VALUE )? + body = REGULAR_COMMENT + +// Clause 8.2.2.4.3 Textual Representation + +TextualRepresentation = + ( 'rep' Identification )? + 'language' language = STRING_VALUE body = REGULAR_COMMENT + +// Clause 8.2.2.5 Namespaces and Packages Textual Notation + +// Clause 8.2.2.5.1 Packages + +RootNamespace : Namespace = + PackageBodyElement* + +Package = + ( ownedRelationship += PrefixMetadataMember )* + PackageDeclaration PackageBody + +LibraryPackage = + ( isStandard ?= 'standard' ) 'library' + ( ownedRelationship += PrefixMetadataMember )* + PackageDeclaration PackageBody + +PackageDeclaration : Package = + 'package' Identification + +PackageBody : Package = + ';' | '{' PackageBodyElement* '}' + +PackageBodyElement : Package = + ownedRelationship += PackageMember + | ownedRelationship += ElementFilterMember + | ownedRelationship += AliasMember + | ownedRelationship += Import + +MemberPrefix : Membership = + ( visibility = VisibilityIndicator )? + +PackageMember : OwningMembership = + MemberPrefix + ( ownedRelatedElement += DefinitionElement + | ownedRelatedElement = UsageElement ) + +ElementFilterMember : ElementFilterMembership = + MemberPrefix + 'filter' ownedRelatedElement += OwnedExpression ';' + +AliasMember : Membership = + MemberPrefix + 'alias' ( '<' memberShortName = NAME '>' )? + ( memberName = NAME )? + 'for' memberElement = [QualifiedName] + RelationshipBody + +Import = + visibility = VisibilityIndicator + 'import' ( isImportAll ?= 'all' )? + ImportDeclaration + RelationshipBody + +ImportDeclaration : Import = + MembershipImport | NamespaceImport + +MembershipImport = + importedMembership = [QualifiedName] + ( '::' isRecursive ?= '**' )? + +NamespaceImport = + importedNamespace = [QualifiedName] '::' '*' + ( '::' isRecursive ?= '**' )? + | importedNamespace = FilterPackage + { ownedRelatedElement += importedNamespace } + +FilterPackage : Package = + ownedRelationship += FilterPackageImport + ( ownedRelationship += FilterPackageMember )+ + +FilterPackageMember : ElementFilterMembership = + '[' ownedRelatedElement += OwnedExpression ']' + +VisibilityIndicator : VisibilityKind = + 'public' | 'private' | 'protected' + +// Clause 8.2.2.5.2 Package Elements + +DefinitionElement : Element = + Package + | LibraryPackage + | AnnotatingElement + | Dependency + | AttributeDefinition + | EnumerationDefinition + | OccurrenceDefinition + | IndividualDefinition + | ItemDefinition + | PartDefinition + | ConnectionDefinition + | FlowDefinition + | InterfaceDefinition + | PortDefinition + | ActionDefinition + | CalculationDefinition + | StateDefinition + | ConstraintDefinition + | RequirementDefinition + | ConcernDefinition + | CaseDefinition + | AnalysisCaseDefinition + | VerificationCaseDefinition + | UseCaseDefinition + | ViewDefinition + | ViewpointDefinition + | RenderingDefinition + | MetadataDefinition + | ExtendedDefinition + +UsageElement : Usage = + NonOccurrenceUsageElement + | OccurrenceUsageElement + +// Clause 8.2.2.6 Definition and Usage Textual Notation + +// Clause 8.2.2.6.1 Definitions + +BasicDefinitionPrefix = + isAbstract ?= 'abstract' | isVariation ?= 'variation' + +DefinitionExtensionKeyword : Definition = + ownedRelationship += PrefixMetadataMember + +DefinitionPrefix : Definition = + BasicDefinitionPrefix? DefinitionExtensionKeyword* + +Definition = + DefinitionDeclaration DefinitionBody + +DefinitionDeclaration : Definition = + Identification SubclassificationPart? + +DefinitionBody : Type = + ';' | '{' DefinitionBodyItem* '}' + +DefinitionBodyItem : Type = + ownedRelationship += DefinitionMember + | ownedRelationship += VariantUsageMember + | ownedRelationship += NonOccurrenceUsageMember + | ( ownedRelationship += SourceSuccessionMember )? + ownedRelationship += OccurrenceUsageMember + | ownedRelationship += AliasMember + | ownedRelationship += Import + +DefinitionMember : OwningMembership = + MemberPrefix + ownedRelatedElement += DefinitionElement + +VariantUsageMember : VariantMembership = + MemberPrefix 'variant' + ownedVariantUsage = VariantUsageElement + +NonOccurrenceUsageMember : FeatureMembership = + MemberPrefix + ownedRelatedElement += NonOccurrenceUsageElement + +OccurrenceUsageMember : FeatureMembership = + MemberPrefix + ownedRelatedElement += OccurrenceUsageElement + +StructureUsageMember : FeatureMembership = + MemberPrefix + ownedRelatedElement += StructureUsageElement + +BehaviorUsageMember : FeatureMembership = + MemberPrefix + ownedRelatedElement += BehaviorUsageElement + +// Clause 8.2.2.6.2 Usages + +FeatureDirection : FeatureDirectionKind = + 'in' | 'out' | 'inout' + +RefPrefix : Usage = + ( direction = FeatureDirection )? + ( isDerived ?= 'derived' )? + ( isAbstract ?= 'abstract' | isVariation ?= 'variation' )? + ( isConstant ?= 'constant' )? + +BasicUsagePrefix : Usage = + RefPrefix + ( isReference ?= 'ref' )? + +EndUsagePrefix : Usage = + isEnd ?= 'end' ( ownedRelationship += OwnedCrossFeatureMember )? + +// (See Note 1) + +OwnedCrossFeatureMember : OwningMembership = + ownedRelatedElement += OwnedCrossFeature + +OwnedCrossFeature : ReferenceUsage = + BasicUsagePrefix UsageDeclaration + +UsageExtensionKeyword : Usage = + ownedRelationship += PrefixMetadataMember + +UnextendedUsagePrefix : Usage = + EndUsagePrefix | BasicUsagePrefix + +UsagePrefix : Usage = + UnextendedUsagePrefix UsageExtensionKeyword* + +Usage = + UsageDeclaration UsageCompletion + +UsageDeclaration : Usage = + Identification FeatureSpecializationPart? + +UsageCompletion : Usage = + ValuePart? UsageBody + +UsageBody : Usage = + DefinitionBody + +ValuePart : Feature = + ownedRelationship += FeatureValue + +FeatureValue = + ( '=' + | isInitial ?= ':=' + | isDefault ?= 'default' ( '=' | isInitial ?= ':=' )? + ) + ownedRelatedElement += OwnedExpression + +// Notes: +// 1. A Usage parsed with isEnd = true for which mayTimeVary = true must also have isConstant set to true, even though this is not explicitly notated in the textual notation, in order to satisfy the KerML constraint checkFeatureEndIsConstant. + +// Clause 8.2.2.6.3 Reference Usages + +DefaultReferenceUsage : ReferenceUsage = + RefPrefix Usage + +ReferenceUsage = + ( EndUsagePrefix | RefPrefix ) + 'ref' Usage + +VariantReference : ReferenceUsage = + ownedRelationship += OwnedReferenceSubsetting + FeatureSpecialization* UsageBody + +// Clause 8.2.2.6.4 Body Elements + +NonOccurrenceUsageElement : Usage = + DefaultReferenceUsage + | ReferenceUsage + | AttributeUsage + | EnumerationUsage + | BindingConnectorAsUsage + | SuccessionAsUsage + | ExtendedUsage + +OccurrenceUsageElement : Usage = + StructureUsageElement | BehaviorUsageElement + +StructureUsageElement : Usage = + OccurrenceUsage + | IndividualUsage + | PortionUsage + | EventOccurrenceUsage + | ItemUsage + | PartUsage + | ViewUsage + | RenderingUsage + | PortUsage + | ConnectionUsage + | InterfaceUsage + | AllocationUsage + | Message + | FlowUsage + | SuccessionFlowUsage + +BehaviorUsageElement : Usage = + ActionUsage + | CalculationUsage + | StateUsage + | ConstraintUsage + | RequirementUsage + | ConcernUsage + | CaseUsage + | AnalysisCaseUsage + | VerificationCaseUsage + | UseCaseUsage + | ViewpointUsage + | PerformActionUsage + | ExhibitStateUsage + | IncludeUseCaseUsage + | AssertConstraintUsage + | SatisfyRequirementUsage + +VariantUsageElement : Usage = + VariantReference + | ReferenceUsage + | AttributeUsage + | BindingConnectorAsUsage + | SuccessionAsUsage + | OccurrenceUsage + | IndividualUsage + | PortionUsage + | EventOccurrenceUsage + | ItemUsage + | PartUsage + | ViewUsage + | RenderingUsage + | PortUsage + | ConnectionUsage + | InterfaceUsage + | AllocationUsage + | Message + | FlowUsage + | SuccessionFlowUsage + | BehaviorUsageElement + +// Clause 8.2.2.6.5 Specialization + +SubclassificationPart : Classifier = + SPECIALIZES ownedRelationship += OwnedSubclassification + ( ',' ownedRelationship += OwnedSubclassification )* + +OwnedSubclassification : Subclassification = + superClassifier = [QualifiedName] + +FeatureSpecializationPart : Feature = + FeatureSpecialization+ MultiplicityPart? FeatureSpecialization* + | MultiplicityPart FeatureSpecialization* + +FeatureSpecialization : Feature = + Typings | Subsettings | References | Crosses | Redefinitions + +Typings : Feature = + TypedBy ( ',' ownedRelationship += FeatureTyping )* + +TypedBy : Feature = + DEFINED_BY ownedRelationship += FeatureTyping + +FeatureTyping = + OwnedFeatureTyping | ConjugatedPortTyping + +OwnedFeatureTyping : FeatureTyping = + type = [QualifiedName] + | type = OwnedFeatureChain + { ownedRelatedElement += type } + +Subsettings : Feature = + Subsets ( ',' ownedRelationship += OwnedSubsetting )* + +Subsets : Feature = + SUBSETS ownedRelationship += OwnedSubsetting + +OwnedSubsetting : Subsetting = + subsettedFeature = [QualifiedName] + | subsettedFeature = OwnedFeatureChain + { ownedRelatedElement += subsettedFeature } + +References : Feature = + REFERENCES ownedRelationship += OwnedReferenceSubsetting + +OwnedReferenceSubsetting : ReferenceSubsetting = + referencedFeature = [QualifiedName] + | referencedFeature = OwnedFeatureChain + { ownedRelatedElement += referenceFeature } + +Crosses : Feature = + CROSSES ownedRelationship += OwnedCrossSubsetting + +OwnedCrossSubsetting : CrossSubsetting = + crossedFeature = [QualifiedName] + | crossedFeature = OwnedFeatureChain + { ownedRelatedElement += crossedFeature } + +Redefinitions : Feature = + Redefines ( ',' ownedRelationship += OwnedRedefinition )* + +Redefines : Feature = + REDEFINES ownedRelationship += OwnedRedefinition + +OwnedRedefinition : Redefinition = + redefinedFeature = [QualifiedName] + | redefinedFeature = OwnedFeatureChain + { ownedRelatedElement += redefinedFeature } + +OwnedFeatureChain : Feature = + ownedRelationship += OwnedFeatureChaining + ( '.' ownedRelationship += OwnedFeatureChaining )+ + +OwnedFeatureChaining : FeatureChaining = + chainingFeature = [QualifiedName] + +// Clause 8.2.2.6.6 Multiplicity + +MultiplicityPart : Feature = + ownedRelationship += OwnedMultiplicity + | ( ownedRelationship += OwnedMultiplicity )? + ( isOrdered ?= 'ordered' ( { isUnique = false } 'nonunique' )? + | { isUnique = false } 'nonunique' ( isOrdered ?= 'ordered' )? ) + +OwnedMultiplicity : OwningMembership = + ownedRelatedElement += MultiplicityRange + +MultiplicityRange = + '[' ( ownedRelationship += MultiplicityExpressionMember '..' )? + ownedRelationship += MultiplicityExpressionMember ']' + +MultiplicityExpressionMember : OwningMembership = + ownedRelatedElement += ( LiteralExpression | FeatureReferenceExpression ) + +// Clause 8.2.2.7 Attributes Textual Notation + +AttributeDefinition : AttributeDefinition = + DefinitionPrefix 'attribute' 'def' Definition + +AttributeUsage : AttributeUsage = + UsagePrefix 'attribute' Usage + +// Clause 8.2.2.8 Enumerations Textual Notation + +EnumerationDefinition = + DefinitionExtensionKeyword* + 'enum' 'def' DefinitionDeclaration EnumerationBody + +EnumerationBody : EnumerationDefinition = + ';' + | '{' ( ownedRelationship += AnnotatingMember + | ownedRelationship += EnumerationUsageMember )* + '}' + +EnumerationUsageMember : VariantMembership = + MemberPrefix ownedRelatedElement += EnumeratedValue + +EnumeratedValue : EnumerationUsage = + 'enum'? Usage + +EnumerationUsage : EnumerationUsage = + UsagePrefix 'enum' Usage + +// Clause 8.2.2.9 Occurrences Textual Notation + +// Clause 8.2.2.9.1 Occurrence Definitions + +OccurrenceDefinitionPrefix : OccurrenceDefinition = + BasicDefinitionPrefix? + ( isIndividual ?= 'individual' + ownedRelationship += EmptyMultiplicityMember + )? + DefinitionExtensionKeyword* + +OccurrenceDefinition = + OccurrenceDefinitionPrefix 'occurrence' 'def' Definition + +IndividualDefinition : OccurrenceDefinition = + BasicDefinitionPrefix? isIndividual ?= 'individual' + DefinitionExtensionKeyword* 'def' Definition + ownedRelationship += EmptyMultiplicityMember + +EmptyMultiplicityMember : OwningMembership = + ownedRelatedElement += EmptyMultiplicity + +EmptyMultiplicity : Multiplicity = + { } + +// Clause 8.2.2.9.2 Occurrence Usages + +OccurrenceUsagePrefix : OccurrenceUsage = + BasicUsagePrefix + ( isIndividual ?= 'individual' )? + ( portionKind = PortionKind + { isPortion = true } + )? + UsageExtensionKeyword* + +OccurrenceUsage = + OccurrenceUsagePrefix 'occurrence' Usage + +IndividualUsage : OccurrenceUsage = + BasicUsagePrefix isIndividual ?= 'individual' + UsageExtensionKeyword* Usage + +PortionUsage : OccurrenceUsage = + BasicUsagePrefix ( isIndividual ?= 'individual' )? + portionKind = PortionKind + UsageExtensionKeyword* Usage + { isPortion = true } + +PortionKind = + 'snapshot' | 'timeslice' + +EventOccurrenceUsage = + OccurrenceUsagePrefix 'event' + ( ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? + | 'occurrence' UsageDeclaration? ) + UsageCompletion + +// Clause 8.2.2.9.3 Occurrence Successions + +SourceSuccessionMember : FeatureMembership = + 'then' ownedRelatedElement += SourceSuccession + +SourceSuccession : SuccessionAsUsage = + ownedRelationship += SourceEndMember + +SourceEndMember : EndFeatureMembership = + ownedRelatedElement += SourceEnd + +SourceEnd : ReferenceUsage = + ( ownedRelationship += OwnedMultiplicity )? + +// Clause 8.2.2.10 Items Textual Notation + +ItemDefinition = + OccurrenceDefinitionPrefix + 'item' 'def' Definition + +ItemUsage = + OccurrenceUsagePrefix 'item' Usage + +// Clause 8.2.2.11 Parts Textual Notation + +PartDefinition = + OccurrenceDefinitionPrefix 'part' 'def' Definition + +PartUsage = + OccurrenceUsagePrefix 'part' Usage + +// Clause 8.2.2.12 Ports Textual Notation + +PortDefinition = + DefinitionPrefix 'port' 'def' Definition + ownedRelationship += ConjugatedPortDefinitionMember + { conjugatedPortDefinition.ownedPortConjugator. + originalPortDefinition = this } + +// (See Note 1) + +ConjugatedPortDefinitionMember : OwningMembership = + ownedRelatedElement += ConjugatedPortDefinition + +ConjugatedPortDefinition = + ownedRelationship += PortConjugation + +PortConjugation = + {} + +PortUsage = + OccurrenceUsagePrefix 'port' Usage + +ConjugatedPortTyping : ConjugatedPortTyping = + '~' originalPortDefinition = ~[QualifiedName] + +// (See Note 2) + +// Notes: +// 1. Even though it is not explicitly represented in the text, a PortDefinition is always parsed as containing a nested ConjugatedPortDefinition with a PortDefinition Relationship pointing back to the containing PortDefinition. The abstract syntax for ConjugatedPortDefinition sets its effectiveName to the name of its originalPortDefinition with the symbol ~ prepended to it (see 8.3.12.2). (See also 8.4.8.1.) +// 2. The notation ~[QualifiedName] indicates that a QualifiedName shall be parsed from the input text, but that it shall be resolved as if it was the qualified name constructed as follows: +// • Extract the last segment name of the given QualifiedName and prepend the symbol ~ to it. +// • Append the name so constructed to the end of the entire original QualifiedName. +// For example, if the ConjugatedPortTyping is ~A::B::C, then the given QualifiedName is A::B::C, and ~[QualifiedName] is resolved as A::B::C::'~C'. Alternatively, a conforming tool may first resolve the given QualifiedName as usual to a PortDefinition and then use the conjugatedPortDefinition of this PortDefinition as the resolution of ~[QualifiedName]. + +// Clause 8.2.2.13 Connections Textual Notation + +// Clause 8.2.2.13.1 Connection Definition and Usage + +ConnectionDefinition = + OccurrenceDefinitionPrefix 'connection' 'def' Definition + +ConnectionUsage = + OccurrenceUsagePrefix + ( 'connection' UsageDeclaration ValuePart? + ( 'connect' ConnectorPart )? + | 'connect' ConnectorPart ) + UsageBody + +ConnectorPart : ConnectionUsage = + BinaryConnectorPart | NaryConnectorPart + +BinaryConnectorPart : ConnectionUsage = + ownedRelationship += ConnectorEndMember 'to' + ownedRelationship += ConnectorEndMember + +NaryConnectorPart : ConnectionUsage = + '(' ownedRelationship += ConnectorEndMember ',' + ownedRelationship += ConnectorEndMember + ( ',' ownedRelationship += ConnectorEndMember )* ')' + +ConnectorEndMember : EndFeatureMembership = + ownedRelatedElement += ConnectorEnd + +ConnectorEnd : ReferenceUsage = + ( ownedRelationship += OwnedCrossMultiplicityMember )? + ( declaredName = NAME REFERENCES )? + ownedRelationship += OwnedReferenceSubsetting + +OwnedCrossMultiplicityMember : OwningMembership = + ownedRelatedElement += OwnedCrossMultiplicity + +OwnedCrossMultiplicity : Feature = + ownedRelationship += OwnedMultiplicity + +// Clause 8.2.2.13.2 Binding Connectors + +BindingConnectorAsUsage = + UsagePrefix ( 'binding' UsageDeclaration )? + 'bind' ownedRelationship += ConnectorEndMember + '=' ownedRelationship += ConnectorEndMember + UsageBody + +// Clause 8.2.2.13.3 Successions + +SuccessionAsUsage = + UsagePrefix ( 'succession' UsageDeclaration )? + 'first' s.ownedRelationship += ConnectorEndMember + 'then' s.ownedRelationship += ConnectorEndMember + UsageBody + +// Clause 8.2.2.14 Interfaces Textual Notation + +// Clause 8.2.2.14.1 Interface Definitions + +InterfaceDefinition = + OccurrenceDefinitionPrefix 'interface' 'def' + DefinitionDeclaration InterfaceBody + +InterfaceBody : Type = + ';' | '{' InterfaceBodyItem* '}' + +InterfaceBodyItem : Type = + ownedRelationship += DefinitionMember + | ownedRelationship += VariantUsageMember + | ownedRelationship += InterfaceNonOccurrenceUsageMember + | ( ownedRelationship += SourceSuccessionMember )? + ownedRelationship += InterfaceOccurrenceUsageMember + | ownedRelationship += AliasMember + | ownedRelationship += Import + +InterfaceNonOccurrenceUsageMember : FeatureMembership = + MemberPrefix ownedRelatedElement += InterfaceNonOccurrenceUsageElement + +InterfaceNonOccurrenceUsageElement : Usage = + ReferenceUsage + | AttributeUsage + | EnumerationUsage + | BindingConnectorAsUsage + | SuccessionAsUsage + +InterfaceOccurrenceUsageMember : FeatureMembership = + MemberPrefix ownedRelatedElement += InterfaceOccurrenceUsageElement + +InterfaceOccurrenceUsageElement : Usage = + DefaultInterfaceEnd | StructureUsageElement | BehaviorUsageElement + +DefaultInterfaceEnd : PortUsage = + isEnd ?= 'end' Usage + +// Clause 8.2.2.14.2 Interface Usages + +InterfaceUsage = + OccurrenceUsagePrefix 'interface' + InterfaceUsageDeclaration InterfaceBody + +InterfaceUsageDeclaration : InterfaceUsage = + UsageDeclaration ValuePart? + ( 'connect' InterfacePart )? + | InterfacePart + +InterfacePart : InterfaceUsage = + BinaryInterfacePart | NaryInterfacePart + +BinaryInterfacePart : InterfaceUsage = + ownedRelationship += InterfaceEndMember 'to' + ownedRelationship += InterfaceEndMember + +NaryInterfacePart : InterfaceUsage = + '(' ownedRelationship += InterfaceEndMember ',' + ownedRelationship += InterfaceEndMember + ( ',' ownedRelationship += InterfaceEndMember )* ')' + +InterfaceEndMember : EndFeatureMembership = + ownedRelatedElement += InterfaceEnd + +InterfaceEnd : PortUsage = + ( ownedRelationship += OwnedCrossMultiplicityMember )? + ( declaredName = NAME REFERENCES )? + ownedRelationship += OwnedReferenceSubsetting + +// Clause 8.2.2.15 Allocations Textual Notation + +AllocationDefinition = + OccurrenceDefinitionPrefix 'allocation' 'def' Definition + +AllocationUsage = + OccurrenceUsagePrefix + AllocationUsageDeclaration UsageBody + +AllocationUsageDeclaration : AllocationUsage = + 'allocation' UsageDeclaration + ( 'allocate' ConnectorPart )? + | 'allocate' ConnectorPart + +// Clause 8.2.2.16 Flows Textual Notation + +FlowDefinition = + OccurrenceDefinitionPrefix 'flow' 'def' Definition + +Message : FlowUsage = + OccurrenceUsagePrefix 'message' + MessageDeclaration DefinitionBody + { isAbstract = true } + +MessageDeclaration : FlowUsage = + UsageDeclaration ValuePart? + ( 'of' ownedRelationship += FlowPayloadFeatureMember )? + ( 'from' ownedRelationship += MessageEventMember + 'to' ownedRelationship += MessageEventMember + )? + | ownedRelationship += MessageEventMember 'to' + ownedRelationship += MessageEventMember + +MessageEventMember : ParameterMembership = + ownedRelatedElement += MessageEvent + +MessageEvent : EventOccurrenceUsage = + ownedRelationship += OwnedReferenceSubsetting + +FlowUsage = + OccurrenceUsagePrefix 'flow' + FlowDeclaration DefinitionBody + +SuccessionFlowUsage = + OccurrenceUsagePrefix 'succession' 'flow' + FlowDeclaration DefinitionBody + +FlowDeclaration : FlowUsage = + UsageDeclaration ValuePart? + ( 'of' ownedRelationship += FlowPayloadFeatureMember )? + ( 'from' ownedRelationship += FlowEndMember + 'to' ownedRelationship += FlowEndMember )? + | ownedRelationship += FlowEndMember 'to' + ownedRelationship += FlowEndMember + +FlowPayloadFeatureMember : FeatureMembership = + ownedRelatedElement += FlowPayloadFeature + +FlowPayloadFeature : PayloadFeature = + PayloadFeature + +PayloadFeature : Feature = + Identification? PayloadFeatureSpecializationPart + ValuePart? + | ownedRelationship += OwnedFeatureTyping + ( ownedRelationship += OwnedMultiplicity )? + | ownedRelationship += OwnedMultiplicity + ownedRelationship += OwnedFeatureTyping + +PayloadFeatureSpecializationPart : Feature = + ( FeatureSpecialization )+ MultiplicityPart? + FeatureSpecialization* + | MultiplicityPart FeatureSpecialization+ + +FlowEndMember : EndFeatureMembership = + ownedRelatedElement += FlowEnd + +FlowEnd = + ( ownedRelationship += FlowEndSubsetting )? + ownedRelationship += FlowFeatureMember + +FlowEndSubsetting : ReferenceSubsetting = + referencedFeature = [QualifiedName] + | referencedFeature = FeatureChainPrefix + { ownedRelatedElement += referencedFeature } + +FeatureChainPrefix : Feature = + ( ownedRelationship += OwnedFeatureChaining '.' )+ + ownedRelationship += OwnedFeatureChaining '.' + +FlowFeatureMember : FeatureMembership = + ownedRelatedElement += FlowFeature + +FlowFeature : ReferenceUsage = + ownedRelationship += FlowFeatureRedefinition + +// (See Note 1) + +FlowFeatureRedefinition : Redefinition = + redefinedFeature = [QualifiedName] + +// Notes: +// 1. To ensure that a FlowFeature passes the validateRedefinitionDirectionConformance constraint (see [KerML, 8.3.3.3.8]), its direction must be set to the direction of its redefinedFeature, relative to its owning FlowEnd, that is, the result of the following OCL expression: owningType.directionOf(ownedRedefinition->at(1).redefinedFeature) + +// Clause 8.2.2.17 Actions Textual Notation + +// Clause 8.2.2.17.1 Action Definitions + +ActionDefinition = + OccurrenceDefinitionPrefix 'action' 'def' + DefinitionDeclaration ActionBody + +ActionBody : Type = + ';' | '{' ActionBodyItem* '}' + +ActionBodyItem : Type = + NonBehaviorBodyItem + | ownedRelationship += InitialNodeMember + ( ownedRelationship += ActionTargetSuccessionMember )* + | ( ownedRelationship += SourceSuccessionMember )? + ownedRelationship += ActionBehaviorMember + ( ownedRelationship += ActionTargetSuccessionMember )* + | ownedRelationship += GuardedSuccessionMember + +NonBehaviorBodyItem = + ownedRelationship += Import + | ownedRelationship += AliasMember + | ownedRelationship += DefinitionMember + | ownedRelationship += VariantUsageMember + | ownedRelationship += NonOccurrenceUsageMember + | ( ownedRelationship += SourceSuccessionMember )? + ownedRelationship += StructureUsageMember + +ActionBehaviorMember : FeatureMembership = + BehaviorUsageMember | ActionNodeMember + +InitialNodeMember : FeatureMembership = + MemberPrefix 'first' memberFeature = [QualifiedName] + RelationshipBody + +ActionNodeMember : FeatureMembership = + MemberPrefix ownedRelatedElement += ActionNode + +ActionTargetSuccessionMember : FeatureMembership = + MemberPrefix ownedRelatedElement += ActionTargetSuccession + +GuardedSuccessionMember : FeatureMembership = + MemberPrefix ownedRelatedElement += GuardedSuccession + +// Clause 8.2.2.17.2 Action Usages + +ActionUsage = + OccurrenceUsagePrefix 'action' + ActionUsageDeclaration ActionBody + +ActionUsageDeclaration : ActionUsage = + UsageDeclaration ValuePart? + +PerformActionUsage = + OccurrenceUsagePrefix 'perform' + PerformActionUsageDeclaration ActionBody + +PerformActionUsageDeclaration : PerformActionUsage = + ( ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? + | 'action' UsageDeclaration ) + ValuePart? + +ActionNode : ActionUsage = + ControlNode + | SendNode | AcceptNode + | AssignmentNode + | TerminateNode + | IfNode | WhileLoopNode | ForLoopNode + +ActionNodeUsageDeclaration : ActionUsage = + 'action' UsageDeclaration? + +ActionNodePrefix : ActionUsage = + OccurrenceUsagePrefix ActionNodeUsageDeclaration? + +// Clause 8.2.2.17.3 Control Nodes + +ControlNode = + MergeNode | DecisionNode | JoinNode| ForkNode + +ControlNodePrefix : OccurrenceUsage = + RefPrefix + ( isIndividual ?= 'individual' )? + ( portionKind = PortionKind + { isPortion = true } + )? + UsageExtensionKeyword* + +MergeNode = + ControlNodePrefix + isComposite ?= 'merge' UsageDeclaration + ActionBody + +DecisionNode = + ControlNodePrefix + isComposite ?= 'decide' UsageDeclaration + ActionBody + +JoinNode = + ControlNodePrefix + isComposite ?= 'join' UsageDeclaration + ActionBody + +ForkNode = + ControlNodePrefix + isComposite ?= 'fork' UsageDeclaration + ActionBody + +// Clause 8.2.2.17.4 Send and Accept Action Usages + +AcceptNode : AcceptActionUsage = + OccurrenceUsagePrefix + AcceptNodeDeclaration ActionBody + +AcceptNodeDeclaration : AcceptActionUsage = + ActionNodeUsageDeclaration? + 'accept' AcceptParameterPart + +AcceptParameterPart : AcceptActionUsage = + ownedRelationship += PayloadParameterMember + ( 'via' ownedRelationship += NodeParameterMember )? + +PayloadParameterMember : ParameterMembership = + ownedRelatedElement += PayloadParameter + +PayloadParameter : ReferenceUsage = + PayloadFeature + | Identification PayloadFeatureSpecializationPart? + TriggerValuePart + +TriggerValuePart : Feature = + ownedRelationship += TriggerFeatureValue + +TriggerFeatureValue : FeatureValue = + ownedRelatedElement += TriggerExpression + +TriggerExpression : TriggerInvocationExpression = + kind = ( 'at' | 'after' ) + ownedRelationship += ArgumentMember + | kind = 'when' + ownedRelationship += ArgumentExpressionMember + +ArgumentMember : ParameterMembership = + ownedMemberParameter = Argument + +Argument : Feature = + ownedRelationship += ArgumentValue + +ArgumentValue : FeatureValue = + value = OwnedExpression + +ArgumentExpressionMember : ParameterMembership = + ownedRelatedElement += ArgumentExpression + +ArgumentExpression : Feature = + ownedRelationship += ArgumentExpressionValue + +ArgumentExpressionValue : FeatureValue = + ownedRelatedElement += OwnedExpressionReference + +SendNode : SendActionUsage = + OccurrenceUsagePrefix ActionUsageDeclaration? 'send' + ( ownedRelationship += NodeParameterMember SenderReceiverPart? + | ownedRelationship += EmptyParameterMember SenderReceiverPart )? + ActionBody + +SendNodeDeclaration : SendActionUsage = + ActionNodeUsageDeclaration? 'send' + ownedRelationship += NodeParameterMember SenderReceiverPart? + +SenderReceiverPart : SendActionUsage = + 'via' ownedRelationship += NodeParameterMember + ( 'to' ownedRelationship += NodeParameterMember )? + | ownedRelationship += EmptyParameterMember + 'to' ownedRelationship += NodeParameterMember + +NodeParameterMember : ParameterMembership = + ownedRelatedElement += NodeParameter + +NodeParameter : ReferenceUsage = + ownedRelationship += FeatureBinding + +FeatureBinding : FeatureValue = + ownedRelatedElement += OwnedExpression + +EmptyParameterMember : ParameterMembership = + ownedRelatedElement += EmptyUsage + +EmptyUsage : ReferenceUsage = + {} + +// Notes: +// 1. The productions for ArgumentMember, Argument, ArgumentValue, ArgumentExpressionMember, ArgumentExpression and ArgumentExpressionValue are the same as given in [KerML, 8.2.5.8.1]. + +// Clause 8.2.2.17.5 Assignment Action Usages + +AssignmentNode : AssignmentActionUsage = + OccurrenceUsagePrefix + AssignmentNodeDeclaration ActionBody + +AssignmentNodeDeclaration: ActionUsage = + ( ActionNodeUsageDeclaration )? 'assign' + ownedRelationship += AssignmentTargetMember + ownedRelationship += FeatureChainMember ':=' + ownedRelationship += NodeParameterMember + +AssignmentTargetMember : ParameterMembership = + ownedRelatedElement += AssignmentTargetParameter + +AssignmentTargetParameter : ReferenceUsage = + ( ownedRelationship += AssignmentTargetBinding '.' )? + +AssignmentTargetBinding : FeatureValue = + ownedRelatedElement += NonFeatureChainPrimaryExpression + +FeatureChainMember : Membership = + memberElement = [QualifiedName] + | OwnedFeatureChainMember + +OwnedFeatureChainMember : OwningMembership = + ownedRelatedElement += OwnedFeatureChain + +// Clause 8.2.2.17.6 Terminate Action Usages + +TerminateNode : TerminateActionUsage = + OccurrenceUsagePrefix ActionNodeUsageDeclaration? + 'terminate' ( ownedRelationship += NodeParameterMember )? + ActionBody + +// Clause 8.2.2.17.7 Structured Control Action Usages + +IfNode : IfActionUsage = + ActionNodePrefix + 'if' ownedRelationship += ExpressionParameterMember + ownedRelationship += ActionBodyParameterMember + ( 'else' ownedRelationship += + ( ActionBodyParameterMember | IfNodeParameterMember ) )? + +ExpressionParameterMember : ParameterMembership = + ownedRelatedElement += OwnedExpression + +ActionBodyParameterMember : ParameterMembership = + ownedRelatedElement += ActionBodyParameter + +ActionBodyParameter : ActionUsage = + ( 'action' UsageDeclaration? )? + '{' ActionBodyItem* '}' + +IfNodeParameterMember : ParameterMembership = + ownedRelatedElement += IfNode + +WhileLoopNode : WhileLoopActionUsage = + ActionNodePrefix + ( 'while' ownedRelationship += ExpressionParameterMember + | 'loop' ownedRelationship += EmptyParameterMember + ) + ownedRelationship += ActionBodyParameterMember + ( 'until' ownedRelationship += ExpressionParameterMember ';' )? + +ForLoopNode : ForLoopActionUsage = + ActionNodePrefix + 'for' ownedRelationship += ForVariableDeclarationMember + 'in' ownedRelationship += NodeParameterMember + ownedRelationship += ActionBodyParameterMember + +ForVariableDeclarationMember : FeatureMembership = + ownedRelatedElement += UsageDeclaration + +ForVariableDeclaration : ReferenceUsage = + UsageDeclaration + +// Clause 8.2.2.17.8 Action Successions + +ActionTargetSuccession : Usage = + ( TargetSuccession | GuardedTargetSuccession | DefaultTargetSuccession ) + UsageBody + +TargetSuccession : SuccessionAsUsage = + ownedRelationship += SourceEndMember + 'then' ownedRelationship += ConnectorEndMember + +GuardedTargetSuccession : TransitionUsage = + ownedRelationship += GuardExpressionMember + 'then' ownedRelationship += TransitionSuccessionMember + +DefaultTargetSuccession : TransitionUsage = + 'else' ownedRelationship += TransitionSuccessionMember + +GuardedSuccession : TransitionUsage = + ( 'succession' UsageDeclaration )? + 'first' ownedRelationship += FeatureChainMember + ownedRelationship += GuardExpressionMember + 'then' ownedRelationship += TransitionSuccessionMember + UsageBody + +// Clause 8.2.2.18 States Textual Notation + +// Clause 8.2.2.18.1 State Definitions + +StateDefinition = + OccurrenceDefinitionPrefix 'state' 'def' + DefinitionDeclaration StateDefBody + +StateDefBody : StateDefinition = + ';' + | ( isParallel ?= 'parallel' )? + '{' StateBodyItem* '}' + +StateBodyItem : Type = + NonBehaviorBodyItem + | ( ownedRelationship += SourceSuccessionMember )? + ownedRelationship += BehaviorUsageMember + ( ownedRelationship += TargetTransitionUsageMember )* + | ownedRelationship += TransitionUsageMember + | ownedRelationship += EntryActionMember + ( ownedRelationship += EntryTransitionMember )* + | ownedRelationship += DoActionMember + | ownedRelationship += ExitActionMember + +EntryActionMember : StateSubactionMembership = + MemberPrefix kind = 'entry' + ownedRelatedElement += StateActionUsage + +DoActionMember : StateSubactionMembership = + MemberPrefix kind = 'do' + ownedRelatedElement += StateActionUsage + +ExitActionMember : StateSubactionMembership = + MemberPrefix kind = 'exit' + ownedRelatedElement += StateActionUsage + +EntryTransitionMember : FeatureMembership = + MemberPrefix + ( ownedRelatedElement += GuardedTargetSuccession + | 'then' ownedRelatedElement += TargetSuccession + ) ';' + +StateActionUsage : ActionUsage = + EmptyActionUsage ';' + | StatePerformActionUsage + | StateAcceptActionUsage + | StateSendActionUsage + | StateAssignmentActionUsage + +EmptyActionUsage : ActionUsage = + {} + +StatePerformActionUsage : PerformActionUsage = + PerformActionUsageDeclaration ActionBody + +StateAcceptActionUsage : AcceptActionUsage = + AcceptNodeDeclaration ActionBody + +StateSendActionUsage : SendActionUsage = + SendNodeDeclaration ActionBody + +StateAssignmentActionUsage : AssignmentActionUsage = + AssignmentNodeDeclaration ActionBody + +TransitionUsageMember : FeatureMembership = + MemberPrefix ownedRelatedElement += TransitionUsage + +TargetTransitionUsageMember : FeatureMembership = + MemberPrefix ownedRelatedElement += TargetTransitionUsage + +// Clause 8.2.2.18.2 State Usages + +StateUsage = + OccurrenceUsagePrefix 'state' + ActionUsageDeclaration StateUsageBody + +StateUsageBody : StateUsage = + ';' + | ( isParallel ?= 'parallel' )? + '{' StateBodyItem* '}' + +ExhibitStateUsage = + OccurrenceUsagePrefix 'exhibit' + ( ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? + | 'state' UsageDeclaration ) + ValuePart? StateUsageBody + +// Clause 8.2.2.18.3 Transition Usages + +TransitionUsage = + 'transition' ( UsageDeclaration 'first' )? + ownedRelationship += FeatureChainMember + ownedRelationship += EmptyParameterMember + ( ownedRelationship += EmptyParameterMember + ownedRelationship += TriggerActionMember )? + ( ownedRelationship += GuardExpressionMember )? + ( ownedRelationship += EffectBehaviorMember )? + 'then' ownedRelationship += TransitionSuccessionMember + ActionBody + +TargetTransitionUsage : TransitionUsage = + ownedRelationship += EmptyParameterMember + ( 'transition' + ( ownedRelationship += EmptyParameterMember + ownedRelationship += TriggerActionMember )? + ( ownedRelationship += GuardExpressionMember )? + ( ownedRelationship += EffectBehaviorMember )? + | ownedRelationship += EmptyParameterMember + ownedRelationship += TriggerActionMember + ( ownedRelationship += GuardExpressionMember )? + ( ownedRelationship += EffectBehaviorMember )? + | ownedRelationship += GuardExpressionMember + ( ownedRelationship += EffectBehaviorMember )? + )? + 'then' ownedRelationship += TransitionSuccessionMember + ActionBody + +TriggerActionMember : TransitionFeatureMembership = + 'accept' { kind = 'trigger' } ownedRelatedElement += TriggerAction + +TriggerAction : AcceptActionUsage = + AcceptParameterPart + +GuardExpressionMember : TransitionFeatureMembership = + 'if' { kind = 'guard' } ownedRelatedElement += OwnedExpression + +EffectBehaviorMember : TransitionFeatureMembership = + 'do' { kind = 'effect' } ownedRelatedElement += EffectBehaviorUsage + +EffectBehaviorUsage : ActionUsage = + EmptyActionUsage + | TransitionPerformActionUsage + | TransitionAcceptActionUsage + | TransitionSendActionUsage + | TransitionAssignmentActionUsage + +TransitionPerformActionUsage : PerformActionUsage = + PerformActionUsageDeclaration ( '{' ActionBodyItem* '}' )? + +TransitionAcceptActionUsage : AcceptActionUsage = + AcceptNodeDeclaration ( '{' ActionBodyItem* '}' )? + +TransitionSendActionUsage : SendActionUsage = + SendNodeDeclaration ( '{' ActionBodyItem* '}' )? + +TransitionAssignmentActionUsage : AssignmentActionUsage = + AssignmentNodeDeclaration ( '{' ActionBodyItem* '}' )? + +TransitionSuccessionMember : OwningMembership = + ownedRelatedElement += TransitionSuccession + +TransitionSuccession : Succession = + ownedRelationship += EmptyEndMember + ownedRelationship += ConnectorEndMember + +EmptyEndMember : EndFeatureMembership = + ownedRelatedElement += EmptyFeature + +EmptyFeature : ReferenceUsage = + {} + +// Clause 8.2.2.19 Calculations Textual Notation + +CalculationDefinition = + OccurrenceDefinitionPrefix 'calc' 'def' + DefinitionDeclaration CalculationBody + +CalculationUsage : CalculationUsage = + OccurrenceUsagePrefix 'calc' + ActionUsageDeclaration CalculationBody + +CalculationBody : Type = + ';' | '{' CalculationBodyPart '}' + +CalculationBodyPart : Type = + CalculationBodyItem* + ( ownedRelationship += ResultExpressionMember )? + +CalculationBodyItem : Type = + ActionBodyItem + | ownedRelationship += ReturnParameterMember + +ReturnParameterMember : ReturnParameterMembership = + MemberPrefix? 'return' ownedRelatedElement += UsageElement + +ResultExpressionMember : ResultExpressionMembership = + MemberPrefix? ownedRelatedElement += OwnedExpression + +// Clause 8.2.2.20 Constraints Textual Notation + +ConstraintDefinition = + OccurrenceDefinitionPrefix 'constraint' 'def' + DefinitionDeclaration CalculationBody + +ConstraintUsage = + OccurrenceUsagePrefix 'constraint' + ConstraintUsageDeclaration CalculationBody + +AssertConstraintUsage = + OccurrenceUsagePrefix 'assert' ( isNegated ?= 'not' )? + ( ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? + | 'constraint' ConstraintUsageDeclaration ) + CalculationBody + +ConstraintUsageDeclaration : ConstraintUsage = + UsageDeclaration ValuePart? + +// Clause 8.2.2.21 Requirements Textual Notation + +// Clause 8.2.2.21.1 Requirement Definitions + +RequirementDefinition = + OccurrenceDefinitionPrefix 'requirement' 'def' + DefinitionDeclaration RequirementBody + +RequirementBody : Type = + ';' | '{' RequirementBodyItem* '}' + +RequirementBodyItem : Type = + DefinitionBodyItem + | ownedRelationship += SubjectMember + | ownedRelationship += RequirementConstraintMember + | ownedRelationship += FramedConcernMember + | ownedRelationship += RequirementVerificationMember + | ownedRelationship += ActorMember + | ownedRelationship += StakeholderMember + +SubjectMember : SubjectMembership = + MemberPrefix ownedRelatedElement += SubjectUsage + +SubjectUsage : ReferenceUsage = + 'subject' UsageExtensionKeyword* Usage + +RequirementConstraintMember : RequirementConstraintMembership = + MemberPrefix? RequirementKind + ownedRelatedElement += RequirementConstraintUsage + +RequirementKind : RequirementConstraintMembership = + 'assume' { kind = 'assumption' } + | 'require' { kind = 'requirement' } + +RequirementConstraintUsage : ConstraintUsage = + ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? RequirementBody + | ( UsageExtensionKeyword* 'constraint' + | UsageExtensionKeyword+ ) + ConstraintUsageDeclaration CalculationBody + +FramedConcernMember : FramedConcernMembership = + MemberPrefix? 'frame' + ownedRelatedElement += FramedConcernUsage + +FramedConcernUsage : ConcernUsage = + ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? CalculationBody + | ( UsageExtensionKeyword* 'concern' + | UsageExtensionKeyword+ ) + CalculationUsageDeclaration CalculationBody + +ActorMember : ActorMembership = + MemberPrefix ownedRelatedElement += ActorUsage + +ActorUsage : PartUsage = + 'actor' UsageExtensionKeyword* Usage + +StakeholderMember : StakeholderMembership = + MemberPrefix ownedRelatedElement += StakeholderUsage + +StakeholderUsage : PartUsage = + 'stakeholder' UsageExtensionKeyword* Usage + +// Clause 8.2.2.21.2 Requirement Usages + +RequirementUsage = + OccurrenceUsagePrefix 'requirement' + ConstraintUsageDeclaration RequirementBody + +SatisfyRequirementUsage = + OccurrenceUsagePrefix 'assert' ( isNegated ?= 'not' ) 'satisfy' + ( ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? + | 'requirement' UsageDeclaration ) + ValuePart? + ( 'by' ownedRelationship += SatisfactionSubjectMember )? + RequirementBody + +SatisfactionSubjectMember : SubjectMembership = + ownedRelatedElement += SatisfactionParameter + +SatisfactionParameter : ReferenceUsage = + ownedRelationship += SatisfactionFeatureValue + +SatisfactionFeatureValue : FeatureValue = + ownedRelatedElement += SatisfactionReferenceExpression + +SatisfactionReferenceExpression : FeatureReferenceExpression = + ownedRelationship += FeatureChainMember + +// Clause 8.2.2.21.3 Concerns + +ConcernDefinition = + OccurrenceDefinitionPrefix 'concern' 'def' + DefinitionDeclaration RequirementBody + +ConcernUsage = + OccurrenceUsagePrefix 'concern' + ConstraintUsageDeclaration RequirementBody + +// Clause 8.2.2.22 Cases Textual Notation + +CaseDefinition = + OccurrenceDefinitionPrefix 'case' 'def' + DefinitionDeclaration CaseBody + +CaseUsage = + OccurrenceUsagePrefix 'case' + ConstraintUsageDeclaration CaseBody + +CaseBody : Type = + ';' + | '{' CaseBodyItem* + ( ownedRelationship += ResultExpressionMember )? + '}' + +CaseBodyItem : Type = + ActionBodyItem + | ownedRelationship += SubjectMember + | ownedRelationship += ActorMember + | ownedRelationship += ObjectiveMember + +ObjectiveMember : ObjectiveMembership = + MemberPrefix 'objective' + ownedRelatedElement += ObjectiveRequirementUsage + +ObjectiveRequirementUsage : RequirementUsage = + UsageExtensionKeyword* ConstraintUsageDeclaration + RequirementBody + +// Clause 8.2.2.23 Analysis Cases Textual Notation + +AnalysisCaseDefinition = + OccurrenceDefinitionPrefix 'analysis' 'def' + DefinitionDeclaration CaseBody + +AnalysisCaseUsage = + OccurrenceUsagePrefix 'analysis' + ConstraintUsageDeclaration CaseBody + +// Clause 8.2.2.24 Verification Cases Textual Notation + +VerificationCaseDefinition = + OccurrenceDefinitionPrefix 'verification' 'def' + DefinitionDeclaration CaseBody + +VerificationCaseUsage = + OccurrenceUsagePrefix 'verification' + ConstraintUsageDeclaration CaseBody + +RequirementVerificationMember : RequirementVerificationMembership = + MemberPrefix 'verify' { kind = 'requirement' } + ownedRelatedElement += RequirementVerificationUsage + +RequirementVerificationUsage : RequirementUsage = + ownedRelationship += OwnedReferenceSubsetting + FeatureSpecialization* RequirementBody + | ( UsageExtensionKeyword* 'requirement' + | UsageExtensionKeyword+ ) + ConstraintUsageDeclaration RequirementBody + +// Clause 8.2.2.25 Use Cases Textual Notation + +UseCaseDefinition = + OccurrenceDefinitionPrefix 'use' 'case' 'def' + DefinitionDeclaration CaseBody + +UseCaseUsage = + OccurrenceUsagePrefix 'use' 'case' + ConstraintUsageDeclaration CaseBody + +IncludeUseCaseUsage = + OccurrenceUsagePrefix 'include' + ( ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? + | 'use' 'case' UsageDeclaration ) + ValuePart? + CaseBody + +// Clause 8.2.2.26 Views and Viewpoints Textual Notation + +// Clause 8.2.2.26.1 View Definitions + +ViewDefinition = + OccurrenceDefinitionPrefix 'view' 'def' + DefinitionDeclaration ViewDefinitionBody + +ViewDefinitionBody : ViewDefinition = + ';' | '{' ViewDefinitionBodyItem* '}' + +ViewDefinitionBodyItem : ViewDefinition = + DefinitionBodyItem + | ownedRelationship += ElementFilterMember + | ownedRelationship += ViewRenderingMember + +ViewRenderingMember : ViewRenderingMembership = + MemberPrefix 'render' + ownedRelatedElement += ViewRenderingUsage + +ViewRenderingUsage : RenderingUsage = + ownedRelationship += OwnedReferenceSubsetting + FeatureSpecializationPart? + UsageBody + | ( UsageExtensionKeyword* 'rendering' + | UsageExtensionKeyword+ ) + Usage + +// Clause 8.2.2.26.2 View Usages + +ViewUsage = + OccurrenceUsagePrefix 'view' + UsageDeclaration? ValuePart? + ViewBody + +ViewBody : ViewUsage = + ';' | '{' ViewBodyItem* '}' + +ViewBodyItem : ViewUsage = + DefinitionBodyItem + | ownedRelationship += ElementFilterMember + | ownedRelationship += ViewRenderingMember + | ownedRelationship += Expose + +Expose = + 'expose' ( MembershipExpose | NamespaceExpose ) + RelationshipBody + +MembershipExpose = + MembershipImport + +NamespaceExpose = + NamespaceImport + +// Clause 8.2.2.26.3 Viewpoints + +ViewpointDefinition = + OccurrenceDefinitionPrefix 'viewpoint' 'def' + DefinitionDeclaration RequirementBody + +ViewpointUsage = + OccurrenceUsagePrefix 'viewpoint' + ConstraintUsageDeclaration RequirementBody + +// Clause 8.2.2.26.4 Renderings + +RenderingDefinition = + OccurrenceDefinitionPrefix 'rendering' 'def' + Definition + +RenderingUsage = + OccurrenceUsagePrefix 'rendering' + Usage + +// Clause 8.2.2.27 Metadata Textual Notation + +MetadataDefinition = + ( isAbstract ?= 'abstract')? DefinitionExtensionKeyword* + 'metadata' 'def' Definition + +PrefixMetadataAnnotation : Annotation = + '#' annotatingElement = PrefixMetadataUsage + { ownedRelatedElement += annotatingElement } + +PrefixMetadataMember : OwningMembership = + '#' ownedRelatedElement = PrefixMetadataUsage + +PrefixMetadataUsage : MetadataUsage = + ownedRelationship += OwnedFeatureTyping + +MetadataUsage = + UsageExtensionKeyword* ( '@' | 'metadata' ) + MetadataUsageDeclaration + ( 'about' ownedRelationship += Annotation + ( ',' ownedRelationship += Annotation )* + )? + MetadataBody + +MetadataUsageDeclaration : MetadataUsage = + ( Identification ( ':' | 'typed' 'by' ) )? + ownedRelationship += OwnedFeatureTyping + +MetadataBody : Type = + ';' | + '{' ( ownedRelationship += DefinitionMember + | ownedRelationship += MetadataBodyUsageMember + | ownedRelationship += AliasMember + | ownedRelationship += Import + )* + '}' + +MetadataBodyUsageMember : FeatureMembership = + ownedMemberFeature = MetadataBodyUsage + +MetadataBodyUsage : ReferenceUsage = + 'ref'? ( ':>>' | 'redefines' )? ownedRelationship += OwnedRedefinition + FeatureSpecializationPart? ValuePart? + MetadataBody + +ExtendedDefinition : Definition = + BasicDefinitionPrefix? DefinitionExtensionKeyword+ + 'def' Definition + +ExtendedUsage : Usage = + UnextendedUsagePrefix UsageExtensionKeyword+ + Usage + +// End of BNF + + diff --git a/Resources/kebnf.g4 b/Resources/kebnf.g4 new file mode 100644 index 00000000..d059914a --- /dev/null +++ b/Resources/kebnf.g4 @@ -0,0 +1,104 @@ +// Grammar + +grammar kebnf; + +specification : (NL)* rule_definition+ EOF ; + +rule_definition + : name=UPPER_ID (params=parameter_list)? (COLON target_ast=UPPER_ID)? ASSIGN rule_body=alternatives SEMICOLON? NL+ + ; + +parameter_list + : LPAREN param_name=ID COLON param_type=ID RPAREN + ; + +alternatives + : alternative (PIPE alternative)* + ; + +alternative + : element* + ; + +element + : assignment + | non_parsing_assignment + | non_parsing_empty + | cross_reference + | group + | terminal + | non_terminal + | value_literal + ; + +assignment + : property=dotted_id op=(ASSIGN | ADD_ASSIGN | BOOL_ASSIGN) (prefix=TILDE)?content=element_core (suffix=suffix_op)? + ; + +non_parsing_assignment + : LBRACE property=dotted_id op=(ASSIGN | ADD_ASSIGN) val=value_literal RBRACE + ; + +non_parsing_empty + : LBRACE RBRACE + ; + +cross_reference + : TILDE? LBRACK ref=ID RBRACK + ; + +group + : LPAREN alternatives RPAREN (suffix=suffix_op)? + ; + +terminal + : val=SINGLE_QUOTED_STRING (suffix=suffix_op)? + ; + +non_terminal + : name=UPPER_ID (suffix=suffix_op)? + ; + +element_core + : cross_reference + | group + | terminal + | non_terminal + | value_literal + ; + +dotted_id + : ID (DOT ID)* + ; + +suffix_op : '*' | '+' | '?' ; + +value_literal : ID | INT | STRING | '[QualifiedName]' | SINGLE_QUOTED_STRING; + +// Lexer +ASSIGN : '::=' | '=' ; +ADD_ASSIGN : '+=' ; +BOOL_ASSIGN : '?=' ; +PIPE : '|' ; +COLON : ':' ; +SEMICOLON : ';' ; +COMMA : ',' ; +LPAREN : '(' ; +RPAREN : ')' ; +LBRACK : '[' ; +RBRACK : ']' ; +LBRACE : '{' ; +RBRACE : '}' ; +DOT : '.' ; +TILDE : '~' ; + +UPPER_ID : [A-Z] [a-zA-Z0-9_]* ; +ID : [a-zA-Z_][a-zA-Z0-9_]* ; +SINGLE_QUOTED_STRING : '\'' (~['\\] | '\\' .)* '\'' ; +INT : [0-9]+ ; +STRING : '\'' ( ~['\\] | '\\' . )* '\'' ; + +COMMENT : '//' ~[\r\n]* -> skip ; +WS : [ \t]+ -> skip ; +CONTINUATION : '\r'? '\n' [ \t]+ -> skip ; +NL : '\r'? '\n' ; \ No newline at end of file diff --git a/SysML2.NET.CodeGenerator.Tests/Generators/UmlHandleBarsGenerators/UmlCoreTextualNotationBuilderGeneratorTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/Generators/UmlHandleBarsGenerators/UmlCoreTextualNotationBuilderGeneratorTestFixture.cs new file mode 100644 index 00000000..373705c5 --- /dev/null +++ b/SysML2.NET.CodeGenerator.Tests/Generators/UmlHandleBarsGenerators/UmlCoreTextualNotationBuilderGeneratorTestFixture.cs @@ -0,0 +1,71 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Tests.Generators.UmlHandleBarsGenerators +{ + using System.IO; + using System.Linq; + using System.Threading.Tasks; + + using NUnit.Framework; + + using SysML2.NET.CodeGenerator.Generators.UmlHandleBarsGenerators; + using SysML2.NET.CodeGenerator.Grammar; + using SysML2.NET.CodeGenerator.Grammar.Model; + + [TestFixture] + public class UmlCoreTextualNotationBuilderGeneratorTestFixture + { + private DirectoryInfo umlPocoDirectoryInfo; + private UmlCoreTextualNotationBuilderGenerator umlCoreTextualNotationBuilderGenerator; + private TextualNotationSpecification textualNotationSpecification; + + [OneTimeSetUp] + public void OneTimeSetup() + { + var directoryInfo = new DirectoryInfo(TestContext.CurrentContext.TestDirectory); + + var path = Path.Combine("UML", "_SysML2.NET.Core.UmlCoreTextualNotationBuilderGenerator"); + + this.umlPocoDirectoryInfo = directoryInfo.CreateSubdirectory(path); + this.umlCoreTextualNotationBuilderGenerator = new UmlCoreTextualNotationBuilderGenerator(); + + var textualRulesFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, "datamodel"); + var kermlRules = GrammarLoader.LoadTextualNotationSpecification(Path.Combine(textualRulesFolder, "KerML-textual-bnf.kebnf")); + var sysmlRules = GrammarLoader.LoadTextualNotationSpecification(Path.Combine(textualRulesFolder, "SysML-textual-bnf.kebnf")); + + var combinesRules = new TextualNotationSpecification(); + combinesRules.Rules.AddRange(sysmlRules.Rules); + + foreach (var rule in kermlRules.Rules.Where(rule => combinesRules.Rules.All(r => r.RuleName != rule.RuleName))) + { + combinesRules.Rules.Add(rule); + } + + this.textualNotationSpecification = combinesRules; + } + + [Test] + public async Task VerifyCanGenerateTextualNotation() + { + await Assert.ThatAsync(() => this.umlCoreTextualNotationBuilderGenerator.GenerateAsync(GeneratorSetupFixture.XmiReaderResult, this.textualNotationSpecification, this.umlPocoDirectoryInfo), Throws.Nothing); + } + } +} diff --git a/SysML2.NET.CodeGenerator.Tests/Grammar/TextualNotationSpecificationVisitorTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/Grammar/TextualNotationSpecificationVisitorTestFixture.cs new file mode 100644 index 00000000..7990d4cc --- /dev/null +++ b/SysML2.NET.CodeGenerator.Tests/Grammar/TextualNotationSpecificationVisitorTestFixture.cs @@ -0,0 +1,64 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Tests.Grammar +{ + using System; + using System.IO; + using System.Linq; + + using Antlr4.Runtime; + + using NUnit.Framework; + + using SysML2.NET.CodeGenerator.Grammar; + using SysML2.NET.CodeGenerator.Grammar.Model; + + [TestFixture] + public class TextualNotationSpecificationVisitorTestFixture + { + [Test] + [TestCase("KerML-textual-bnf.kebnf")] + [TestCase("SysML-textual-bnf.kebnf")] + public void VerifyCanParseGrammar(string modelName) + { + var filePath = Path.Combine(TestContext.CurrentContext.TestDirectory, "datamodel",modelName ); + + var stream = CharStreams.fromPath(filePath); + var lexer = new kebnfLexer(stream); + var tokens = new CommonTokenStream(lexer); + var parser = new kebnfParser(tokens); + + var tree = parser.specification(); + var explorer = new TextualNotationSpecificationVisitor(); + var result = (TextualNotationSpecification)explorer.Visit(tree); + var rules = result.Rules; + + using (Assert.EnterMultipleScope()) + { + Assert.That(rules, Is.Not.Null); + Assert.That(rules, Is.Not.Empty); + Assert.That(rules.DistinctBy(x => x.RuleName), Is.EquivalentTo(rules)); + } + + Console.WriteLine($"Found {rules.Count} rules"); + } + } +} diff --git a/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs b/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs index a59fea30..3eadb42b 100644 --- a/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs +++ b/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs @@ -20,18 +20,15 @@ namespace SysML2.NET.CodeGenerator.Extensions { - using System; - using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using uml4net.Classification; using uml4net.Extensions; - using uml4net.Packages; using uml4net.StructuredClassifiers; /// - /// Extension methods for interface + /// Extension methods for interface /// public static class ClassExtensions { @@ -40,10 +37,10 @@ public static class ClassExtensions /// or interface implementations EXCLUDING IsDerived /// /// - /// The from which to query the properties + /// The from which to query the properties /// /// - /// A of + /// A of /// public static ReadOnlyCollection QueryAllNonDerivedProperties(this IClass @class) { @@ -59,10 +56,10 @@ public static ReadOnlyCollection QueryAllNonDerivedProperties(this IC /// redefined in the context of the current class /// /// - /// The from which to query the properties + /// The from which to query the properties /// /// - /// A of + /// A of /// public static ReadOnlyCollection QueryAllNonDerivedNonRedefinedProperties(this IClass @class) { @@ -78,7 +75,7 @@ public static ReadOnlyCollection QueryAllNonDerivedNonRedefinedProper /// Counts and returns to amount of non derived properties /// /// - /// The subject + /// The subject /// /// /// the amount of non derived properties @@ -92,7 +89,7 @@ public static int CountAllNonDerivedProperties(this IClass @class) /// Counts and returns to amount of non derived properties /// /// - /// The subject + /// The subject /// /// /// the amount of non derived properties @@ -103,20 +100,36 @@ public static int CountAllNonDerivedNonRedefinedProperties(this IClass @class) } /// - /// Query the name of the internal interface to implement for an + /// Query the name of the internal interface to implement for an /// - /// The + /// The /// The name of the internal interface to implement, if any public static string QueryInternalInterfaceName(this IClass umlClass) { var classifiers = umlClass.QueryAllGeneralClassifiers(); - + if (classifiers.Any(x => x.Name == "Relationship")) { return "IContainedRelationship"; } - + return classifiers.Any(x => x.Name == "Element") ? "IContainedElement" : string.Empty; } + + /// + /// Asserts that an is a subclass of another + /// + /// The to check + /// + /// The that is potentially a super class of + /// + /// + /// + /// True if the is a super class of the + /// + public static bool QueryIsSubclassOf(this IClass umlClass, IClass potentialSuperClass) + { + return umlClass.QueryAllGeneralClassifiers().Contains(potentialSuperClass); + } } } diff --git a/SysML2.NET.CodeGenerator/Extensions/NamedElementExtensions.cs b/SysML2.NET.CodeGenerator/Extensions/NamedElementExtensions.cs index 402bc345..9bea96a6 100644 --- a/SysML2.NET.CodeGenerator/Extensions/NamedElementExtensions.cs +++ b/SysML2.NET.CodeGenerator/Extensions/NamedElementExtensions.cs @@ -20,9 +20,11 @@ namespace SysML2.NET.CodeGenerator.Extensions { + using System; using System.Linq; using uml4net.CommonStructure; + using uml4net.SimpleClassifiers; /// /// Extension class for @@ -40,5 +42,36 @@ public static string QueryNamespace(this INamedElement namedElement) var namespaces = qualifiedNameSpaces.Skip(1).Take(qualifiedNameSpaces.Length - 2); return string.Join('.', namespaces); } + + /// + /// Query the fully qualified type name (Namespace + Type name). + /// + /// The specific that should have the fully qualified type name computed + /// A specific namespace part (POCO/DTO distinction) + /// Asserts if the type should be the interface name or not + /// The fully qualified type name + public static string QueryFullyQualifiedTypeName(this INamedElement namedElement, string namespacePart = "POCO", bool targetInterface = true) + { + ArgumentNullException.ThrowIfNull(namedElement); + ArgumentException.ThrowIfNullOrWhiteSpace(namespacePart); + + var typeName = "SysML2.NET.Core."; + + if (namedElement is not IEnumeration) + { + typeName += $"{namespacePart}."; + } + + typeName += namedElement.QueryNamespace(); + typeName += "."; + + if (namedElement is not IEnumeration && targetInterface) + { + typeName += "I"; + } + + typeName += namedElement.Name; + return typeName; + } } } diff --git a/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs b/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs index e9032015..28759163 100644 --- a/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs +++ b/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs @@ -92,5 +92,49 @@ public static bool QueryPropertyIsPartOfNonDerivedCompositeAggregation(this IPro return property.Opposite is { IsComposite: true, IsDerived: false }; } + + /// + /// Queries the content of a IF statement for non-empty values + /// + /// The property that have to be used to produce the content + /// The name of the name + /// The If Statement content + public static string QueryIfStatementContentForNonEmpty(this IProperty property, string variableName) + { + var propertyName = property.QueryPropertyNameBasedOnUmlProperties(); + + if (property.QueryIsEnumerable()) + { + return $"{variableName}.Current != null"; + } + + if (property.QueryIsReferenceType()) + { + return $"{variableName}.{propertyName} != null"; + } + + if (property.QueryIsNullableAndNotString()) + { + return $"{variableName}.{propertyName}.HasValue"; + } + + if (property.QueryIsString()) + { + return $"!string.IsNullOrWhiteSpace({variableName}.{propertyName})"; + } + + if (property.QueryIsBool()) + { + return $"{variableName}.{propertyName}"; + } + + if (property.QueryIsEnum()) + { + var defaultValue = property.QueryIsEnumPropertyWithDefaultValue() ? $"{property.Type.QueryFullyQualifiedTypeName()}.{property.QueryDefaultValueAsString().CapitalizeFirstLetter()}" : ((IEnumeration)property.Type).OwnedLiteral[0].Name; + return $"{variableName}.{propertyName} != {defaultValue}"; + } + + return "THIS WILL PRODUCE COMPILE ERROR"; + } } } diff --git a/SysML2.NET.CodeGenerator/GRAMMAR.md b/SysML2.NET.CodeGenerator/GRAMMAR.md new file mode 100644 index 00000000..36f67755 --- /dev/null +++ b/SysML2.NET.CodeGenerator/GRAMMAR.md @@ -0,0 +1,118 @@ +# Grammar Code Generation Guide + +This file provides essential context for working on the SysML2 textual notation code generator (`RulesHelper.cs` and related files). Read this when modifying grammar processing or the `TextualNotationBuilder` generation pipeline. + +## Pipeline Overview + +``` +KEBNF grammar files (Grammar/Resources/*.kebnf) + parsed by Grammar/TextualNotationSpecificationVisitor + into Grammar/Model/* (RuleElement hierarchy) + processed by HandleBarHelpers/RulesHelper.cs + via Handlebars template (Templates/Uml/textualNotationBuilder.hbs) + emits SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/*.cs +``` + +**Hand-coded counterparts** live in `SysML2.NET/TextualNotation/*.cs` (parent folder) as `partial` classes. When code-gen can't handle a rule, it emits `Build{RuleName}HandCoded(poco, cursorCache, stringBuilder)` which must be implemented in the hand-coded partial. + +## Grammar Element Types (`Grammar/Model/`) + +| Type | Grammar form | Key properties | +|------|--------------|----------------| +| `NonTerminalElement` | `RuleName`, `RuleName*`, `RuleName+` | `Name`, `IsCollection` | +| `AssignmentElement` | `prop=X`, `prop+=X`, `prop?=X` | `Property`, `Operator`, `Value: RuleElement` | +| `TerminalElement` | literal strings like keywords, `;`, `{` | `Value` | +| `GroupElement` | `(...)`, `(...)?`, `(...)*` | `Alternatives`, `IsOptional`, `IsCollection` | +| `ValueLiteralElement` | `[QualifiedName]`, `NAME` | `Value`, `QueryIsQualifiedName()` | +| `NonParsingAssignmentElement` | `{prop='val'}` | `PropertyName`, `Operator`, `Value` | + +## Rule Structure + +`RuleName:TargetElementName = alternative1 | alternative2 | ...` + +- `TargetElementName` is the UML metaclass the rule targets (defaults to `RuleName` if omitted) +- Builder methods take `I{TargetElementName} poco` as parameter +- When a NonTerminal's target is the **declaring class** (same as calling context), it uses `poco` +- When a NonTerminal targets a different class, the cursor element is cast: `if (cursor.Current is ITargetType x) { ... }` + +## Cursor Model (`ICursorCache`) + +Cursors iterate over collection properties (typically `ownedRelationship`). Key mechanics: + +- `cursorCache.GetOrCreateCursor(pocoId, propertyName, collection)` — same `(pocoId, propertyName)` returns the same cursor instance. Cursors are **shared** across builder methods. +- `cursor.Current` — current element (null when exhausted) +- `cursor.Move()` — advances to next element +- **Critical:** A collection builder must call `Move()` after processing each item, or be called inside a `while` loop that advances externally + +## Key Methods in `RulesHelper.cs` + +| Method | Purpose | +|--------|---------| +| `ProcessAlternatives` | Entry point for processing a rule's alternatives. Dispatches to more specific handlers based on alternative structure | +| `ProcessUnitypedAlternativesWithOneElement` | Handles `A | B | C` where all alternatives have one element of the same type (NonTerminal, Terminal, or AssignmentElement) | +| `ProcessNonTerminalElement` | Processes a single NonTerminal reference. For collections, delegates to `EmitCollectionNonTerminalLoop` | +| `EmitCollectionNonTerminalLoop` | Generates `while (cursor.Current ...) { builderCall; cursor.Move(); }` | +| `ProcessAssignmentElement` | Handles `=`, `+=`, `?=` assignments. Emits property access, cursor advance, or boolean-triggered keyword | +| `OrderElementsByInheritance` | Sorts NonTerminals by UML class depth (most specific first) for switch case ordering | +| `ResolveBuilderCall` | Returns `XxxTextualNotationBuilder.BuildRuleName(var, cursorCache, stringBuilder);` or `null` if types incompatible | +| `ResolveCollectionWhileTypeCondition` | Builds while condition — positive `is Type` if collection has only `+=` assignments, negative `is not null and not NextType` as fallback | + +## Guard Mechanisms for Ambiguous Dispatch + +When multiple alternatives map to the same UML class (creating duplicate switch cases), these disambiguate: + +1. **`?=` boolean guards** (primary) — e.g., `EndUsagePrefix` has `isEnd?='end'`, so it gets `when poco.IsEnd` +2. **`IsValidFor{RuleName}()` extension methods** (fallback) — hand-coded in `MembershipValidationExtensions.cs` or `TextualNotationValidationExtensions.cs`. Used when `?=` can't disambiguate +3. **Type ordering** — more specific types (deeper inheritance) come first, fallback case (matching `NamedElementToGenerate`) goes last as `default:` + +## Patterns Handled by Code-Gen + +| Pattern | Example | Handler | +|---------|---------|---------| +| Body with collection items | `';' | '{' Items* '}'` | `ProcessAlternatives` body check with `IsCollection: true` NonTerminal | +| Body with single sub-rule | `';' | '{' SingleRule '}'` | `ProcessAlternatives` body check with `IsCollection: false` NonTerminal | +| QualifiedName or owned chain | `prop=[QualifiedName] | prop=OwnedChain{containment+=prop}` | `ProcessAlternatives` two-alternative check | +| Mixed NonTerminal + `+=` | `NonTerminal | prop+=X` | `if (cursor.Current is XType) { process + Move() } else { BuildNonTerminal(poco, ...) }` | +| Collection group | `(ownedRelationship+=A | ownedRelationship+=B)*` | `groupElement.IsCollection` handler: while loop + cursor-based switch | +| Pure dispatch | `NonFeatureMember | NamespaceFeatureMember` | `ProcessUnitypedAlternativesWithOneElement` NonTerminal case with `IsValidFor` guards | + +## Switch Case Variable Scoping Gotcha + +Pattern variables like `elementAsFeatureMembership` in `if (x is Type elementAsFeatureMembership)` have **block scope**, not just the `if` body — they leak into the enclosing scope. The `if (x != null) { }` wrapper around these serves as a **scoping boundary** to prevent name collisions when the same pattern appears multiple times in the same method. Don't remove outer null guards without understanding this. + +## HandCoded Fallback Convention + +When code-gen detects an unsupported pattern, it emits: +```csharp +Build{RuleName}HandCoded(poco, cursorCache, stringBuilder); +``` + +The hand-coded partial class file must: +1. Live in `SysML2.NET/TextualNotation/{ClassName}TextualNotationBuilder.cs` +2. Declare `public static partial class {ClassName}TextualNotationBuilder` +3. Implement the method as `private static void Build{RuleName}HandCoded(...)` +4. Use `NotSupportedException` (not `NotImplementedException`) for unimplemented stubs +5. Include the grammar rule as `{rule}` in XML doc + +## Common Builder Conventions + +- **Trailing space**: Most builders append a trailing space after their content (`stringBuilder.Append(' ')`). Chain builders already add this internally — don't double it. +- **Terminal formatting**: Special terminals like curly braces and semicolons use `AppendLine`; angle brackets and `~` have no trailing space (see `NewLineTerminals` / `NoTrailingSpaceTerminals` in `RulesHelper.cs`). +- **Owned vs referenced elements**: To distinguish `type=OwnedChain{ownedRelatedElement+=type}` from `type=[QualifiedName]`, check at runtime: `poco.OwnedRelatedElement.Contains(poco.Type)` owned (call chain builder), else cross-reference (emit `qualifiedName`). + +## Testing Changes to the Generator + +After modifying `RulesHelper.cs`: +```bash +dotnet build SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj +dotnet test SysML2.NET.CodeGenerator.Tests/SysML2.NET.CodeGenerator.Tests.csproj --filter UmlCoreTextualNotationBuilderGeneratorTestFixture +# Generated files land in SysML2.NET.CodeGenerator.Tests/bin/Debug/net10.0/UML/_SysML2.NET.Core.UmlCoreTextualNotationBuilderGenerator/ +cp SysML2.NET.CodeGenerator.Tests/bin/Debug/net10.0/UML/_SysML2.NET.Core.UmlCoreTextualNotationBuilderGenerator/*.cs SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ +dotnet build SysML2.NET.sln +dotnet test SysML2.NET.sln +``` + +**Count remaining HandCoded calls** to track progress: +```bash +grep -r "HandCoded" SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/*.cs | wc -l +``` diff --git a/SysML2.NET.CodeGenerator/Generators/UmlHandleBarsGenerators/UmlCoreTextualNotationBuilderGenerator.cs b/SysML2.NET.CodeGenerator/Generators/UmlHandleBarsGenerators/UmlCoreTextualNotationBuilderGenerator.cs new file mode 100644 index 00000000..9b45ddb9 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Generators/UmlHandleBarsGenerators/UmlCoreTextualNotationBuilderGenerator.cs @@ -0,0 +1,224 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Generators.UmlHandleBarsGenerators +{ + using System; + using System.IO; + using System.Linq; + using System.Threading.Tasks; + + using SysML2.NET.CodeGenerator.Extensions; + using SysML2.NET.CodeGenerator.Grammar.Model; + using SysML2.NET.CodeGenerator.HandleBarHelpers; + + using uml4net.CommonStructure; + using uml4net.Extensions; + using uml4net.HandleBars; + using uml4net.StructuredClassifiers; + using uml4net.xmi.Readers; + + using NamedElementHelper = SysML2.NET.CodeGenerator.HandleBarHelpers.NamedElementHelper; + + /// + /// An to generate Textual Notation Builder + /// + public class UmlCoreTextualNotationBuilderGenerator: UmlHandleBarsGenerator + { + /// + /// Gets the name of template for builder classes + /// + private const string BuilderTemplateName = "core-textual-notation-builder-template"; + + /// + /// Gets the name of template for builder facade class + /// + private const string BuilderFacadeTemplateName = "core-textual-notation-builder-facade-template"; + + /// + /// Register the custom helpers + /// + protected override void RegisterHelpers() + { + NamedElementHelper.RegisterNamedElementHelper(this.Handlebars); + this.Handlebars.RegisterStringHelper(); + this.Handlebars.RegisterRulesHelper(); + } + + /// + /// Register the code templates + /// + protected override void RegisterTemplates() + { + this.RegisterTemplate(BuilderTemplateName); + this.RegisterTemplate(BuilderFacadeTemplateName); + } + + /// + /// Generates code specific to the concrete implementation + /// + /// + /// the that contains the UML model to generate from + /// + /// + /// The target + /// + /// This method cannot be used since it requires to have . Uses + /// + /// an awaitable + /// + public override Task GenerateAsync(XmiReaderResult xmiReaderResult, DirectoryInfo outputDirectory) + { + throw new NotSupportedException("The generator needs TextualNotationSpecification access"); + } + + /// + /// Generates code specific to the concrete implementation + /// + /// + /// the that contains the UML model to generate from + /// + /// The that contains specific grammar rules to produce textual notation + /// + /// The target + /// + /// + /// an awaitable + /// + public async Task GenerateAsync(XmiReaderResult xmiReaderResult, TextualNotationSpecification textualNotationSpecification, DirectoryInfo outputDirectory) + { + await this.GenerateBuilderClasses(xmiReaderResult, textualNotationSpecification, outputDirectory); + // await this.GenerateBuilderFacade(xmiReaderResult, outputDirectory); + } + + /// + /// Generates Textual Notation builder classes for each targeted by a rule + /// + /// + /// the that contains the UML model to generate from + /// + /// The that contains specific grammar rules to produce textual notation + /// + /// The target + /// + /// If one of the given parameters is null + /// + /// an awaitable + /// + private Task GenerateBuilderClasses(XmiReaderResult xmiReaderResult, TextualNotationSpecification textualNotationSpecification, DirectoryInfo outputDirectory) + { + ArgumentNullException.ThrowIfNull(xmiReaderResult); + ArgumentNullException.ThrowIfNull(textualNotationSpecification); + ArgumentNullException.ThrowIfNull(outputDirectory); + + return this.GenerateBuilderClassesInternal(xmiReaderResult, textualNotationSpecification, outputDirectory); + } + + /// + /// Generates Textual Notation builder classes for each targeted by a rule + /// + /// + /// the that contains the UML model to generate from + /// + /// The that contains specific grammar rules to produce textual notation + /// + /// The target + /// + /// + /// an awaitable + /// + private async Task GenerateBuilderClassesInternal(XmiReaderResult xmiReaderResult, TextualNotationSpecification textualNotationSpecification, DirectoryInfo outputDirectory) + { + var template = this.Templates[BuilderTemplateName]; + + var namedElements = xmiReaderResult.QueryContainedAndImported("SysML") + .SelectMany(x => x.PackagedElement.OfType()) + .ToList(); + + var rulesGroupedByType = textualNotationSpecification.Rules + .Where(x => !string.IsNullOrWhiteSpace(x.TargetElementName) && namedElements.Any(n => n.Name == x.TargetElementName)) + .GroupBy(x => x.TargetElementName).ToDictionary(x => x.Key, x => x.ToList()); + + foreach (var nonTargetingRule in textualNotationSpecification.Rules.Where(x => string.IsNullOrWhiteSpace(x.TargetElementName))) + { + var matchingClass = namedElements.SingleOrDefault(x => x.Name == nonTargetingRule.RuleName); + + if (matchingClass != null) + { + if (rulesGroupedByType.TryGetValue(matchingClass.Name, out var existingRules)) + { + existingRules.Add(nonTargetingRule); + } + else + { + rulesGroupedByType[matchingClass.Name] = [nonTargetingRule]; + } + } + } + + foreach (var rulesPerType in rulesGroupedByType) + { + var targetClassContext = namedElements.Single(x => x.Name == rulesPerType.Key); + + var generatedBuilder = template(new {Context = targetClassContext, Rules = rulesPerType.Value, AllRules = textualNotationSpecification.Rules}); + generatedBuilder = this.CodeCleanup(generatedBuilder); + + var fileName = $"{targetClassContext.Name.CapitalizeFirstLetter()}TextualNotationBuilder.cs"; + + await WriteAsync(generatedBuilder, outputDirectory, fileName); + } + } + + /// + /// Generates the Textual Notation builder facade + /// + /// the that contains the UML model to generate from + /// The target + /// If one of the given parameters is null + /// an awaitable + private Task GenerateBuilderFacade(XmiReaderResult xmiReaderResult, DirectoryInfo outputDirectory) + { + ArgumentNullException.ThrowIfNull(xmiReaderResult); + ArgumentNullException.ThrowIfNull(outputDirectory); + return this.GenerateBuilderFacadeInternal(xmiReaderResult, outputDirectory); + } + + /// + /// Generates the Textual Notation builder facade + /// + /// the that contains the UML model to generate from + /// The target + /// an awaitable + private async Task GenerateBuilderFacadeInternal(XmiReaderResult xmiReaderResult, DirectoryInfo outputDirectory) + { + var template = this.Templates[BuilderFacadeTemplateName]; + + var classes = xmiReaderResult.QueryContainedAndImported("SysML") + .SelectMany(x => x.PackagedElement.OfType()) + .Where(x => !x.IsAbstract) + .ToList(); + + var generatedFacade = template(classes); + generatedFacade = this.CodeCleanup(generatedFacade); + + await WriteAsync(generatedFacade, outputDirectory, "TextualNotationBuilderFacade.cs"); + } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.interp b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.interp new file mode 100644 index 00000000..1291cb77 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.interp @@ -0,0 +1,84 @@ +token literal names: +null +'*' +'+' +'?' +'[QualifiedName]' +null +'+=' +'?=' +'|' +':' +';' +',' +'(' +')' +'[' +']' +'{' +'}' +'.' +'~' +null +null +null +null +null +null +null +null +null + +token symbolic names: +null +null +null +null +null +ASSIGN +ADD_ASSIGN +BOOL_ASSIGN +PIPE +COLON +SEMICOLON +COMMA +LPAREN +RPAREN +LBRACK +RBRACK +LBRACE +RBRACE +DOT +TILDE +UPPER_ID +ID +SINGLE_QUOTED_STRING +INT +STRING +COMMENT +WS +CONTINUATION +NL + +rule names: +specification +rule_definition +parameter_list +alternatives +alternative +element +assignment +non_parsing_assignment +non_parsing_empty +cross_reference +group +terminal +non_terminal +element_core +dotted_id +suffix_op +value_literal + + +atn: +[4, 1, 28, 154, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 1, 0, 5, 0, 36, 8, 0, 10, 0, 12, 0, 39, 9, 0, 1, 0, 4, 0, 42, 8, 0, 11, 0, 12, 0, 43, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 50, 8, 1, 1, 1, 1, 1, 3, 1, 54, 8, 1, 1, 1, 1, 1, 1, 1, 3, 1, 59, 8, 1, 1, 1, 4, 1, 62, 8, 1, 11, 1, 12, 1, 63, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 5, 3, 75, 8, 3, 10, 3, 12, 3, 78, 9, 3, 1, 4, 5, 4, 81, 8, 4, 10, 4, 12, 4, 84, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 94, 8, 5, 1, 6, 1, 6, 1, 6, 3, 6, 99, 8, 6, 1, 6, 1, 6, 3, 6, 103, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 3, 9, 115, 8, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 125, 8, 10, 1, 11, 1, 11, 3, 11, 129, 8, 11, 1, 12, 1, 12, 3, 12, 133, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 140, 8, 13, 1, 14, 1, 14, 1, 14, 5, 14, 145, 8, 14, 10, 14, 12, 14, 148, 9, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 0, 0, 17, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 0, 4, 1, 0, 5, 7, 1, 0, 5, 6, 1, 0, 1, 3, 2, 0, 4, 4, 21, 24, 162, 0, 37, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 65, 1, 0, 0, 0, 6, 71, 1, 0, 0, 0, 8, 82, 1, 0, 0, 0, 10, 93, 1, 0, 0, 0, 12, 95, 1, 0, 0, 0, 14, 104, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 114, 1, 0, 0, 0, 20, 120, 1, 0, 0, 0, 22, 126, 1, 0, 0, 0, 24, 130, 1, 0, 0, 0, 26, 139, 1, 0, 0, 0, 28, 141, 1, 0, 0, 0, 30, 149, 1, 0, 0, 0, 32, 151, 1, 0, 0, 0, 34, 36, 5, 28, 0, 0, 35, 34, 1, 0, 0, 0, 36, 39, 1, 0, 0, 0, 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 40, 42, 3, 2, 1, 0, 41, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 46, 5, 0, 0, 1, 46, 1, 1, 0, 0, 0, 47, 49, 5, 20, 0, 0, 48, 50, 3, 4, 2, 0, 49, 48, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 53, 1, 0, 0, 0, 51, 52, 5, 9, 0, 0, 52, 54, 5, 20, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 56, 5, 5, 0, 0, 56, 58, 3, 6, 3, 0, 57, 59, 5, 10, 0, 0, 58, 57, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 61, 1, 0, 0, 0, 60, 62, 5, 28, 0, 0, 61, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 61, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 3, 1, 0, 0, 0, 65, 66, 5, 12, 0, 0, 66, 67, 5, 21, 0, 0, 67, 68, 5, 9, 0, 0, 68, 69, 5, 21, 0, 0, 69, 70, 5, 13, 0, 0, 70, 5, 1, 0, 0, 0, 71, 76, 3, 8, 4, 0, 72, 73, 5, 8, 0, 0, 73, 75, 3, 8, 4, 0, 74, 72, 1, 0, 0, 0, 75, 78, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 7, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 79, 81, 3, 10, 5, 0, 80, 79, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 9, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 94, 3, 12, 6, 0, 86, 94, 3, 14, 7, 0, 87, 94, 3, 16, 8, 0, 88, 94, 3, 18, 9, 0, 89, 94, 3, 20, 10, 0, 90, 94, 3, 22, 11, 0, 91, 94, 3, 24, 12, 0, 92, 94, 3, 32, 16, 0, 93, 85, 1, 0, 0, 0, 93, 86, 1, 0, 0, 0, 93, 87, 1, 0, 0, 0, 93, 88, 1, 0, 0, 0, 93, 89, 1, 0, 0, 0, 93, 90, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 93, 92, 1, 0, 0, 0, 94, 11, 1, 0, 0, 0, 95, 96, 3, 28, 14, 0, 96, 98, 7, 0, 0, 0, 97, 99, 5, 19, 0, 0, 98, 97, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 102, 3, 26, 13, 0, 101, 103, 3, 30, 15, 0, 102, 101, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 13, 1, 0, 0, 0, 104, 105, 5, 16, 0, 0, 105, 106, 3, 28, 14, 0, 106, 107, 7, 1, 0, 0, 107, 108, 3, 32, 16, 0, 108, 109, 5, 17, 0, 0, 109, 15, 1, 0, 0, 0, 110, 111, 5, 16, 0, 0, 111, 112, 5, 17, 0, 0, 112, 17, 1, 0, 0, 0, 113, 115, 5, 19, 0, 0, 114, 113, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, 117, 5, 14, 0, 0, 117, 118, 5, 21, 0, 0, 118, 119, 5, 15, 0, 0, 119, 19, 1, 0, 0, 0, 120, 121, 5, 12, 0, 0, 121, 122, 3, 6, 3, 0, 122, 124, 5, 13, 0, 0, 123, 125, 3, 30, 15, 0, 124, 123, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 21, 1, 0, 0, 0, 126, 128, 5, 22, 0, 0, 127, 129, 3, 30, 15, 0, 128, 127, 1, 0, 0, 0, 128, 129, 1, 0, 0, 0, 129, 23, 1, 0, 0, 0, 130, 132, 5, 20, 0, 0, 131, 133, 3, 30, 15, 0, 132, 131, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 25, 1, 0, 0, 0, 134, 140, 3, 18, 9, 0, 135, 140, 3, 20, 10, 0, 136, 140, 3, 22, 11, 0, 137, 140, 3, 24, 12, 0, 138, 140, 3, 32, 16, 0, 139, 134, 1, 0, 0, 0, 139, 135, 1, 0, 0, 0, 139, 136, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 27, 1, 0, 0, 0, 141, 146, 5, 21, 0, 0, 142, 143, 5, 18, 0, 0, 143, 145, 5, 21, 0, 0, 144, 142, 1, 0, 0, 0, 145, 148, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 146, 147, 1, 0, 0, 0, 147, 29, 1, 0, 0, 0, 148, 146, 1, 0, 0, 0, 149, 150, 7, 2, 0, 0, 150, 31, 1, 0, 0, 0, 151, 152, 7, 3, 0, 0, 152, 33, 1, 0, 0, 0, 17, 37, 43, 49, 53, 58, 63, 76, 82, 93, 98, 102, 114, 124, 128, 132, 139, 146] \ No newline at end of file diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.tokens b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.tokens new file mode 100644 index 00000000..5c28d84e --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.tokens @@ -0,0 +1,46 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +ASSIGN=5 +ADD_ASSIGN=6 +BOOL_ASSIGN=7 +PIPE=8 +COLON=9 +SEMICOLON=10 +COMMA=11 +LPAREN=12 +RPAREN=13 +LBRACK=14 +RBRACK=15 +LBRACE=16 +RBRACE=17 +DOT=18 +TILDE=19 +UPPER_ID=20 +ID=21 +SINGLE_QUOTED_STRING=22 +INT=23 +STRING=24 +COMMENT=25 +WS=26 +CONTINUATION=27 +NL=28 +'*'=1 +'+'=2 +'?'=3 +'[QualifiedName]'=4 +'+='=6 +'?='=7 +'|'=8 +':'=9 +';'=10 +','=11 +'('=12 +')'=13 +'['=14 +']'=15 +'{'=16 +'}'=17 +'.'=18 +'~'=19 diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseListener.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseListener.cs new file mode 100644 index 00000000..1593400e --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseListener.cs @@ -0,0 +1,257 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.13.2 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from C:/CODE/SysML2.NET/Resources/kebnf.g4 by ANTLR 4.13.2 + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 +// Ambiguous reference in cref attribute +#pragma warning disable 419 + +namespace SysML2.NET.CodeGenerator.Grammar { + +using Antlr4.Runtime.Misc; +using IErrorNode = Antlr4.Runtime.Tree.IErrorNode; +using ITerminalNode = Antlr4.Runtime.Tree.ITerminalNode; +using IToken = Antlr4.Runtime.IToken; +using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; + +/// +/// This class provides an empty implementation of , +/// which can be extended to create a listener which only needs to handle a subset +/// of the available methods. +/// +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")] +[System.Diagnostics.DebuggerNonUserCode] +[System.CLSCompliant(false)] +public partial class kebnfBaseListener : IkebnfListener { + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterSpecification([NotNull] kebnfParser.SpecificationContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitSpecification([NotNull] kebnfParser.SpecificationContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterRule_definition([NotNull] kebnfParser.Rule_definitionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitRule_definition([NotNull] kebnfParser.Rule_definitionContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterParameter_list([NotNull] kebnfParser.Parameter_listContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitParameter_list([NotNull] kebnfParser.Parameter_listContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterAlternatives([NotNull] kebnfParser.AlternativesContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitAlternatives([NotNull] kebnfParser.AlternativesContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterAlternative([NotNull] kebnfParser.AlternativeContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitAlternative([NotNull] kebnfParser.AlternativeContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterElement([NotNull] kebnfParser.ElementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitElement([NotNull] kebnfParser.ElementContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterAssignment([NotNull] kebnfParser.AssignmentContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitAssignment([NotNull] kebnfParser.AssignmentContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterNon_parsing_assignment([NotNull] kebnfParser.Non_parsing_assignmentContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitNon_parsing_assignment([NotNull] kebnfParser.Non_parsing_assignmentContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterNon_parsing_empty([NotNull] kebnfParser.Non_parsing_emptyContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitNon_parsing_empty([NotNull] kebnfParser.Non_parsing_emptyContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterCross_reference([NotNull] kebnfParser.Cross_referenceContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitCross_reference([NotNull] kebnfParser.Cross_referenceContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterGroup([NotNull] kebnfParser.GroupContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitGroup([NotNull] kebnfParser.GroupContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterTerminal([NotNull] kebnfParser.TerminalContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitTerminal([NotNull] kebnfParser.TerminalContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterNon_terminal([NotNull] kebnfParser.Non_terminalContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitNon_terminal([NotNull] kebnfParser.Non_terminalContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterElement_core([NotNull] kebnfParser.Element_coreContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitElement_core([NotNull] kebnfParser.Element_coreContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterDotted_id([NotNull] kebnfParser.Dotted_idContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitDotted_id([NotNull] kebnfParser.Dotted_idContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterSuffix_op([NotNull] kebnfParser.Suffix_opContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitSuffix_op([NotNull] kebnfParser.Suffix_opContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterValue_literal([NotNull] kebnfParser.Value_literalContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitValue_literal([NotNull] kebnfParser.Value_literalContext context) { } + + /// + /// The default implementation does nothing. + public virtual void EnterEveryRule([NotNull] ParserRuleContext context) { } + /// + /// The default implementation does nothing. + public virtual void ExitEveryRule([NotNull] ParserRuleContext context) { } + /// + /// The default implementation does nothing. + public virtual void VisitTerminal([NotNull] ITerminalNode node) { } + /// + /// The default implementation does nothing. + public virtual void VisitErrorNode([NotNull] IErrorNode node) { } +} +} // namespace SysML2.NET.CodeGenerator.Grammar diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseVisitor.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseVisitor.cs new file mode 100644 index 00000000..3a64587f --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseVisitor.cs @@ -0,0 +1,209 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.13.2 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from C:/CODE/SysML2.NET/Resources/kebnf.g4 by ANTLR 4.13.2 + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 +// Ambiguous reference in cref attribute +#pragma warning disable 419 + +namespace SysML2.NET.CodeGenerator.Grammar { +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using IToken = Antlr4.Runtime.IToken; +using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; + +/// +/// This class provides an empty implementation of , +/// which can be extended to create a visitor which only needs to handle a subset +/// of the available methods. +/// +/// The return type of the visit operation. +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")] +[System.Diagnostics.DebuggerNonUserCode] +[System.CLSCompliant(false)] +public partial class kebnfBaseVisitor : AbstractParseTreeVisitor, IkebnfVisitor { + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSpecification([NotNull] kebnfParser.SpecificationContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitRule_definition([NotNull] kebnfParser.Rule_definitionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitParameter_list([NotNull] kebnfParser.Parameter_listContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAlternatives([NotNull] kebnfParser.AlternativesContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAlternative([NotNull] kebnfParser.AlternativeContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitElement([NotNull] kebnfParser.ElementContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAssignment([NotNull] kebnfParser.AssignmentContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitNon_parsing_assignment([NotNull] kebnfParser.Non_parsing_assignmentContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitNon_parsing_empty([NotNull] kebnfParser.Non_parsing_emptyContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCross_reference([NotNull] kebnfParser.Cross_referenceContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitGroup([NotNull] kebnfParser.GroupContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitTerminal([NotNull] kebnfParser.TerminalContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitNon_terminal([NotNull] kebnfParser.Non_terminalContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitElement_core([NotNull] kebnfParser.Element_coreContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitDotted_id([NotNull] kebnfParser.Dotted_idContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSuffix_op([NotNull] kebnfParser.Suffix_opContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitValue_literal([NotNull] kebnfParser.Value_literalContext context) { return VisitChildren(context); } +} +} // namespace SysML2.NET.CodeGenerator.Grammar diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.cs new file mode 100644 index 00000000..bae07a49 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.cs @@ -0,0 +1,176 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.13.2 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from C:/CODE/SysML2.NET/Resources/kebnf.g4 by ANTLR 4.13.2 + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 +// Ambiguous reference in cref attribute +#pragma warning disable 419 + +namespace SysML2.NET.CodeGenerator.Grammar { +using System; +using System.IO; +using System.Text; +using Antlr4.Runtime; +using Antlr4.Runtime.Atn; +using Antlr4.Runtime.Misc; +using DFA = Antlr4.Runtime.Dfa.DFA; + +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")] +[System.CLSCompliant(false)] +public partial class kebnfLexer : Lexer { + protected static DFA[] decisionToDFA; + protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); + public const int + T__0=1, T__1=2, T__2=3, T__3=4, ASSIGN=5, ADD_ASSIGN=6, BOOL_ASSIGN=7, + PIPE=8, COLON=9, SEMICOLON=10, COMMA=11, LPAREN=12, RPAREN=13, LBRACK=14, + RBRACK=15, LBRACE=16, RBRACE=17, DOT=18, TILDE=19, UPPER_ID=20, ID=21, + SINGLE_QUOTED_STRING=22, INT=23, STRING=24, COMMENT=25, WS=26, CONTINUATION=27, + NL=28; + public static string[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static string[] modeNames = { + "DEFAULT_MODE" + }; + + public static readonly string[] ruleNames = { + "T__0", "T__1", "T__2", "T__3", "ASSIGN", "ADD_ASSIGN", "BOOL_ASSIGN", + "PIPE", "COLON", "SEMICOLON", "COMMA", "LPAREN", "RPAREN", "LBRACK", "RBRACK", + "LBRACE", "RBRACE", "DOT", "TILDE", "UPPER_ID", "ID", "SINGLE_QUOTED_STRING", + "INT", "STRING", "COMMENT", "WS", "CONTINUATION", "NL" + }; + + + public kebnfLexer(ICharStream input) + : this(input, Console.Out, Console.Error) { } + + public kebnfLexer(ICharStream input, TextWriter output, TextWriter errorOutput) + : base(input, output, errorOutput) + { + Interpreter = new LexerATNSimulator(this, _ATN, decisionToDFA, sharedContextCache); + } + + private static readonly string[] _LiteralNames = { + null, "'*'", "'+'", "'?'", "'[QualifiedName]'", null, "'+='", "'?='", + "'|'", "':'", "';'", "','", "'('", "')'", "'['", "']'", "'{'", "'}'", + "'.'", "'~'" + }; + private static readonly string[] _SymbolicNames = { + null, null, null, null, null, "ASSIGN", "ADD_ASSIGN", "BOOL_ASSIGN", "PIPE", + "COLON", "SEMICOLON", "COMMA", "LPAREN", "RPAREN", "LBRACK", "RBRACK", + "LBRACE", "RBRACE", "DOT", "TILDE", "UPPER_ID", "ID", "SINGLE_QUOTED_STRING", + "INT", "STRING", "COMMENT", "WS", "CONTINUATION", "NL" + }; + public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); + + [NotNull] + public override IVocabulary Vocabulary + { + get + { + return DefaultVocabulary; + } + } + + public override string GrammarFileName { get { return "kebnf.g4"; } } + + public override string[] RuleNames { get { return ruleNames; } } + + public override string[] ChannelNames { get { return channelNames; } } + + public override string[] ModeNames { get { return modeNames; } } + + public override int[] SerializedAtn { get { return _serializedATN; } } + + static kebnfLexer() { + decisionToDFA = new DFA[_ATN.NumberOfDecisions]; + for (int i = 0; i < _ATN.NumberOfDecisions; i++) { + decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i); + } + } + private static int[] _serializedATN = { + 4,0,28,190,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14, + 7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21, + 7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,1,0,1, + 0,1,1,1,1,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,1,4,1,4,1,4,1,4,3,4,84,8,4,1,5,1,5,1,5,1,6,1,6,1,6,1,7,1,7, + 1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15, + 1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,5,19,118,8,19,10,19,12,19, + 121,9,19,1,20,1,20,5,20,125,8,20,10,20,12,20,128,9,20,1,21,1,21,1,21,1, + 21,5,21,134,8,21,10,21,12,21,137,9,21,1,21,1,21,1,22,4,22,142,8,22,11, + 22,12,22,143,1,23,1,23,1,23,1,23,5,23,150,8,23,10,23,12,23,153,9,23,1, + 23,1,23,1,24,1,24,1,24,1,24,5,24,161,8,24,10,24,12,24,164,9,24,1,24,1, + 24,1,25,4,25,169,8,25,11,25,12,25,170,1,25,1,25,1,26,3,26,176,8,26,1,26, + 1,26,4,26,180,8,26,11,26,12,26,181,1,26,1,26,1,27,3,27,187,8,27,1,27,1, + 27,0,0,28,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25, + 13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49, + 25,51,26,53,27,55,28,1,0,7,1,0,65,90,4,0,48,57,65,90,95,95,97,122,3,0, + 65,90,95,95,97,122,2,0,39,39,92,92,1,0,48,57,2,0,10,10,13,13,2,0,9,9,32, + 32,202,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11, + 1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0, + 0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33, + 1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0, + 0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55, + 1,0,0,0,1,57,1,0,0,0,3,59,1,0,0,0,5,61,1,0,0,0,7,63,1,0,0,0,9,83,1,0,0, + 0,11,85,1,0,0,0,13,88,1,0,0,0,15,91,1,0,0,0,17,93,1,0,0,0,19,95,1,0,0, + 0,21,97,1,0,0,0,23,99,1,0,0,0,25,101,1,0,0,0,27,103,1,0,0,0,29,105,1,0, + 0,0,31,107,1,0,0,0,33,109,1,0,0,0,35,111,1,0,0,0,37,113,1,0,0,0,39,115, + 1,0,0,0,41,122,1,0,0,0,43,129,1,0,0,0,45,141,1,0,0,0,47,145,1,0,0,0,49, + 156,1,0,0,0,51,168,1,0,0,0,53,175,1,0,0,0,55,186,1,0,0,0,57,58,5,42,0, + 0,58,2,1,0,0,0,59,60,5,43,0,0,60,4,1,0,0,0,61,62,5,63,0,0,62,6,1,0,0,0, + 63,64,5,91,0,0,64,65,5,81,0,0,65,66,5,117,0,0,66,67,5,97,0,0,67,68,5,108, + 0,0,68,69,5,105,0,0,69,70,5,102,0,0,70,71,5,105,0,0,71,72,5,101,0,0,72, + 73,5,100,0,0,73,74,5,78,0,0,74,75,5,97,0,0,75,76,5,109,0,0,76,77,5,101, + 0,0,77,78,5,93,0,0,78,8,1,0,0,0,79,80,5,58,0,0,80,81,5,58,0,0,81,84,5, + 61,0,0,82,84,5,61,0,0,83,79,1,0,0,0,83,82,1,0,0,0,84,10,1,0,0,0,85,86, + 5,43,0,0,86,87,5,61,0,0,87,12,1,0,0,0,88,89,5,63,0,0,89,90,5,61,0,0,90, + 14,1,0,0,0,91,92,5,124,0,0,92,16,1,0,0,0,93,94,5,58,0,0,94,18,1,0,0,0, + 95,96,5,59,0,0,96,20,1,0,0,0,97,98,5,44,0,0,98,22,1,0,0,0,99,100,5,40, + 0,0,100,24,1,0,0,0,101,102,5,41,0,0,102,26,1,0,0,0,103,104,5,91,0,0,104, + 28,1,0,0,0,105,106,5,93,0,0,106,30,1,0,0,0,107,108,5,123,0,0,108,32,1, + 0,0,0,109,110,5,125,0,0,110,34,1,0,0,0,111,112,5,46,0,0,112,36,1,0,0,0, + 113,114,5,126,0,0,114,38,1,0,0,0,115,119,7,0,0,0,116,118,7,1,0,0,117,116, + 1,0,0,0,118,121,1,0,0,0,119,117,1,0,0,0,119,120,1,0,0,0,120,40,1,0,0,0, + 121,119,1,0,0,0,122,126,7,2,0,0,123,125,7,1,0,0,124,123,1,0,0,0,125,128, + 1,0,0,0,126,124,1,0,0,0,126,127,1,0,0,0,127,42,1,0,0,0,128,126,1,0,0,0, + 129,135,5,39,0,0,130,134,8,3,0,0,131,132,5,92,0,0,132,134,9,0,0,0,133, + 130,1,0,0,0,133,131,1,0,0,0,134,137,1,0,0,0,135,133,1,0,0,0,135,136,1, + 0,0,0,136,138,1,0,0,0,137,135,1,0,0,0,138,139,5,39,0,0,139,44,1,0,0,0, + 140,142,7,4,0,0,141,140,1,0,0,0,142,143,1,0,0,0,143,141,1,0,0,0,143,144, + 1,0,0,0,144,46,1,0,0,0,145,151,5,39,0,0,146,150,8,3,0,0,147,148,5,92,0, + 0,148,150,9,0,0,0,149,146,1,0,0,0,149,147,1,0,0,0,150,153,1,0,0,0,151, + 149,1,0,0,0,151,152,1,0,0,0,152,154,1,0,0,0,153,151,1,0,0,0,154,155,5, + 39,0,0,155,48,1,0,0,0,156,157,5,47,0,0,157,158,5,47,0,0,158,162,1,0,0, + 0,159,161,8,5,0,0,160,159,1,0,0,0,161,164,1,0,0,0,162,160,1,0,0,0,162, + 163,1,0,0,0,163,165,1,0,0,0,164,162,1,0,0,0,165,166,6,24,0,0,166,50,1, + 0,0,0,167,169,7,6,0,0,168,167,1,0,0,0,169,170,1,0,0,0,170,168,1,0,0,0, + 170,171,1,0,0,0,171,172,1,0,0,0,172,173,6,25,0,0,173,52,1,0,0,0,174,176, + 5,13,0,0,175,174,1,0,0,0,175,176,1,0,0,0,176,177,1,0,0,0,177,179,5,10, + 0,0,178,180,7,6,0,0,179,178,1,0,0,0,180,181,1,0,0,0,181,179,1,0,0,0,181, + 182,1,0,0,0,182,183,1,0,0,0,183,184,6,26,0,0,184,54,1,0,0,0,185,187,5, + 13,0,0,186,185,1,0,0,0,186,187,1,0,0,0,187,188,1,0,0,0,188,189,5,10,0, + 0,189,56,1,0,0,0,14,0,83,119,126,133,135,143,149,151,162,170,175,181,186, + 1,6,0,0 + }; + + public static readonly ATN _ATN = + new ATNDeserializer().Deserialize(_serializedATN); + + +} +} // namespace SysML2.NET.CodeGenerator.Grammar diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.interp b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.interp new file mode 100644 index 00000000..753b3d36 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.interp @@ -0,0 +1,101 @@ +token literal names: +null +'*' +'+' +'?' +'[QualifiedName]' +null +'+=' +'?=' +'|' +':' +';' +',' +'(' +')' +'[' +']' +'{' +'}' +'.' +'~' +null +null +null +null +null +null +null +null +null + +token symbolic names: +null +null +null +null +null +ASSIGN +ADD_ASSIGN +BOOL_ASSIGN +PIPE +COLON +SEMICOLON +COMMA +LPAREN +RPAREN +LBRACK +RBRACK +LBRACE +RBRACE +DOT +TILDE +UPPER_ID +ID +SINGLE_QUOTED_STRING +INT +STRING +COMMENT +WS +CONTINUATION +NL + +rule names: +T__0 +T__1 +T__2 +T__3 +ASSIGN +ADD_ASSIGN +BOOL_ASSIGN +PIPE +COLON +SEMICOLON +COMMA +LPAREN +RPAREN +LBRACK +RBRACK +LBRACE +RBRACE +DOT +TILDE +UPPER_ID +ID +SINGLE_QUOTED_STRING +INT +STRING +COMMENT +WS +CONTINUATION +NL + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 28, 190, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 84, 8, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 118, 8, 19, 10, 19, 12, 19, 121, 9, 19, 1, 20, 1, 20, 5, 20, 125, 8, 20, 10, 20, 12, 20, 128, 9, 20, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 134, 8, 21, 10, 21, 12, 21, 137, 9, 21, 1, 21, 1, 21, 1, 22, 4, 22, 142, 8, 22, 11, 22, 12, 22, 143, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 150, 8, 23, 10, 23, 12, 23, 153, 9, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 161, 8, 24, 10, 24, 12, 24, 164, 9, 24, 1, 24, 1, 24, 1, 25, 4, 25, 169, 8, 25, 11, 25, 12, 25, 170, 1, 25, 1, 25, 1, 26, 3, 26, 176, 8, 26, 1, 26, 1, 26, 4, 26, 180, 8, 26, 11, 26, 12, 26, 181, 1, 26, 1, 26, 1, 27, 3, 27, 187, 8, 27, 1, 27, 1, 27, 0, 0, 28, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 1, 0, 7, 1, 0, 65, 90, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 65, 90, 95, 95, 97, 122, 2, 0, 39, 39, 92, 92, 1, 0, 48, 57, 2, 0, 10, 10, 13, 13, 2, 0, 9, 9, 32, 32, 202, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 1, 57, 1, 0, 0, 0, 3, 59, 1, 0, 0, 0, 5, 61, 1, 0, 0, 0, 7, 63, 1, 0, 0, 0, 9, 83, 1, 0, 0, 0, 11, 85, 1, 0, 0, 0, 13, 88, 1, 0, 0, 0, 15, 91, 1, 0, 0, 0, 17, 93, 1, 0, 0, 0, 19, 95, 1, 0, 0, 0, 21, 97, 1, 0, 0, 0, 23, 99, 1, 0, 0, 0, 25, 101, 1, 0, 0, 0, 27, 103, 1, 0, 0, 0, 29, 105, 1, 0, 0, 0, 31, 107, 1, 0, 0, 0, 33, 109, 1, 0, 0, 0, 35, 111, 1, 0, 0, 0, 37, 113, 1, 0, 0, 0, 39, 115, 1, 0, 0, 0, 41, 122, 1, 0, 0, 0, 43, 129, 1, 0, 0, 0, 45, 141, 1, 0, 0, 0, 47, 145, 1, 0, 0, 0, 49, 156, 1, 0, 0, 0, 51, 168, 1, 0, 0, 0, 53, 175, 1, 0, 0, 0, 55, 186, 1, 0, 0, 0, 57, 58, 5, 42, 0, 0, 58, 2, 1, 0, 0, 0, 59, 60, 5, 43, 0, 0, 60, 4, 1, 0, 0, 0, 61, 62, 5, 63, 0, 0, 62, 6, 1, 0, 0, 0, 63, 64, 5, 91, 0, 0, 64, 65, 5, 81, 0, 0, 65, 66, 5, 117, 0, 0, 66, 67, 5, 97, 0, 0, 67, 68, 5, 108, 0, 0, 68, 69, 5, 105, 0, 0, 69, 70, 5, 102, 0, 0, 70, 71, 5, 105, 0, 0, 71, 72, 5, 101, 0, 0, 72, 73, 5, 100, 0, 0, 73, 74, 5, 78, 0, 0, 74, 75, 5, 97, 0, 0, 75, 76, 5, 109, 0, 0, 76, 77, 5, 101, 0, 0, 77, 78, 5, 93, 0, 0, 78, 8, 1, 0, 0, 0, 79, 80, 5, 58, 0, 0, 80, 81, 5, 58, 0, 0, 81, 84, 5, 61, 0, 0, 82, 84, 5, 61, 0, 0, 83, 79, 1, 0, 0, 0, 83, 82, 1, 0, 0, 0, 84, 10, 1, 0, 0, 0, 85, 86, 5, 43, 0, 0, 86, 87, 5, 61, 0, 0, 87, 12, 1, 0, 0, 0, 88, 89, 5, 63, 0, 0, 89, 90, 5, 61, 0, 0, 90, 14, 1, 0, 0, 0, 91, 92, 5, 124, 0, 0, 92, 16, 1, 0, 0, 0, 93, 94, 5, 58, 0, 0, 94, 18, 1, 0, 0, 0, 95, 96, 5, 59, 0, 0, 96, 20, 1, 0, 0, 0, 97, 98, 5, 44, 0, 0, 98, 22, 1, 0, 0, 0, 99, 100, 5, 40, 0, 0, 100, 24, 1, 0, 0, 0, 101, 102, 5, 41, 0, 0, 102, 26, 1, 0, 0, 0, 103, 104, 5, 91, 0, 0, 104, 28, 1, 0, 0, 0, 105, 106, 5, 93, 0, 0, 106, 30, 1, 0, 0, 0, 107, 108, 5, 123, 0, 0, 108, 32, 1, 0, 0, 0, 109, 110, 5, 125, 0, 0, 110, 34, 1, 0, 0, 0, 111, 112, 5, 46, 0, 0, 112, 36, 1, 0, 0, 0, 113, 114, 5, 126, 0, 0, 114, 38, 1, 0, 0, 0, 115, 119, 7, 0, 0, 0, 116, 118, 7, 1, 0, 0, 117, 116, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 40, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 126, 7, 2, 0, 0, 123, 125, 7, 1, 0, 0, 124, 123, 1, 0, 0, 0, 125, 128, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 42, 1, 0, 0, 0, 128, 126, 1, 0, 0, 0, 129, 135, 5, 39, 0, 0, 130, 134, 8, 3, 0, 0, 131, 132, 5, 92, 0, 0, 132, 134, 9, 0, 0, 0, 133, 130, 1, 0, 0, 0, 133, 131, 1, 0, 0, 0, 134, 137, 1, 0, 0, 0, 135, 133, 1, 0, 0, 0, 135, 136, 1, 0, 0, 0, 136, 138, 1, 0, 0, 0, 137, 135, 1, 0, 0, 0, 138, 139, 5, 39, 0, 0, 139, 44, 1, 0, 0, 0, 140, 142, 7, 4, 0, 0, 141, 140, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 46, 1, 0, 0, 0, 145, 151, 5, 39, 0, 0, 146, 150, 8, 3, 0, 0, 147, 148, 5, 92, 0, 0, 148, 150, 9, 0, 0, 0, 149, 146, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 150, 153, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 154, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 154, 155, 5, 39, 0, 0, 155, 48, 1, 0, 0, 0, 156, 157, 5, 47, 0, 0, 157, 158, 5, 47, 0, 0, 158, 162, 1, 0, 0, 0, 159, 161, 8, 5, 0, 0, 160, 159, 1, 0, 0, 0, 161, 164, 1, 0, 0, 0, 162, 160, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 165, 1, 0, 0, 0, 164, 162, 1, 0, 0, 0, 165, 166, 6, 24, 0, 0, 166, 50, 1, 0, 0, 0, 167, 169, 7, 6, 0, 0, 168, 167, 1, 0, 0, 0, 169, 170, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 170, 171, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 173, 6, 25, 0, 0, 173, 52, 1, 0, 0, 0, 174, 176, 5, 13, 0, 0, 175, 174, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 179, 5, 10, 0, 0, 178, 180, 7, 6, 0, 0, 179, 178, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 183, 1, 0, 0, 0, 183, 184, 6, 26, 0, 0, 184, 54, 1, 0, 0, 0, 185, 187, 5, 13, 0, 0, 186, 185, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 187, 188, 1, 0, 0, 0, 188, 189, 5, 10, 0, 0, 189, 56, 1, 0, 0, 0, 14, 0, 83, 119, 126, 133, 135, 143, 149, 151, 162, 170, 175, 181, 186, 1, 6, 0, 0] \ No newline at end of file diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.tokens b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.tokens new file mode 100644 index 00000000..5c28d84e --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.tokens @@ -0,0 +1,46 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +ASSIGN=5 +ADD_ASSIGN=6 +BOOL_ASSIGN=7 +PIPE=8 +COLON=9 +SEMICOLON=10 +COMMA=11 +LPAREN=12 +RPAREN=13 +LBRACK=14 +RBRACK=15 +LBRACE=16 +RBRACE=17 +DOT=18 +TILDE=19 +UPPER_ID=20 +ID=21 +SINGLE_QUOTED_STRING=22 +INT=23 +STRING=24 +COMMENT=25 +WS=26 +CONTINUATION=27 +NL=28 +'*'=1 +'+'=2 +'?'=3 +'[QualifiedName]'=4 +'+='=6 +'?='=7 +'|'=8 +':'=9 +';'=10 +','=11 +'('=12 +')'=13 +'['=14 +']'=15 +'{'=16 +'}'=17 +'.'=18 +'~'=19 diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfListener.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfListener.cs new file mode 100644 index 00000000..15434522 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfListener.cs @@ -0,0 +1,205 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.13.2 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from C:/CODE/SysML2.NET/Resources/kebnf.g4 by ANTLR 4.13.2 + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 +// Ambiguous reference in cref attribute +#pragma warning disable 419 + +namespace SysML2.NET.CodeGenerator.Grammar { +using Antlr4.Runtime.Misc; +using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener; +using IToken = Antlr4.Runtime.IToken; + +/// +/// This interface defines a complete listener for a parse tree produced by +/// . +/// +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")] +[System.CLSCompliant(false)] +public interface IkebnfListener : IParseTreeListener { + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterSpecification([NotNull] kebnfParser.SpecificationContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitSpecification([NotNull] kebnfParser.SpecificationContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterRule_definition([NotNull] kebnfParser.Rule_definitionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitRule_definition([NotNull] kebnfParser.Rule_definitionContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterParameter_list([NotNull] kebnfParser.Parameter_listContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitParameter_list([NotNull] kebnfParser.Parameter_listContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterAlternatives([NotNull] kebnfParser.AlternativesContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitAlternatives([NotNull] kebnfParser.AlternativesContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterAlternative([NotNull] kebnfParser.AlternativeContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitAlternative([NotNull] kebnfParser.AlternativeContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterElement([NotNull] kebnfParser.ElementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitElement([NotNull] kebnfParser.ElementContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterAssignment([NotNull] kebnfParser.AssignmentContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitAssignment([NotNull] kebnfParser.AssignmentContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterNon_parsing_assignment([NotNull] kebnfParser.Non_parsing_assignmentContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitNon_parsing_assignment([NotNull] kebnfParser.Non_parsing_assignmentContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterNon_parsing_empty([NotNull] kebnfParser.Non_parsing_emptyContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitNon_parsing_empty([NotNull] kebnfParser.Non_parsing_emptyContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterCross_reference([NotNull] kebnfParser.Cross_referenceContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitCross_reference([NotNull] kebnfParser.Cross_referenceContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterGroup([NotNull] kebnfParser.GroupContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitGroup([NotNull] kebnfParser.GroupContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterTerminal([NotNull] kebnfParser.TerminalContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitTerminal([NotNull] kebnfParser.TerminalContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterNon_terminal([NotNull] kebnfParser.Non_terminalContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitNon_terminal([NotNull] kebnfParser.Non_terminalContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterElement_core([NotNull] kebnfParser.Element_coreContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitElement_core([NotNull] kebnfParser.Element_coreContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterDotted_id([NotNull] kebnfParser.Dotted_idContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitDotted_id([NotNull] kebnfParser.Dotted_idContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterSuffix_op([NotNull] kebnfParser.Suffix_opContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitSuffix_op([NotNull] kebnfParser.Suffix_opContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterValue_literal([NotNull] kebnfParser.Value_literalContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitValue_literal([NotNull] kebnfParser.Value_literalContext context); +} +} // namespace SysML2.NET.CodeGenerator.Grammar diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfParser.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfParser.cs new file mode 100644 index 00000000..7cfb9dad --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfParser.cs @@ -0,0 +1,1447 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.13.2 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from C:/CODE/SysML2.NET/Resources/kebnf.g4 by ANTLR 4.13.2 + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 +// Ambiguous reference in cref attribute +#pragma warning disable 419 + +namespace SysML2.NET.CodeGenerator.Grammar { +using System; +using System.IO; +using System.Text; +using System.Diagnostics; +using System.Collections.Generic; +using Antlr4.Runtime; +using Antlr4.Runtime.Atn; +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using DFA = Antlr4.Runtime.Dfa.DFA; + +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")] +[System.CLSCompliant(false)] +public partial class kebnfParser : Parser { + protected static DFA[] decisionToDFA; + protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); + public const int + T__0=1, T__1=2, T__2=3, T__3=4, ASSIGN=5, ADD_ASSIGN=6, BOOL_ASSIGN=7, + PIPE=8, COLON=9, SEMICOLON=10, COMMA=11, LPAREN=12, RPAREN=13, LBRACK=14, + RBRACK=15, LBRACE=16, RBRACE=17, DOT=18, TILDE=19, UPPER_ID=20, ID=21, + SINGLE_QUOTED_STRING=22, INT=23, STRING=24, COMMENT=25, WS=26, CONTINUATION=27, + NL=28; + public const int + RULE_specification = 0, RULE_rule_definition = 1, RULE_parameter_list = 2, + RULE_alternatives = 3, RULE_alternative = 4, RULE_element = 5, RULE_assignment = 6, + RULE_non_parsing_assignment = 7, RULE_non_parsing_empty = 8, RULE_cross_reference = 9, + RULE_group = 10, RULE_terminal = 11, RULE_non_terminal = 12, RULE_element_core = 13, + RULE_dotted_id = 14, RULE_suffix_op = 15, RULE_value_literal = 16; + public static readonly string[] ruleNames = { + "specification", "rule_definition", "parameter_list", "alternatives", + "alternative", "element", "assignment", "non_parsing_assignment", "non_parsing_empty", + "cross_reference", "group", "terminal", "non_terminal", "element_core", + "dotted_id", "suffix_op", "value_literal" + }; + + private static readonly string[] _LiteralNames = { + null, "'*'", "'+'", "'?'", "'[QualifiedName]'", null, "'+='", "'?='", + "'|'", "':'", "';'", "','", "'('", "')'", "'['", "']'", "'{'", "'}'", + "'.'", "'~'" + }; + private static readonly string[] _SymbolicNames = { + null, null, null, null, null, "ASSIGN", "ADD_ASSIGN", "BOOL_ASSIGN", "PIPE", + "COLON", "SEMICOLON", "COMMA", "LPAREN", "RPAREN", "LBRACK", "RBRACK", + "LBRACE", "RBRACE", "DOT", "TILDE", "UPPER_ID", "ID", "SINGLE_QUOTED_STRING", + "INT", "STRING", "COMMENT", "WS", "CONTINUATION", "NL" + }; + public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); + + [NotNull] + public override IVocabulary Vocabulary + { + get + { + return DefaultVocabulary; + } + } + + public override string GrammarFileName { get { return "kebnf.g4"; } } + + public override string[] RuleNames { get { return ruleNames; } } + + public override int[] SerializedAtn { get { return _serializedATN; } } + + static kebnfParser() { + decisionToDFA = new DFA[_ATN.NumberOfDecisions]; + for (int i = 0; i < _ATN.NumberOfDecisions; i++) { + decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i); + } + } + + public kebnfParser(ITokenStream input) : this(input, Console.Out, Console.Error) { } + + public kebnfParser(ITokenStream input, TextWriter output, TextWriter errorOutput) + : base(input, output, errorOutput) + { + Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache); + } + + public partial class SpecificationContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Eof() { return GetToken(kebnfParser.Eof, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(kebnfParser.NL); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) { + return GetToken(kebnfParser.NL, i); + } + [System.Diagnostics.DebuggerNonUserCode] public Rule_definitionContext[] rule_definition() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public Rule_definitionContext rule_definition(int i) { + return GetRuleContext(i); + } + public SpecificationContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_specification; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterSpecification(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitSpecification(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitSpecification(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public SpecificationContext specification() { + SpecificationContext _localctx = new SpecificationContext(Context, State); + EnterRule(_localctx, 0, RULE_specification); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 37; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==NL) { + { + { + State = 34; + Match(NL); + } + } + State = 39; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + State = 41; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 40; + rule_definition(); + } + } + State = 43; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==UPPER_ID ); + State = 45; + Match(Eof); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Rule_definitionContext : ParserRuleContext { + public IToken name; + public Parameter_listContext @params; + public IToken target_ast; + public AlternativesContext rule_body; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ASSIGN() { return GetToken(kebnfParser.ASSIGN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] UPPER_ID() { return GetTokens(kebnfParser.UPPER_ID); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UPPER_ID(int i) { + return GetToken(kebnfParser.UPPER_ID, i); + } + [System.Diagnostics.DebuggerNonUserCode] public AlternativesContext alternatives() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode COLON() { return GetToken(kebnfParser.COLON, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SEMICOLON() { return GetToken(kebnfParser.SEMICOLON, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(kebnfParser.NL); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) { + return GetToken(kebnfParser.NL, i); + } + [System.Diagnostics.DebuggerNonUserCode] public Parameter_listContext parameter_list() { + return GetRuleContext(0); + } + public Rule_definitionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_rule_definition; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterRule_definition(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitRule_definition(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitRule_definition(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Rule_definitionContext rule_definition() { + Rule_definitionContext _localctx = new Rule_definitionContext(Context, State); + EnterRule(_localctx, 2, RULE_rule_definition); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 47; + _localctx.name = Match(UPPER_ID); + State = 49; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==LPAREN) { + { + State = 48; + _localctx.@params = parameter_list(); + } + } + + State = 53; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==COLON) { + { + State = 51; + Match(COLON); + State = 52; + _localctx.target_ast = Match(UPPER_ID); + } + } + + State = 55; + Match(ASSIGN); + State = 56; + _localctx.rule_body = alternatives(); + State = 58; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==SEMICOLON) { + { + State = 57; + Match(SEMICOLON); + } + } + + State = 61; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 60; + Match(NL); + } + } + State = 63; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==NL ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Parameter_listContext : ParserRuleContext { + public IToken param_name; + public IToken param_type; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPAREN() { return GetToken(kebnfParser.LPAREN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode COLON() { return GetToken(kebnfParser.COLON, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RPAREN() { return GetToken(kebnfParser.RPAREN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] ID() { return GetTokens(kebnfParser.ID); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID(int i) { + return GetToken(kebnfParser.ID, i); + } + public Parameter_listContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_parameter_list; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterParameter_list(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitParameter_list(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitParameter_list(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Parameter_listContext parameter_list() { + Parameter_listContext _localctx = new Parameter_listContext(Context, State); + EnterRule(_localctx, 4, RULE_parameter_list); + try { + EnterOuterAlt(_localctx, 1); + { + State = 65; + Match(LPAREN); + State = 66; + _localctx.param_name = Match(ID); + State = 67; + Match(COLON); + State = 68; + _localctx.param_type = Match(ID); + State = 69; + Match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class AlternativesContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public AlternativeContext[] alternative() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public AlternativeContext alternative(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] PIPE() { return GetTokens(kebnfParser.PIPE); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PIPE(int i) { + return GetToken(kebnfParser.PIPE, i); + } + public AlternativesContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_alternatives; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterAlternatives(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitAlternatives(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitAlternatives(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public AlternativesContext alternatives() { + AlternativesContext _localctx = new AlternativesContext(Context, State); + EnterRule(_localctx, 6, RULE_alternatives); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 71; + alternative(); + State = 76; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==PIPE) { + { + { + State = 72; + Match(PIPE); + State = 73; + alternative(); + } + } + State = 78; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class AlternativeContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ElementContext[] element() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ElementContext element(int i) { + return GetRuleContext(i); + } + public AlternativeContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_alternative; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterAlternative(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitAlternative(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitAlternative(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public AlternativeContext alternative() { + AlternativeContext _localctx = new AlternativeContext(Context, State); + EnterRule(_localctx, 8, RULE_alternative); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 82; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 33116176L) != 0)) { + { + { + State = 79; + element(); + } + } + State = 84; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ElementContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public AssignmentContext assignment() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Non_parsing_assignmentContext non_parsing_assignment() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Non_parsing_emptyContext non_parsing_empty() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Cross_referenceContext cross_reference() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public GroupContext group() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public TerminalContext terminal() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Non_terminalContext non_terminal() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Value_literalContext value_literal() { + return GetRuleContext(0); + } + public ElementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_element; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterElement(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitElement(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitElement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ElementContext element() { + ElementContext _localctx = new ElementContext(Context, State); + EnterRule(_localctx, 10, RULE_element); + try { + State = 93; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,8,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 85; + assignment(); + } + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 86; + non_parsing_assignment(); + } + break; + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 87; + non_parsing_empty(); + } + break; + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 88; + cross_reference(); + } + break; + case 5: + EnterOuterAlt(_localctx, 5); + { + State = 89; + group(); + } + break; + case 6: + EnterOuterAlt(_localctx, 6); + { + State = 90; + terminal(); + } + break; + case 7: + EnterOuterAlt(_localctx, 7); + { + State = 91; + non_terminal(); + } + break; + case 8: + EnterOuterAlt(_localctx, 8); + { + State = 92; + value_literal(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class AssignmentContext : ParserRuleContext { + public Dotted_idContext property; + public IToken op; + public IToken prefix; + public Element_coreContext content; + public Suffix_opContext suffix; + [System.Diagnostics.DebuggerNonUserCode] public Dotted_idContext dotted_id() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Element_coreContext element_core() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ASSIGN() { return GetToken(kebnfParser.ASSIGN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ADD_ASSIGN() { return GetToken(kebnfParser.ADD_ASSIGN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BOOL_ASSIGN() { return GetToken(kebnfParser.BOOL_ASSIGN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TILDE() { return GetToken(kebnfParser.TILDE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() { + return GetRuleContext(0); + } + public AssignmentContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_assignment; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterAssignment(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitAssignment(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitAssignment(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public AssignmentContext assignment() { + AssignmentContext _localctx = new AssignmentContext(Context, State); + EnterRule(_localctx, 12, RULE_assignment); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 95; + _localctx.property = dotted_id(); + State = 96; + _localctx.op = TokenStream.LT(1); + _la = TokenStream.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 224L) != 0)) ) { + _localctx.op = ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + State = 98; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,9,Context) ) { + case 1: + { + State = 97; + _localctx.prefix = Match(TILDE); + } + break; + } + State = 100; + _localctx.content = element_core(); + State = 102; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 14L) != 0)) { + { + State = 101; + _localctx.suffix = suffix_op(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Non_parsing_assignmentContext : ParserRuleContext { + public Dotted_idContext property; + public IToken op; + public Value_literalContext val; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LBRACE() { return GetToken(kebnfParser.LBRACE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RBRACE() { return GetToken(kebnfParser.RBRACE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Dotted_idContext dotted_id() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Value_literalContext value_literal() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ASSIGN() { return GetToken(kebnfParser.ASSIGN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ADD_ASSIGN() { return GetToken(kebnfParser.ADD_ASSIGN, 0); } + public Non_parsing_assignmentContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_non_parsing_assignment; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterNon_parsing_assignment(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitNon_parsing_assignment(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitNon_parsing_assignment(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Non_parsing_assignmentContext non_parsing_assignment() { + Non_parsing_assignmentContext _localctx = new Non_parsing_assignmentContext(Context, State); + EnterRule(_localctx, 14, RULE_non_parsing_assignment); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 104; + Match(LBRACE); + State = 105; + _localctx.property = dotted_id(); + State = 106; + _localctx.op = TokenStream.LT(1); + _la = TokenStream.LA(1); + if ( !(_la==ASSIGN || _la==ADD_ASSIGN) ) { + _localctx.op = ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + State = 107; + _localctx.val = value_literal(); + State = 108; + Match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Non_parsing_emptyContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LBRACE() { return GetToken(kebnfParser.LBRACE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RBRACE() { return GetToken(kebnfParser.RBRACE, 0); } + public Non_parsing_emptyContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_non_parsing_empty; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterNon_parsing_empty(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitNon_parsing_empty(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitNon_parsing_empty(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Non_parsing_emptyContext non_parsing_empty() { + Non_parsing_emptyContext _localctx = new Non_parsing_emptyContext(Context, State); + EnterRule(_localctx, 16, RULE_non_parsing_empty); + try { + EnterOuterAlt(_localctx, 1); + { + State = 110; + Match(LBRACE); + State = 111; + Match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Cross_referenceContext : ParserRuleContext { + public IToken @ref; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LBRACK() { return GetToken(kebnfParser.LBRACK, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RBRACK() { return GetToken(kebnfParser.RBRACK, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID() { return GetToken(kebnfParser.ID, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TILDE() { return GetToken(kebnfParser.TILDE, 0); } + public Cross_referenceContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_cross_reference; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterCross_reference(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitCross_reference(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitCross_reference(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Cross_referenceContext cross_reference() { + Cross_referenceContext _localctx = new Cross_referenceContext(Context, State); + EnterRule(_localctx, 18, RULE_cross_reference); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 114; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==TILDE) { + { + State = 113; + Match(TILDE); + } + } + + State = 116; + Match(LBRACK); + State = 117; + _localctx.@ref = Match(ID); + State = 118; + Match(RBRACK); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class GroupContext : ParserRuleContext { + public Suffix_opContext suffix; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPAREN() { return GetToken(kebnfParser.LPAREN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public AlternativesContext alternatives() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RPAREN() { return GetToken(kebnfParser.RPAREN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() { + return GetRuleContext(0); + } + public GroupContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_group; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterGroup(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitGroup(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitGroup(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public GroupContext group() { + GroupContext _localctx = new GroupContext(Context, State); + EnterRule(_localctx, 20, RULE_group); + try { + EnterOuterAlt(_localctx, 1); + { + State = 120; + Match(LPAREN); + State = 121; + alternatives(); + State = 122; + Match(RPAREN); + State = 124; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,12,Context) ) { + case 1: + { + State = 123; + _localctx.suffix = suffix_op(); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class TerminalContext : ParserRuleContext { + public IToken val; + public Suffix_opContext suffix; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SINGLE_QUOTED_STRING() { return GetToken(kebnfParser.SINGLE_QUOTED_STRING, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() { + return GetRuleContext(0); + } + public TerminalContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_terminal; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterTerminal(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitTerminal(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitTerminal(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public TerminalContext terminal() { + TerminalContext _localctx = new TerminalContext(Context, State); + EnterRule(_localctx, 22, RULE_terminal); + try { + EnterOuterAlt(_localctx, 1); + { + State = 126; + _localctx.val = Match(SINGLE_QUOTED_STRING); + State = 128; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,13,Context) ) { + case 1: + { + State = 127; + _localctx.suffix = suffix_op(); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Non_terminalContext : ParserRuleContext { + public IToken name; + public Suffix_opContext suffix; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UPPER_ID() { return GetToken(kebnfParser.UPPER_ID, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() { + return GetRuleContext(0); + } + public Non_terminalContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_non_terminal; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterNon_terminal(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitNon_terminal(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitNon_terminal(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Non_terminalContext non_terminal() { + Non_terminalContext _localctx = new Non_terminalContext(Context, State); + EnterRule(_localctx, 24, RULE_non_terminal); + try { + EnterOuterAlt(_localctx, 1); + { + State = 130; + _localctx.name = Match(UPPER_ID); + State = 132; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,14,Context) ) { + case 1: + { + State = 131; + _localctx.suffix = suffix_op(); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Element_coreContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public Cross_referenceContext cross_reference() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public GroupContext group() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public TerminalContext terminal() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Non_terminalContext non_terminal() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public Value_literalContext value_literal() { + return GetRuleContext(0); + } + public Element_coreContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_element_core; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterElement_core(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitElement_core(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitElement_core(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Element_coreContext element_core() { + Element_coreContext _localctx = new Element_coreContext(Context, State); + EnterRule(_localctx, 26, RULE_element_core); + try { + State = 139; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,15,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 134; + cross_reference(); + } + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 135; + group(); + } + break; + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 136; + terminal(); + } + break; + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 137; + non_terminal(); + } + break; + case 5: + EnterOuterAlt(_localctx, 5); + { + State = 138; + value_literal(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Dotted_idContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] ID() { return GetTokens(kebnfParser.ID); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID(int i) { + return GetToken(kebnfParser.ID, i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] DOT() { return GetTokens(kebnfParser.DOT); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DOT(int i) { + return GetToken(kebnfParser.DOT, i); + } + public Dotted_idContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_dotted_id; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterDotted_id(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitDotted_id(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitDotted_id(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Dotted_idContext dotted_id() { + Dotted_idContext _localctx = new Dotted_idContext(Context, State); + EnterRule(_localctx, 28, RULE_dotted_id); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 141; + Match(ID); + State = 146; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==DOT) { + { + { + State = 142; + Match(DOT); + State = 143; + Match(ID); + } + } + State = 148; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Suffix_opContext : ParserRuleContext { + public Suffix_opContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_suffix_op; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterSuffix_op(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitSuffix_op(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitSuffix_op(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Suffix_opContext suffix_op() { + Suffix_opContext _localctx = new Suffix_opContext(Context, State); + EnterRule(_localctx, 30, RULE_suffix_op); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 149; + _la = TokenStream.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 14L) != 0)) ) { + ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Value_literalContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID() { return GetToken(kebnfParser.ID, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT() { return GetToken(kebnfParser.INT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STRING() { return GetToken(kebnfParser.STRING, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SINGLE_QUOTED_STRING() { return GetToken(kebnfParser.SINGLE_QUOTED_STRING, 0); } + public Value_literalContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_value_literal; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.EnterValue_literal(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IkebnfListener typedListener = listener as IkebnfListener; + if (typedListener != null) typedListener.ExitValue_literal(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IkebnfVisitor typedVisitor = visitor as IkebnfVisitor; + if (typedVisitor != null) return typedVisitor.VisitValue_literal(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Value_literalContext value_literal() { + Value_literalContext _localctx = new Value_literalContext(Context, State); + EnterRule(_localctx, 32, RULE_value_literal); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 151; + _la = TokenStream.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 31457296L) != 0)) ) { + ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + private static int[] _serializedATN = { + 4,1,28,154,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7, + 7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14, + 2,15,7,15,2,16,7,16,1,0,5,0,36,8,0,10,0,12,0,39,9,0,1,0,4,0,42,8,0,11, + 0,12,0,43,1,0,1,0,1,1,1,1,3,1,50,8,1,1,1,1,1,3,1,54,8,1,1,1,1,1,1,1,3, + 1,59,8,1,1,1,4,1,62,8,1,11,1,12,1,63,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1, + 3,5,3,75,8,3,10,3,12,3,78,9,3,1,4,5,4,81,8,4,10,4,12,4,84,9,4,1,5,1,5, + 1,5,1,5,1,5,1,5,1,5,1,5,3,5,94,8,5,1,6,1,6,1,6,3,6,99,8,6,1,6,1,6,3,6, + 103,8,6,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,9,3,9,115,8,9,1,9,1,9,1, + 9,1,9,1,10,1,10,1,10,1,10,3,10,125,8,10,1,11,1,11,3,11,129,8,11,1,12,1, + 12,3,12,133,8,12,1,13,1,13,1,13,1,13,1,13,3,13,140,8,13,1,14,1,14,1,14, + 5,14,145,8,14,10,14,12,14,148,9,14,1,15,1,15,1,16,1,16,1,16,0,0,17,0,2, + 4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,4,1,0,5,7,1,0,5,6,1,0,1,3, + 2,0,4,4,21,24,162,0,37,1,0,0,0,2,47,1,0,0,0,4,65,1,0,0,0,6,71,1,0,0,0, + 8,82,1,0,0,0,10,93,1,0,0,0,12,95,1,0,0,0,14,104,1,0,0,0,16,110,1,0,0,0, + 18,114,1,0,0,0,20,120,1,0,0,0,22,126,1,0,0,0,24,130,1,0,0,0,26,139,1,0, + 0,0,28,141,1,0,0,0,30,149,1,0,0,0,32,151,1,0,0,0,34,36,5,28,0,0,35,34, + 1,0,0,0,36,39,1,0,0,0,37,35,1,0,0,0,37,38,1,0,0,0,38,41,1,0,0,0,39,37, + 1,0,0,0,40,42,3,2,1,0,41,40,1,0,0,0,42,43,1,0,0,0,43,41,1,0,0,0,43,44, + 1,0,0,0,44,45,1,0,0,0,45,46,5,0,0,1,46,1,1,0,0,0,47,49,5,20,0,0,48,50, + 3,4,2,0,49,48,1,0,0,0,49,50,1,0,0,0,50,53,1,0,0,0,51,52,5,9,0,0,52,54, + 5,20,0,0,53,51,1,0,0,0,53,54,1,0,0,0,54,55,1,0,0,0,55,56,5,5,0,0,56,58, + 3,6,3,0,57,59,5,10,0,0,58,57,1,0,0,0,58,59,1,0,0,0,59,61,1,0,0,0,60,62, + 5,28,0,0,61,60,1,0,0,0,62,63,1,0,0,0,63,61,1,0,0,0,63,64,1,0,0,0,64,3, + 1,0,0,0,65,66,5,12,0,0,66,67,5,21,0,0,67,68,5,9,0,0,68,69,5,21,0,0,69, + 70,5,13,0,0,70,5,1,0,0,0,71,76,3,8,4,0,72,73,5,8,0,0,73,75,3,8,4,0,74, + 72,1,0,0,0,75,78,1,0,0,0,76,74,1,0,0,0,76,77,1,0,0,0,77,7,1,0,0,0,78,76, + 1,0,0,0,79,81,3,10,5,0,80,79,1,0,0,0,81,84,1,0,0,0,82,80,1,0,0,0,82,83, + 1,0,0,0,83,9,1,0,0,0,84,82,1,0,0,0,85,94,3,12,6,0,86,94,3,14,7,0,87,94, + 3,16,8,0,88,94,3,18,9,0,89,94,3,20,10,0,90,94,3,22,11,0,91,94,3,24,12, + 0,92,94,3,32,16,0,93,85,1,0,0,0,93,86,1,0,0,0,93,87,1,0,0,0,93,88,1,0, + 0,0,93,89,1,0,0,0,93,90,1,0,0,0,93,91,1,0,0,0,93,92,1,0,0,0,94,11,1,0, + 0,0,95,96,3,28,14,0,96,98,7,0,0,0,97,99,5,19,0,0,98,97,1,0,0,0,98,99,1, + 0,0,0,99,100,1,0,0,0,100,102,3,26,13,0,101,103,3,30,15,0,102,101,1,0,0, + 0,102,103,1,0,0,0,103,13,1,0,0,0,104,105,5,16,0,0,105,106,3,28,14,0,106, + 107,7,1,0,0,107,108,3,32,16,0,108,109,5,17,0,0,109,15,1,0,0,0,110,111, + 5,16,0,0,111,112,5,17,0,0,112,17,1,0,0,0,113,115,5,19,0,0,114,113,1,0, + 0,0,114,115,1,0,0,0,115,116,1,0,0,0,116,117,5,14,0,0,117,118,5,21,0,0, + 118,119,5,15,0,0,119,19,1,0,0,0,120,121,5,12,0,0,121,122,3,6,3,0,122,124, + 5,13,0,0,123,125,3,30,15,0,124,123,1,0,0,0,124,125,1,0,0,0,125,21,1,0, + 0,0,126,128,5,22,0,0,127,129,3,30,15,0,128,127,1,0,0,0,128,129,1,0,0,0, + 129,23,1,0,0,0,130,132,5,20,0,0,131,133,3,30,15,0,132,131,1,0,0,0,132, + 133,1,0,0,0,133,25,1,0,0,0,134,140,3,18,9,0,135,140,3,20,10,0,136,140, + 3,22,11,0,137,140,3,24,12,0,138,140,3,32,16,0,139,134,1,0,0,0,139,135, + 1,0,0,0,139,136,1,0,0,0,139,137,1,0,0,0,139,138,1,0,0,0,140,27,1,0,0,0, + 141,146,5,21,0,0,142,143,5,18,0,0,143,145,5,21,0,0,144,142,1,0,0,0,145, + 148,1,0,0,0,146,144,1,0,0,0,146,147,1,0,0,0,147,29,1,0,0,0,148,146,1,0, + 0,0,149,150,7,2,0,0,150,31,1,0,0,0,151,152,7,3,0,0,152,33,1,0,0,0,17,37, + 43,49,53,58,63,76,82,93,98,102,114,124,128,132,139,146 + }; + + public static readonly ATN _ATN = + new ATNDeserializer().Deserialize(_serializedATN); + + +} +} // namespace SysML2.NET.CodeGenerator.Grammar diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfVisitor.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfVisitor.cs new file mode 100644 index 00000000..658bbffc --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfVisitor.cs @@ -0,0 +1,138 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.13.2 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from C:/CODE/SysML2.NET/Resources/kebnf.g4 by ANTLR 4.13.2 + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 +// Ambiguous reference in cref attribute +#pragma warning disable 419 + +namespace SysML2.NET.CodeGenerator.Grammar { +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using IToken = Antlr4.Runtime.IToken; + +/// +/// This interface defines a complete generic visitor for a parse tree produced +/// by . +/// +/// The return type of the visit operation. +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")] +[System.CLSCompliant(false)] +public interface IkebnfVisitor : IParseTreeVisitor { + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSpecification([NotNull] kebnfParser.SpecificationContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitRule_definition([NotNull] kebnfParser.Rule_definitionContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitParameter_list([NotNull] kebnfParser.Parameter_listContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitAlternatives([NotNull] kebnfParser.AlternativesContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitAlternative([NotNull] kebnfParser.AlternativeContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitElement([NotNull] kebnfParser.ElementContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitAssignment([NotNull] kebnfParser.AssignmentContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitNon_parsing_assignment([NotNull] kebnfParser.Non_parsing_assignmentContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitNon_parsing_empty([NotNull] kebnfParser.Non_parsing_emptyContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitCross_reference([NotNull] kebnfParser.Cross_referenceContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitGroup([NotNull] kebnfParser.GroupContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitTerminal([NotNull] kebnfParser.TerminalContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitNon_terminal([NotNull] kebnfParser.Non_terminalContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitElement_core([NotNull] kebnfParser.Element_coreContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitDotted_id([NotNull] kebnfParser.Dotted_idContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSuffix_op([NotNull] kebnfParser.Suffix_opContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitValue_literal([NotNull] kebnfParser.Value_literalContext context); +} +} // namespace SysML2.NET.CodeGenerator.Grammar diff --git a/SysML2.NET.CodeGenerator/Grammar/GrammarLoader.cs b/SysML2.NET.CodeGenerator/Grammar/GrammarLoader.cs new file mode 100644 index 00000000..9aa3d884 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/GrammarLoader.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar +{ + using System.IO; + + using Antlr4.Runtime; + + using SysML2.NET.CodeGenerator.Grammar.Model; + + /// + /// Provides direct access to by providing file path + /// + public static class GrammarLoader + { + /// + /// Loads the + /// + /// The string uri that locates the KEBNF file to load + /// The loaded + /// If the does not locate an existing + public static TextualNotationSpecification LoadTextualNotationSpecification(string fileUri) + { + if (!File.Exists(fileUri)) + { + throw new FileNotFoundException("File not found", fileUri); + } + + var stream = CharStreams.fromPath(fileUri); + var lexer = new kebnfLexer(stream); + var tokens = new CommonTokenStream(lexer); + var parser = new kebnfParser(tokens); + + var tree = parser.specification(); + var explorer = new TextualNotationSpecificationVisitor(); + return (TextualNotationSpecification)explorer.Visit(tree); + } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/Alternatives.cs b/SysML2.NET.CodeGenerator/Grammar/Model/Alternatives.cs new file mode 100644 index 00000000..37fb9503 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/Alternatives.cs @@ -0,0 +1,59 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + using System.Collections.Generic; + using System.Linq; + + /// + /// Provides mapping data class for the alternative grammar part + /// + public class Alternatives: IPartOfTextualRule + { + /// + /// Gets a collection of that is part of the + /// + public List Elements { get; } = []; + + /// + /// Gets the + /// + public TextualNotationRule TextualNotationRule { get; init; } + + /// + /// Asserts that the current contains that are part of a collection iteration that could be called from + /// another rule + /// + /// The computation of the assertion + internal bool ContainsAssignmentRequiringDispatch() + { + var assignments = this.Elements.OfType().Where(x => x.Operator == "+=").ToList(); + var groupElements = this.Elements.OfType().Where(x => x.IsCollection).ToList(); + + if (assignments.Count == 0) + { + return false; + } + + return groupElements.Count == 0; + } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/AssignmentElement.cs b/SysML2.NET.CodeGenerator/Grammar/Model/AssignmentElement.cs new file mode 100644 index 00000000..719dd5d2 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/AssignmentElement.cs @@ -0,0 +1,48 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + /// + /// Defines the assignment element + /// + public class AssignmentElement: RuleElement + { + /// + /// Gets or set the property's name + /// + public string Property { get; set; } + + /// + /// Gets or sets the assignment operator + /// + public string Operator { get; set; } + + /// + /// Gets or sets the assignment value + /// + public RuleElement Value { get; set; } + + /// + /// Gets or sets an optional prefix + /// + public string Prefix { get; set; } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/GroupElement.cs b/SysML2.NET.CodeGenerator/Grammar/Model/GroupElement.cs new file mode 100644 index 00000000..820bbf6f --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/GroupElement.cs @@ -0,0 +1,35 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + using System.Collections.Generic; + + /// + /// Defines a group of + /// + public class GroupElement: RuleElement + { + /// + /// Gets the collection that are part of the + /// + public List Alternatives { get; } = []; + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/IPartOfTextualRule.cs b/SysML2.NET.CodeGenerator/Grammar/Model/IPartOfTextualRule.cs new file mode 100644 index 00000000..c47436d8 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/IPartOfTextualRule.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + /// + /// Asserts that the current element is part of + /// + public interface IPartOfTextualRule + { + /// + /// Gets the + /// + TextualNotationRule TextualNotationRule { get; } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/NonParsingAssignmentElement.cs b/SysML2.NET.CodeGenerator/Grammar/Model/NonParsingAssignmentElement.cs new file mode 100644 index 00000000..54060b60 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/NonParsingAssignmentElement.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + /// + /// Defines the non-parsing assignment element + /// + public class NonParsingAssignmentElement : RuleElement + { + /// + /// Gets or sets the property's name + /// + public string PropertyName { get; set; } + + /// + /// Gets or sets the assignment operator + /// + public string Operator { get; set; } + + /// + /// Gets or sets the assigned value + /// + public string Value { get; set; } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/NonTerminalElement.cs b/SysML2.NET.CodeGenerator/Grammar/Model/NonTerminalElement.cs new file mode 100644 index 00000000..48d3d91a --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/NonTerminalElement.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + /// + /// Describes a non-terminal Element + /// + public class NonTerminalElement: RuleElement + { + /// + /// Gets or sets the non-terminal element name + /// + public string Name { get; set; } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/RuleElement.cs b/SysML2.NET.CodeGenerator/Grammar/Model/RuleElement.cs new file mode 100644 index 00000000..dc937d23 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/RuleElement.cs @@ -0,0 +1,65 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + using System.Linq; + + /// + /// Base class that provides information about element that is part of a rule + /// + public abstract class RuleElement: IPartOfTextualRule + { + /// + /// Defines all suffix that defines optional elements + /// + private static readonly string[] OptionalSuffix = ["?", "*"]; + + /// + /// Defines all suffix that defines collection elements + /// + private static readonly string[] CollectionSuffix = ["*", "+"]; + + /// + /// Gets or sets an optional suffix + /// + public string Suffix { get; set; } + + /// + /// Asserts that the current rule element defines an optional element + /// + public bool IsOptional => !string.IsNullOrEmpty(this.Suffix) && OptionalSuffix.Contains(this.Suffix); + + /// + /// Asserts that the current rule element defines an collection element + /// + public bool IsCollection => !string.IsNullOrEmpty(this.Suffix) && CollectionSuffix.Contains(this.Suffix); + + /// + /// Gets or sets an optional that acts as container + /// + public RuleElement Container { get; set; } + + /// + /// Gets the + /// + public TextualNotationRule TextualNotationRule { get; init; } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/RuleParameter.cs b/SysML2.NET.CodeGenerator/Grammar/Model/RuleParameter.cs new file mode 100644 index 00000000..aa497875 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/RuleParameter.cs @@ -0,0 +1,38 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + /// + /// Defines possible parameter that could be added to a + /// + public class RuleParameter + { + /// + /// Gets the parameter's name + /// + public string ParameterName { get; set; } + + /// + /// Gets the name of the target Element + /// + public string TargetElementName { get; set; } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/TerminalElement.cs b/SysML2.NET.CodeGenerator/Grammar/Model/TerminalElement.cs new file mode 100644 index 00000000..ac2f8abe --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/TerminalElement.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + /// + /// Describes a terminal Element + /// + public class TerminalElement: RuleElement + { + /// + /// Gets or sets the terminal element value + /// + public string Value { get; set; } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/TextualNotationRule.cs b/SysML2.NET.CodeGenerator/Grammar/Model/TextualNotationRule.cs new file mode 100644 index 00000000..720ab8de --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/TextualNotationRule.cs @@ -0,0 +1,275 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + using System.Collections.Generic; + using System.Linq; + + /// + /// Describe the content of a rule + /// + public class TextualNotationRule + { + /// + /// Get or set rule's name + /// + public string RuleName { get; set; } + + /// + /// Gets or set the name of the KerML Element that the rule target + /// + public string TargetElementName { get; set; } + + /// + /// Gets or set an optional + /// + public RuleParameter Parameter { get; set; } + + /// + /// Gets or sets the raw string that declares the rule + /// + public string RawRule { get; set; } + + /// + /// Gets or the collection of defined by the rule + /// + public List Alternatives { get; } = []; + + /// + /// Asserts that the current Rule acts has a dispatcher or not. A dispatcher needs to have index access to access element into a collection. + /// + public bool IsDispatcherRule => this.ComputeIsDispatcherRule(); + + /// + /// Asserts that the rule described assignment of multiple collection + /// + public bool IsMultiCollectionAssignment => this.ComputeIsMultiCollectionAssigment(); + + /// + /// Gets names of property that a multicollection assignment defines + /// + /// The collection of property names + public IReadOnlyCollection QueryMultiCollectionPropertiesName() + { + if (!this.IsMultiCollectionAssignment) + { + return Enumerable.Empty().ToList(); + } + + var assignments = this.Alternatives.SelectMany(x => x.Elements).OfType(); + return assignments.Where(x => x.Operator == "+=").DistinctBy(x => x.Property).Select(x => x.Property).ToList(); + } + + /// + /// Computes the value of the + /// + /// The result of the assertion computation + private bool ComputeIsMultiCollectionAssigment() + { + if (this.Alternatives.Count == 1) + { + return false; + } + + var assignments = this.Alternatives.SelectMany(x => x.Elements).OfType(); + return assignments.Where(x => x.Operator == "+=").DistinctBy(x => x.Property).Count() > 1; + } + + /// + /// Computes the assertion that the is a dispatcher or not + /// + /// The result of the assertion computation + private bool ComputeIsDispatcherRule() + { + return this.Alternatives.Count > 1 && this.Alternatives.Any(x => x.Elements.OfType().Any(a => a.Operator == "+=")) + || this.Alternatives.Count == 1 && this.Alternatives[0].Elements.Count == 1 && this.Alternatives[0].Elements[0] is AssignmentElement { Operator: "+="}; + } + + /// + /// Gets the that requires a dispatcher + /// + /// The + public AssignmentElement GetAssignmentElementNeedingDispatcher() + { + if (!this.IsDispatcherRule) + { + return null; + } + + if (this.Alternatives.Count == 1) + { + return this.Alternatives[0].Elements[0] as AssignmentElement; + } + + return this.Alternatives.SelectMany(x => x.Elements).OfType().FirstOrDefault(x => x.Operator == "+="); + } + + /// + /// Recursively resolves the collection property names (properties used with the += operator) + /// that this rule and any referenced NonTerminal rules ultimately consume. + /// + /// All available rules for resolving NonTerminal references + /// A distinct set of collection property names (e.g., {"ownedRelationship"}) + public IReadOnlyCollection QueryCollectionPropertyNames(IReadOnlyList allRules) + { + var result = new HashSet(); + var visited = new HashSet(); + CollectCollectionPropertyNames(this, allRules, result, visited); + return result; + } + + /// + /// Recursively collects collection property names from a rule and its referenced NonTerminal rules + /// + /// The rule to inspect + /// All available rules for resolving NonTerminal references + /// The accumulated set of property names + /// Set of already-visited rule names to prevent infinite recursion + private static void CollectCollectionPropertyNames(TextualNotationRule rule, IReadOnlyList allRules, HashSet result, HashSet visited) + { + if (!visited.Add(rule.RuleName)) + { + return; + } + + foreach (var alternative in rule.Alternatives) + { + CollectCollectionPropertyNamesFromElements(alternative.Elements, allRules, result, visited); + } + } + + /// + /// Recursively collects collection property names from a list of + /// + /// The elements to inspect + /// All available rules for resolving NonTerminal references + /// The accumulated set of property names + /// Set of already-visited rule names to prevent infinite recursion + private static void CollectCollectionPropertyNamesFromElements(IEnumerable elements, IReadOnlyList allRules, HashSet result, HashSet visited) + { + foreach (var element in elements) + { + switch (element) + { + case AssignmentElement { Operator: "+=" } assignmentElement: + result.Add(assignmentElement.Property); + break; + case NonTerminalElement nonTerminalElement: + var referencedRule = allRules.SingleOrDefault(x => x.RuleName == nonTerminalElement.Name); + if (referencedRule != null) + { + CollectCollectionPropertyNames(referencedRule, allRules, result, visited); + } + + break; + case GroupElement groupElement: + foreach (var groupAlternative in groupElement.Alternatives) + { + CollectCollectionPropertyNamesFromElements(groupAlternative.Elements, allRules, result, visited); + } + + break; + } + } + } + + /// + /// Recursively resolves all property names (both scalar = and collection += assignments) + /// that this rule and any referenced NonTerminal rules consume. + /// + /// All available rules for resolving NonTerminal references + /// A distinct set of property names referenced by this rule tree + public IReadOnlyCollection QueryAllReferencedPropertyNames(IReadOnlyList allRules) + { + var result = new HashSet(); + var visited = new HashSet(); + CollectAllReferencedPropertyNames(this, allRules, result, visited); + return result; + } + + /// + /// Recursively collects all property names from a rule and its referenced NonTerminal rules + /// + /// The rule to inspect + /// All available rules for resolving NonTerminal references + /// The accumulated set of property names + /// Set of already-visited rule names to prevent infinite recursion + private static void CollectAllReferencedPropertyNames(TextualNotationRule rule, IReadOnlyList allRules, HashSet result, HashSet visited) + { + if (!visited.Add(rule.RuleName)) + { + return; + } + + foreach (var alternative in rule.Alternatives) + { + CollectAllReferencedPropertyNamesFromElements(alternative.Elements, allRules, result, visited); + } + } + + /// + /// Recursively collects all property names from a list of + /// + /// The elements to inspect + /// All available rules for resolving NonTerminal references + /// The accumulated set of property names + /// Set of already-visited rule names to prevent infinite recursion + private static void CollectAllReferencedPropertyNamesFromElements(IEnumerable elements, IReadOnlyList allRules, HashSet result, HashSet visited) + { + foreach (var element in elements) + { + switch (element) + { + case AssignmentElement assignmentElement: + result.Add(assignmentElement.Property); + + if (assignmentElement.Value is NonTerminalElement valueNonTerminal) + { + var valueRule = allRules.SingleOrDefault(x => x.RuleName == valueNonTerminal.Name); + + if (valueRule != null) + { + CollectAllReferencedPropertyNames(valueRule, allRules, result, visited); + } + } + + break; + case NonTerminalElement nonTerminalElement: + var referencedRule = allRules.SingleOrDefault(x => x.RuleName == nonTerminalElement.Name); + + if (referencedRule != null) + { + CollectAllReferencedPropertyNames(referencedRule, allRules, result, visited); + } + + break; + case GroupElement groupElement: + foreach (var groupAlternative in groupElement.Alternatives) + { + CollectAllReferencedPropertyNamesFromElements(groupAlternative.Elements, allRules, result, visited); + } + + break; + } + } + } + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/TextualNotationSpecification.cs b/SysML2.NET.CodeGenerator/Grammar/Model/TextualNotationSpecification.cs new file mode 100644 index 00000000..affae75c --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/TextualNotationSpecification.cs @@ -0,0 +1,35 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + using System.Collections.Generic; + + /// + /// Provides access to all defined into the textual notation specification + /// + public class TextualNotationSpecification + { + /// + /// Gets the collection of all + /// + public List Rules { get; } = []; + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/Model/ValueLiteralElement.cs b/SysML2.NET.CodeGenerator/Grammar/Model/ValueLiteralElement.cs new file mode 100644 index 00000000..1bf51879 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/Model/ValueLiteralElement.cs @@ -0,0 +1,39 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar.Model +{ + /// + /// Defines a that is a value literal + /// + public class ValueLiteralElement: RuleElement + { + /// + /// Gets or sets the literal value + /// + public string Value { get; init; } + + /// + /// Asserts that this value literal is to + /// + /// + public bool QueryIsQualifiedName() => this.Value == "[QualifiedName]"; + } +} diff --git a/SysML2.NET.CodeGenerator/Grammar/TextualNotationSpecificationVisitor.cs b/SysML2.NET.CodeGenerator/Grammar/TextualNotationSpecificationVisitor.cs new file mode 100644 index 00000000..2a17f4dd --- /dev/null +++ b/SysML2.NET.CodeGenerator/Grammar/TextualNotationSpecificationVisitor.cs @@ -0,0 +1,215 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.Grammar +{ + using System.Collections.Generic; + using System.Linq; + + using SysML2.NET.CodeGenerator.Grammar.Model; + + /// + /// Custom to read + /// + public class TextualNotationSpecificationVisitor: kebnfBaseVisitor + { + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as . + public override object VisitSpecification(kebnfParser.SpecificationContext context) + { + var specification = new TextualNotationSpecification(); + + specification.Rules.AddRange(context.rule_definition().Select(rule => (TextualNotationRule)this.Visit(rule))); + return specification; + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as + public override object VisitRule_definition(kebnfParser.Rule_definitionContext context) + { + var rule = new TextualNotationRule() + { + RuleName = context.name.Text, + TargetElementName = context.target_ast?.Text, + RawRule = context.GetText().Trim() + }; + + this.CurrentRule = rule; + + if (string.IsNullOrWhiteSpace(rule.RuleName)) + { + rule.RuleName = rule.TargetElementName; + } + + if (context.parameter_list() != null) + { + rule.Parameter = new RuleParameter() + { + ParameterName = context.parameter_list().param_name.Text, + TargetElementName = context.parameter_list().param_type.Text + }; + } + + rule.Alternatives.AddRange((IEnumerable)this.Visit(context.rule_body)); + return rule; + } + + /// + /// Gets or sets the current that is processed + /// + public TextualNotationRule CurrentRule { get; set; } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as an + public override object VisitAlternatives(kebnfParser.AlternativesContext context) + { + return context.alternative().Select(a => (Alternatives)this.Visit(a)); + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as an . + public override object VisitAlternative(kebnfParser.AlternativeContext context) + { + var alternatives = new Alternatives() + { + TextualNotationRule = this.CurrentRule + }; + + alternatives.Elements.AddRange(context.element().Select(e => (RuleElement)this.Visit(e)).Where(x => x != null)); + return alternatives; + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as . + public override object VisitAssignment(kebnfParser.AssignmentContext context) + { + var assignement = new AssignmentElement() + { + Property = context.property.GetText().Split(".")[^1], + Operator = context.op.Text, + Suffix = context.suffix?.GetText(), + Value = (RuleElement)this.Visit(context.content), + Prefix = context.prefix?.Text, + TextualNotationRule = this.CurrentRule + }; + + assignement.Value.Container = assignement; + return assignement; + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as + public override object VisitNon_parsing_assignment(kebnfParser.Non_parsing_assignmentContext context) + { + return new NonParsingAssignmentElement() + { + PropertyName = context.property.GetText(), + Operator = context.op.Text, + Value = context.val.GetText(), + TextualNotationRule = this.CurrentRule + }; + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + public override object VisitValue_literal(kebnfParser.Value_literalContext context) + { + return new ValueLiteralElement() + { + Value = context.GetText(), + TextualNotationRule = this.CurrentRule + }; + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as . + public override object VisitGroup(kebnfParser.GroupContext context) + { + var group = new GroupElement + { + Suffix = context.suffix?.GetText(), + TextualNotationRule = this.CurrentRule + }; + + group.Alternatives.AddRange((IEnumerable)this.Visit(context.alternatives())); + + foreach (var element in group.Alternatives.SelectMany(x => x.Elements)) + { + element.Container = group; + } + + return group; + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as . + public override object VisitTerminal(kebnfParser.TerminalContext context) + { + return new TerminalElement() + { + Value = context.val.Text.Trim('\''), + Suffix = context.suffix?.GetText(), + TextualNotationRule = this.CurrentRule + }; + } + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result, as . + public override object VisitNon_terminal(kebnfParser.Non_terminalContext context) + { + return new NonTerminalElement() + { + Name = context.name.Text, + Suffix = context.suffix?.GetText(), + TextualNotationRule = this.CurrentRule + }; + } + } +} diff --git a/SysML2.NET.CodeGenerator/HandleBarHelpers/NamedElementHelper.cs b/SysML2.NET.CodeGenerator/HandleBarHelpers/NamedElementHelper.cs index 2705fd89..1a7e63dc 100644 --- a/SysML2.NET.CodeGenerator/HandleBarHelpers/NamedElementHelper.cs +++ b/SysML2.NET.CodeGenerator/HandleBarHelpers/NamedElementHelper.cs @@ -52,6 +52,16 @@ public static void RegisterNamedElementHelper(this IHandlebars handlebars) writer.WriteSafeString(namedElement.QueryNamespace()); }); + + handlebars.RegisterHelper("NamedElement.WriteFullyQualifiedTypeName", (writer, _, arguments) => + { + if (arguments[0] is not INamedElement namedElement) + { + throw new ArgumentException("supposed to be INamedElement"); + } + + writer.WriteSafeString(namedElement.QueryFullyQualifiedTypeName()); + }); } } } diff --git a/SysML2.NET.CodeGenerator/HandleBarHelpers/RulesHelper.cs b/SysML2.NET.CodeGenerator/HandleBarHelpers/RulesHelper.cs new file mode 100644 index 00000000..2c4e3f56 --- /dev/null +++ b/SysML2.NET.CodeGenerator/HandleBarHelpers/RulesHelper.cs @@ -0,0 +1,2361 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.CodeGenerator.HandleBarHelpers +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using HandlebarsDotNet; + + using SysML2.NET.CodeGenerator.Extensions; + using SysML2.NET.CodeGenerator.Grammar.Model; + + using uml4net; + using uml4net.Classification; + using uml4net.CommonStructure; + using uml4net.Extensions; + using uml4net.StructuredClassifiers; + + /// + /// Provides textual notation rules related helper for + /// + public static class RulesHelper + { + /// + /// Register this helper + /// + /// The context with which the helper needs to be registered + public static void RegisterRulesHelper(this IHandlebars handlebars) + { + handlebars.RegisterHelper("RulesHelper.ContainsAnyDispatcherRules", (_, arguments) => + { + if (arguments.Length != 1) + { + throw new ArgumentException("RulesHelper.ContainsAnyDispatcherRules expects to have 3 arguments"); + } + + return arguments[0] is not List allRules + ? throw new ArgumentException("RulesHelper.ContainsAnyDispatcherRules expects a list of TextualNotationRule as only argument") + : allRules.Any(x => x.IsDispatcherRule); + }); + + handlebars.RegisterHelper("RulesHelper.WriteRule", (writer, _, arguments) => + { + if (arguments.Length != 3) + { + throw new ArgumentException("RulesHelper.WriteRule expects to have 3 arguments"); + } + + if (arguments[0] is not TextualNotationRule textualRule) + { + throw new ArgumentException("RulesHelper.WriteRule expects TextualNotationRule as first argument"); + } + + if (arguments[1] is not INamedElement namedElement) + { + throw new ArgumentException("RulesHelper.WriteRule expects INamedElement as second argument"); + } + + if (arguments[2] is not List allRules) + { + throw new ArgumentException("RulesHelper.WriteRule expects a list of TextualNotationRule as third argument"); + } + + if (namedElement is IClass umlClass) + { + var ruleGenerationContext = new RuleGenerationContext(namedElement) + { + CurrentVariableName = "poco" + }; + + ruleGenerationContext.AllRules.AddRange(allRules); + ProcessAlternatives(writer, umlClass, textualRule.Alternatives, ruleGenerationContext); + } + }); + } + + /// + /// Processes a collection of a + /// + /// The used to write into output content + /// The related + /// The collection of alternatives to process + /// The current + /// Asserts that the current is part of a multiple alternative process + private static void ProcessAlternatives(EncodedTextWriter writer, IClass umlClass, IReadOnlyCollection alternatives, RuleGenerationContext ruleGenerationContext, bool isPartOfMultipleAlternative = false) + { + ruleGenerationContext.DefinedCursors ??= []; + + if (alternatives.Count == 1) + { + var alternative = alternatives.ElementAt(0); + var elements = alternative.Elements; + DeclareAllRequiredCursors(writer, umlClass, alternative, ruleGenerationContext); + + if (ruleGenerationContext.CallerRule is { IsOptional: true, IsCollection: false }) + { + var targetPropertiesName = elements.OfType().Select(x => x.Property).Distinct().ToList(); + var allProperties = umlClass.QueryAllProperties(); + + if (targetPropertiesName.Count > 0) + { + writer.WriteSafeString(Environment.NewLine); + writer.WriteSafeString("if("); + + var ifStatementContent = new List(); + + foreach (var targetPropertyName in targetPropertiesName) + { + var property = allProperties.Single(x => string.Equals(x.Name, targetPropertyName, StringComparison.OrdinalIgnoreCase)); + + if (property.QueryIsEnumerable()) + { + var assigment = elements.OfType().First(x => x.Property == targetPropertyName); + var iterator = ruleGenerationContext.DefinedCursors.FirstOrDefault(x => x.ApplicableRuleElements.Contains(assigment)); + ifStatementContent.Add(iterator == null ? $"BuildGroupConditionFor{assigment.TextualNotationRule.RuleName}(poco)" : property.QueryIfStatementContentForNonEmpty(iterator.CursorVariableName)); + } + else + { + ifStatementContent.Add(property.QueryIfStatementContentForNonEmpty("poco")); + } + } + + writer.WriteSafeString(string.Join(" && ", ifStatementContent)); + writer.WriteSafeString($"){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + var previousSiblings = ruleGenerationContext.CurrentSiblingElements; + var previousIndex = ruleGenerationContext.CurrentElementIndex; + ruleGenerationContext.CurrentSiblingElements = elements; + + for (var elementIndex = 0; elementIndex < elements.Count; elementIndex++) + { + ruleGenerationContext.CurrentElementIndex = elementIndex; + var previousCaller = ruleGenerationContext.CallerRule; + ProcessRuleElement(writer, umlClass, elements[elementIndex], ruleGenerationContext); + ruleGenerationContext.CallerRule = previousCaller; + } + + ruleGenerationContext.CurrentSiblingElements = previousSiblings; + ruleGenerationContext.CurrentElementIndex = previousIndex; + } + else + { + var nonTerminalElements = elements.OfType().ToList(); + var inlineConditionParts = new List(); + + foreach (var nonTerminal in nonTerminalElements) + { + var referencedRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == nonTerminal.Name); + + if (referencedRule != null) + { + var condition = GenerateInlineOptionalCondition(referencedRule, umlClass, ruleGenerationContext.AllRules, "poco"); + + if (condition != null) + { + inlineConditionParts.Add(condition); + } + } + } + + if (inlineConditionParts.Count > 0) + { + writer.WriteSafeString($"{Environment.NewLine}if ({string.Join(" || ", inlineConditionParts)}){Environment.NewLine}"); + } + else + { + writer.WriteSafeString($"{Environment.NewLine}if (BuildGroupConditionFor{alternative.TextualNotationRule.RuleName}(poco)){Environment.NewLine}"); + } + + writer.WriteSafeString($"{{{Environment.NewLine}"); + + var previousSiblings = ruleGenerationContext.CurrentSiblingElements; + var previousIndex = ruleGenerationContext.CurrentElementIndex; + ruleGenerationContext.CurrentSiblingElements = elements; + + for (var elementIndex = 0; elementIndex < elements.Count; elementIndex++) + { + ruleGenerationContext.CurrentElementIndex = elementIndex; + ProcessRuleElement(writer, umlClass, elements[elementIndex], ruleGenerationContext); + } + + ruleGenerationContext.CurrentSiblingElements = previousSiblings; + ruleGenerationContext.CurrentElementIndex = previousIndex; + } + + if (!ruleGenerationContext.IsNextElementNewLineTerminal() && !ruleGenerationContext.IsLastElement()) + { + writer.WriteSafeString($"stringBuilder.Append(' ');{Environment.NewLine}"); + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + var previousSiblings = ruleGenerationContext.CurrentSiblingElements; + var previousIndex = ruleGenerationContext.CurrentElementIndex; + ruleGenerationContext.CurrentSiblingElements = elements; + + for (var elementIndex = 0; elementIndex < elements.Count; elementIndex++) + { + ruleGenerationContext.CurrentElementIndex = elementIndex; + var previousCaller = ruleGenerationContext.CallerRule; + ProcessRuleElement(writer, umlClass, elements[elementIndex], ruleGenerationContext, isPartOfMultipleAlternative); + ruleGenerationContext.CallerRule = previousCaller; + } + + ruleGenerationContext.CurrentSiblingElements = previousSiblings; + ruleGenerationContext.CurrentElementIndex = previousIndex; + } + } + else + { + if (alternatives.All(x => x.Elements.Count == 1)) + { + if (alternatives.ElementAt(0).Elements[0].TextualNotationRule.IsMultiCollectionAssignment) + { + ProcessMultiCollectionAssignment(writer, umlClass, alternatives, ruleGenerationContext); + return; + } + + var types = alternatives.SelectMany(x => x.Elements).Select(x => x.GetType()).Distinct().ToList(); + + if(types.Count == 1) + { + ProcessUnitypedAlternativesWithOneElement(writer, umlClass, alternatives, ruleGenerationContext); + } + else + { + if (types.SequenceEqual([typeof(AssignmentElement), typeof(NonTerminalElement)])) + { + foreach (var alternative in alternatives) + { + DeclareAllRequiredCursors(writer, umlClass, alternative, ruleGenerationContext); + } + + for (var alternativeIndex = 0; alternativeIndex < alternatives.Count; alternativeIndex++) + { + var ruleElement = alternatives.ElementAt(alternativeIndex).Elements[0]; + + if (alternativeIndex != 0) + { + writer.WriteSafeString("else"); + } + + switch (ruleElement) + { + case AssignmentElement assignmentElement: + var targetProperty = umlClass.QueryAllProperties().Single(x => string.Equals(x.Name, assignmentElement.Property)); + + if (alternativeIndex != 0) + { + writer.WriteSafeString(" "); + } + + if (targetProperty.QueryIsEnumerable()) + { + DeclareAllRequiredCursors(writer, umlClass, alternatives.ElementAt(0), ruleGenerationContext); + + var iterator = ruleGenerationContext.DefinedCursors.Single(x => x.ApplicableRuleElements.Contains(assignmentElement)); + + writer.WriteSafeString($"if({targetProperty.QueryIfStatementContentForNonEmpty(iterator.CursorVariableName)}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + } + else + { + writer.WriteSafeString($"{Environment.NewLine}if({targetProperty.QueryIfStatementContentForNonEmpty("poco")}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + } + + ProcessAssignmentElement(writer, umlClass, ruleGenerationContext, assignmentElement, true); + + writer.WriteSafeString($"{Environment.NewLine}}}"); + break; + + case NonTerminalElement nonTerminalElement: + writer.WriteSafeString($"{{{Environment.NewLine}"); + ProcessNonTerminalElement(writer, umlClass, nonTerminalElement, ruleGenerationContext); + writer.WriteSafeString($"{Environment.NewLine}}}"); + break; + } + } + } + else if (types.SequenceEqual([typeof(NonTerminalElement), typeof(AssignmentElement)])) + { + var nonTerminalElement = (NonTerminalElement)alternatives.ElementAt(0).Elements[0]; + var assignmentElements = alternatives.SelectMany(x => x.Elements).OfType().ToList(); + + var referencedAssignmentNonTerminals = assignmentElements.Select(x => x.Value).OfType().ToList(); + + if (referencedAssignmentNonTerminals.Count != assignmentElements.Count) + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + return; + } + + // Mixed NonTerminal + AssignmentElement dispatch: + // - AssignmentElements (+=) target cursor elements → if (cursor.Current is {Type}) { process + Move() } + // - NonTerminal targets the declaring class → else { BuildXxx(poco, ...) } + var targetProperty = umlClass.QueryAllProperties().Single(x => string.Equals(x.Name, assignmentElements[0].Property)); + var cursorVarName = $"{targetProperty.Name.LowerCaseFirstLetter()}Cursor"; + var existingCursor = ruleGenerationContext.DefinedCursors.FirstOrDefault(x => x.IsCursorValidForProperty(targetProperty)); + + if (existingCursor == null) + { + writer.WriteSafeString($"var {cursorVarName} = cursorCache.GetOrCreateCursor(poco.Id, \"{targetProperty.Name}\", poco.{targetProperty.QueryPropertyNameBasedOnUmlProperties()});{Environment.NewLine}"); + var cursorDef = new CursorDefinition { DefinedForProperty = targetProperty }; + + foreach (var assignmentElement in assignmentElements) + { + cursorDef.ApplicableRuleElements.Add(assignmentElement); + } + + ruleGenerationContext.DefinedCursors.Add(cursorDef); + } + else + { + cursorVarName = existingCursor.CursorVariableName; + } + + // Generate if/else chain: assignment types checked on cursor, NonTerminal called with poco + var assignmentMappedElements = OrderElementsByInheritance(referencedAssignmentNonTerminals, umlClass.Cache, ruleGenerationContext); + + for (var assignmentIndex = 0; assignmentIndex < assignmentMappedElements.Count; assignmentIndex++) + { + var mappedElement = assignmentMappedElements[assignmentIndex]; + + if (assignmentIndex > 0) + { + writer.WriteSafeString("else "); + } + + var assignmentVarName = mappedElement.UmlClass.Name.LowerCaseFirstLetter(); + writer.WriteSafeString($"if ({cursorVarName}.Current is {mappedElement.UmlClass.QueryFullyQualifiedTypeName()} {assignmentVarName}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + var previousVariableName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CurrentVariableName = assignmentVarName; + ProcessNonTerminalElement(writer, mappedElement.UmlClass, mappedElement.RuleElement, ruleGenerationContext); + ruleGenerationContext.CurrentVariableName = previousVariableName; + + writer.WriteSafeString($"{Environment.NewLine}{cursorVarName}.Move();{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + + // NonTerminal fallback: called with poco, not cursor element + writer.WriteSafeString($"else{Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + var nonTerminalReferencedRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == nonTerminalElement.Name); + var nonTerminalTypeTarget = nonTerminalReferencedRule != null + ? (nonTerminalReferencedRule.TargetElementName ?? nonTerminalReferencedRule.RuleName) + : umlClass.Name; + var nonTerminalCall = ResolveBuilderCall(umlClass, nonTerminalElement, nonTerminalTypeTarget, ruleGenerationContext); + + if (nonTerminalCall != null) + { + writer.WriteSafeString(nonTerminalCall); + } + else + { + var previousCaller = ruleGenerationContext.CallerRule; + var previousName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CallerRule = nonTerminalElement; + ProcessAlternatives(writer, umlClass, nonTerminalReferencedRule?.Alternatives, ruleGenerationContext); + ruleGenerationContext.CallerRule = previousCaller; + ruleGenerationContext.CurrentVariableName = previousName; + } + + writer.WriteSafeString($"{Environment.NewLine}}}{Environment.NewLine}"); + } + else if (alternatives.ElementAt(0).Elements[0] is TerminalElement terminalElement && alternatives.ElementAt(1).Elements[0] is AssignmentElement assignmentElement) + { + var targetProperty = umlClass.QueryAllProperties().Single(x => string.Equals(x.Name, assignmentElement.Property)); + + writer.WriteSafeString($"if(!{targetProperty.QueryIfStatementContentForNonEmpty("poco")}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + ProcessRuleElement(writer, umlClass, terminalElement, ruleGenerationContext); + writer.WriteSafeString($"{Environment.NewLine}}}"); + writer.WriteSafeString("else"); + writer.WriteSafeString($"{Environment.NewLine}{{{Environment.NewLine}"); + ProcessAssignmentElement(writer, umlClass, ruleGenerationContext, assignmentElement, true); + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + } + else + { + // When all alternatives consist exclusively of terminal elements (and optionally non-parsing assignments), handle via code-gen + if (alternatives.All(alt => alt.Elements.Count > 0 && alt.Elements.All(element => element is TerminalElement or NonParsingAssignmentElement))) + { + var nonParsingAssignments = alternatives + .SelectMany(alt => alt.Elements.OfType()) + .ToList(); + + if (nonParsingAssignments.Count == 0) + { + // Pure terminal alternatives — emit the first alternative + var firstAlternative = alternatives.ElementAt(0); + + foreach (var terminalOnly in firstAlternative.Elements.Cast()) + { + WriteTerminalAppend(writer, terminalOnly.Value); + } + } + else + { + // Terminal + non-parsing assignment alternatives — generate a switch on the assigned property + var assignmentPropertyName = nonParsingAssignments[0].PropertyName; + var targetProperty = umlClass.QueryAllProperties().SingleOrDefault(x => string.Equals(x.Name, assignmentPropertyName, StringComparison.OrdinalIgnoreCase)); + + if (targetProperty != null) + { + var targetPropertyName = targetProperty.QueryPropertyNameBasedOnUmlProperties(); + + writer.WriteSafeString($"switch ({ruleGenerationContext.CurrentVariableName ?? "poco"}.{targetPropertyName}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + foreach (var alternative in alternatives) + { + var nonParsingAssignment = alternative.Elements.OfType().Single(); + var terminals = alternative.Elements.OfType().ToList(); + var enumValueName = nonParsingAssignment.Value.Trim('\'').CapitalizeFirstLetter(); + + writer.WriteSafeString($"case {targetProperty.Type.QueryFullyQualifiedTypeName()}.{enumValueName}:{Environment.NewLine}"); + + foreach (var terminal in terminals) + { + WriteTerminalAppend(writer, terminal.Value); + } + + writer.WriteSafeString($"{Environment.NewLine}break;{Environment.NewLine}"); + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + // Fallback: emit first alternative terminals + var firstAlternative = alternatives.ElementAt(0); + + foreach (var terminalOnly in firstAlternative.Elements.OfType()) + { + WriteTerminalAppend(writer, terminalOnly.Value); + } + } + } + + return; + } + + // Detect pattern: property=[QualifiedName] | property=NonTerminal{containment+=property} + // e.g., type=[QualifiedName]|type=OwnedFeatureChain{ownedRelatedElement+=type} + // Runtime: if the referenced value is owned → call the chain builder, else → output qualifiedName + if (alternatives.Count == 2) + { + var qualifiedNameAlt = alternatives.FirstOrDefault(alt => + alt.Elements.Count == 1 + && alt.Elements[0] is AssignmentElement { Value: ValueLiteralElement qualifiedNameLiteral } + && qualifiedNameLiteral.QueryIsQualifiedName()); + + var chainAlt = alternatives.FirstOrDefault(alt => + alt.Elements.Count >= 2 + && alt.Elements[0] is AssignmentElement { Value: NonTerminalElement } + && alt.Elements.OfType().Any()); + + if (qualifiedNameAlt != null && chainAlt != null) + { + var qualifiedNameAssignment = (AssignmentElement)qualifiedNameAlt.Elements[0]; + var chainAssignment = (AssignmentElement)chainAlt.Elements[0]; + var chainNonTerminal = (NonTerminalElement)chainAssignment.Value; + var containmentAssignment = chainAlt.Elements.OfType().First(); + + var propertyName = qualifiedNameAssignment.Property; + var allProperties = umlClass.QueryAllProperties(); + var targetProperty = allProperties.SingleOrDefault(x => + string.Equals(x.Name, propertyName, StringComparison.OrdinalIgnoreCase)); + var containmentProperty = allProperties.SingleOrDefault(x => + string.Equals(x.Name, containmentAssignment.PropertyName, StringComparison.OrdinalIgnoreCase)); + + if (targetProperty != null && containmentProperty != null) + { + var variableName = ruleGenerationContext.CurrentVariableName ?? "poco"; + var resolvedPropertyName = targetProperty.QueryPropertyNameBasedOnUmlProperties(); + var resolvedContainmentName = containmentProperty.QueryPropertyNameBasedOnUmlProperties(); + + // Resolve the chain NonTerminal's target type + var referencedRule = ruleGenerationContext.AllRules + .SingleOrDefault(x => x.RuleName == chainNonTerminal.Name); + var typeTarget = referencedRule != null + ? (referencedRule.TargetElementName ?? referencedRule.RuleName) + : umlClass.Name; + + var chainTargetClass = umlClass.Cache.Values.OfType() + .SingleOrDefault(x => x.Name == typeTarget) as IClass; + + if (chainTargetClass != null) + { + var chainTypeName = chainTargetClass.QueryFullyQualifiedTypeName(); + var chainVarName = $"chained{resolvedPropertyName}As{chainTargetClass.Name}"; + + string builderCallString; + + if (typeTarget == ruleGenerationContext.NamedElementToGenerate.Name) + { + builderCallString = $"Build{chainNonTerminal.Name}({chainVarName}, cursorCache, stringBuilder);"; + } + else + { + builderCallString = $"{typeTarget}TextualNotationBuilder.Build{chainNonTerminal.Name}({chainVarName}, cursorCache, stringBuilder);"; + } + + writer.WriteSafeString($"if ({variableName}.{resolvedContainmentName}.Contains({variableName}.{resolvedPropertyName}) && {variableName}.{resolvedPropertyName} is {chainTypeName} {chainVarName}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"{builderCallString}{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + writer.WriteSafeString($"else if ({variableName}.{resolvedPropertyName} != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.Append({variableName}.{resolvedPropertyName}.qualifiedName);{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.Append(' ');{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + + return; + } + } + } + } + + // Multi-element alternatives (e.g., ';' | '{' NamespaceBodyElement* '}') + // Detect pattern: first alternative is terminal-only, second has collection assignment + var firstAlt = alternatives.ElementAt(0); + var hasTerminalOnlyFirstAlt = firstAlt.Elements.Count == 1 && firstAlt.Elements[0] is TerminalElement; + + if (hasTerminalOnlyFirstAlt && alternatives.Count == 2) + { + var secondAlt = alternatives.ElementAt(1); + var collectionAssignments = secondAlt.Elements.OfType().Where(x => x.Operator == "+=").ToList(); + var groupsWithCollectionAssignments = secondAlt.Elements.OfType() + .SelectMany(g => g.Alternatives.SelectMany(a => a.Elements.OfType().Where(x => x.Operator == "+="))) + .ToList(); + + var allCollectionAssignments = collectionAssignments.Concat(groupsWithCollectionAssignments).ToList(); + + if (allCollectionAssignments.Count > 0) + { + // Determine the collection property to check for emptiness + var collectionProperty = allCollectionAssignments[0].Property; + var targetProperty = umlClass.QueryAllProperties().SingleOrDefault(x => string.Equals(x.Name, collectionProperty, StringComparison.OrdinalIgnoreCase)); + var terminalValue = ((TerminalElement)firstAlt.Elements[0]).Value; + + if (targetProperty != null) + { + writer.WriteSafeString($"if(poco.{targetProperty.QueryPropertyNameBasedOnUmlProperties()}.Count == 0){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.AppendLine(\"{terminalValue}\");{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + writer.WriteSafeString($"else{Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + // Process the second alternative elements + DeclareAllRequiredCursors(writer, umlClass, secondAlt, ruleGenerationContext); + + foreach (var element in secondAlt.Elements) + { + ProcessRuleElement(writer, umlClass, element, ruleGenerationContext); + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + // Check for collection NonTerminal elements (e.g., ';' | '{' Items* '}') + // The body items are expressed as a standalone NonTerminal with IsCollection, not as AssignmentElements + var collectionNonTerminals = secondAlt.Elements.OfType().Where(x => x.IsCollection).ToList(); + + if (collectionNonTerminals.Count > 0) + { + // Resolve the collection property through the NonTerminal's rule tree + var nonTerminalRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == collectionNonTerminals[0].Name); + + if (nonTerminalRule != null) + { + var collectionPropertyNames = nonTerminalRule.QueryCollectionPropertyNames(ruleGenerationContext.AllRules); + + if (collectionPropertyNames.Count > 0) + { + var collectionPropertyName = collectionPropertyNames.First(); + var targetProperty = umlClass.QueryAllProperties().SingleOrDefault(x => string.Equals(x.Name, collectionPropertyName, StringComparison.OrdinalIgnoreCase)); + var terminalValue = ((TerminalElement)firstAlt.Elements[0]).Value; + + if (targetProperty != null) + { + var propertyAccessName = targetProperty.QueryPropertyNameBasedOnUmlProperties(); + + writer.WriteSafeString($"if(poco.{propertyAccessName}.Count == 0){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.AppendLine(\"{terminalValue}\");{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + writer.WriteSafeString($"else{Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + // Process non-collection elements (terminals like '{', '}' and optional assignments like isParallel?='parallel') + // but handle the collection NonTerminal explicitly with cursor + Move() + foreach (var element in secondAlt.Elements) + { + if (element is NonTerminalElement { IsCollection: true }) + { + // Generate explicit cursor-based loop with per-item builder call and Move() + var cursorVarName = $"{targetProperty.Name.LowerCaseFirstLetter()}Cursor"; + writer.WriteSafeString($"var {cursorVarName} = cursorCache.GetOrCreateCursor(poco.Id, \"{targetProperty.Name}\", poco.{propertyAccessName});{Environment.NewLine}"); + + // Resolve the builder call for the per-item NonTerminal + var collectionNonTerminal = (NonTerminalElement)element; + var referencedRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == collectionNonTerminal.Name); + var typeTarget = referencedRule != null + ? (referencedRule.TargetElementName ?? referencedRule.RuleName) + : umlClass.Name; + + var perItemCall = ResolveBuilderCall(umlClass, collectionNonTerminal, typeTarget, ruleGenerationContext); + + writer.WriteSafeString($"while ({cursorVarName}.Current != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + if (perItemCall != null) + { + writer.WriteSafeString(perItemCall); + } + else + { + // Type incompatible: inline the referenced rule's alternatives + var previousCaller = ruleGenerationContext.CallerRule; + var previousName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CallerRule = collectionNonTerminal; + ProcessAlternatives(writer, umlClass, referencedRule?.Alternatives, ruleGenerationContext); + ruleGenerationContext.CallerRule = previousCaller; + ruleGenerationContext.CurrentVariableName = previousName; + } + + writer.WriteSafeString($"{Environment.NewLine}{cursorVarName}.Move();{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + ProcessRuleElement(writer, umlClass, element, ruleGenerationContext); + } + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + // Check for non-collection NonTerminal elements (e.g., ';' | '{' CalculationBodyPart '}') + // Same body pattern but with a single sub-rule call instead of a while loop + var nonCollectionNonTerminals = secondAlt.Elements.OfType().Where(x => !x.IsCollection).ToList(); + + if (nonCollectionNonTerminals.Count > 0) + { + var nonTerminalRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == nonCollectionNonTerminals[0].Name); + + if (nonTerminalRule != null) + { + var collectionPropertyNames = nonTerminalRule.QueryCollectionPropertyNames(ruleGenerationContext.AllRules); + + if (collectionPropertyNames.Count > 0) + { + var collectionPropertyName = collectionPropertyNames.First(); + var targetProperty = umlClass.QueryAllProperties().SingleOrDefault(x => string.Equals(x.Name, collectionPropertyName, StringComparison.OrdinalIgnoreCase)); + var terminalValue = ((TerminalElement)firstAlt.Elements[0]).Value; + + if (targetProperty != null) + { + var propertyAccessName = targetProperty.QueryPropertyNameBasedOnUmlProperties(); + + writer.WriteSafeString($"if(poco.{propertyAccessName}.Count == 0){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.AppendLine(\"{terminalValue}\");{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + writer.WriteSafeString($"else{Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + foreach (var element in secondAlt.Elements) + { + if (element is NonTerminalElement { IsCollection: false } singleNonTerminal) + { + var cursorVarName = $"{targetProperty.Name.LowerCaseFirstLetter()}Cursor"; + writer.WriteSafeString($"var {cursorVarName} = cursorCache.GetOrCreateCursor(poco.Id, \"{targetProperty.Name}\", poco.{propertyAccessName});{Environment.NewLine}"); + + var referencedRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == singleNonTerminal.Name); + var typeTarget = referencedRule != null + ? (referencedRule.TargetElementName ?? referencedRule.RuleName) + : umlClass.Name; + + var perItemCall = ResolveBuilderCall(umlClass, singleNonTerminal, typeTarget, ruleGenerationContext); + + writer.WriteSafeString($"if ({cursorVarName}.Current != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + if (perItemCall != null) + { + writer.WriteSafeString(perItemCall); + } + else + { + var previousCaller = ruleGenerationContext.CallerRule; + var previousName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CallerRule = singleNonTerminal; + ProcessAlternatives(writer, umlClass, referencedRule?.Alternatives, ruleGenerationContext); + ruleGenerationContext.CallerRule = previousCaller; + ruleGenerationContext.CurrentVariableName = previousName; + } + + writer.WriteSafeString($"{Environment.NewLine}}}{Environment.NewLine}"); + } + else + { + ProcessRuleElement(writer, umlClass, element, ruleGenerationContext); + } + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + } + } + else + { + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + } + } + + /// + /// Processes for a that is a multicollection assignment + /// + /// The used to write into output content + /// The related + /// The collection of alternatives to process + /// The current + private static void ProcessMultiCollectionAssignment(EncodedTextWriter writer, IClass umlClass, IReadOnlyCollection alternatives, RuleGenerationContext ruleGenerationContext) + { + // Multi-collection assignment: alternatives assign += to different properties + // Each alternative is processed with cursor-based access on its respective property + var handCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + + /// + /// Process multiple when all of them only have one + /// + /// The used to write into output content + /// The related + /// The collection of alternatives to process + /// The current + private static void ProcessUnitypedAlternativesWithOneElement(EncodedTextWriter writer, IClass umlClass, IReadOnlyCollection alternatives, RuleGenerationContext ruleGenerationContext) + { + var firstRuleElement = alternatives.ElementAt(0).Elements[0]; + + switch (firstRuleElement) + { + case TerminalElement terminalElement: + WriteTerminalAppendWithLeadingSpace(writer, terminalElement.Value); + break; + case NonTerminalElement: + { + var nonTerminalElements = alternatives.SelectMany(x => x.Elements).OfType().ToList(); + var mappedNonTerminalElements = OrderElementsByInheritance(nonTerminalElements, umlClass.Cache, ruleGenerationContext); + + // Build a lookup of duplicate UML classes to determine which cases need when guards + var duplicateClasses = mappedNonTerminalElements + .GroupBy(x => x.UmlClass) + .Where(g => g.Count() > 1) + .ToDictionary(g => g.Key, g => g.ToList()); + + // For each duplicate group, resolve boolean ?= properties to use as when guards. + // Compute properties unique to each element vs all others in the group. + var whenGuards = new Dictionary(); + + foreach (var duplicateGroup in duplicateClasses) + { + var allProperties = duplicateGroup.Key.QueryAllProperties(); + + // Compute boolean ?= properties for each element in the group + var elementBoolProps = new List<(NonTerminalElement RuleElement, List BoolProps)>(); + + foreach (var element in duplicateGroup.Value) + { + var referencedRule = ruleGenerationContext.AllRules.Single(x => x.RuleName == element.RuleElement.Name); + var booleanProperties = QueryBooleanAssignmentProperties(referencedRule, ruleGenerationContext.AllRules); + elementBoolProps.Add((element.RuleElement, booleanProperties)); + } + + // Build the union of all other elements' properties for each element + for (var elementIndex = 0; elementIndex < elementBoolProps.Count; elementIndex++) + { + var current = elementBoolProps[elementIndex]; + var othersProperties = new HashSet(StringComparer.OrdinalIgnoreCase); + + for (var otherIndex = 0; otherIndex < elementBoolProps.Count; otherIndex++) + { + if (otherIndex != elementIndex) + { + foreach (var prop in elementBoolProps[otherIndex].BoolProps) + { + othersProperties.Add(prop); + } + } + } + + var uniqueProperties = current.BoolProps.Where(p => !othersProperties.Contains(p)).ToList(); + + if (uniqueProperties.Count > 0) + { + var guardParts = new List(); + + foreach (var boolProp in uniqueProperties) + { + var umlProperty = allProperties.FirstOrDefault(x => string.Equals(x.Name, boolProp, StringComparison.OrdinalIgnoreCase)); + + if (umlProperty != null) + { + guardParts.Add($"{{0}}.{umlProperty.QueryPropertyNameBasedOnUmlProperties()}"); + } + } + + if (guardParts.Count > 0) + { + whenGuards[current.RuleElement] = guardParts[0]; + } + } + } + + // Ensure exactly one element in the group has no when guard (the fallback). + // If all elements have guards, remove the guard from the one with the most unique properties + // (the most general rule, which should match when no specific guard applies). + var elementsWithGuards = duplicateGroup.Value.Where(e => whenGuards.ContainsKey(e.RuleElement)).ToList(); + + if (elementsWithGuards.Count == duplicateGroup.Value.Count) + { + // All elements have guards — remove the guard from the element with fewest boolean properties (most generic) + var fallbackElement = duplicateGroup.Value + .OrderBy(element => elementBoolProps + .Single(bp => bp.RuleElement == element.RuleElement).BoolProps.Count) + .First(); + whenGuards.Remove(fallbackElement.RuleElement); + } + + // Reorder the duplicate group: elements with when guards first, general (no guard) last + duplicateGroup.Value.Sort((a, b) => + { + var aHasGuard = whenGuards.ContainsKey(a.RuleElement); + var bHasGuard = whenGuards.ContainsKey(b.RuleElement); + + if (aHasGuard && !bHasGuard) return -1; + if (!aHasGuard && bHasGuard) return 1; + return 0; + }); + } + + // Check for unresolvable duplicates: more than one element without a when guard in a group + var hasUnresolvableDuplicates = duplicateClasses.Any(group => + group.Value.Count(element => !whenGuards.ContainsKey(element.RuleElement)) > 1); + + if (hasUnresolvableDuplicates) + { + // For unresolvable duplicate groups, use IsValidFor{RuleName}() as when guards + foreach (var duplicateGroup in duplicateClasses) + { + var unguardedElements = duplicateGroup.Value + .Where(element => !whenGuards.ContainsKey(element.RuleElement)) + .ToList(); + + if (unguardedElements.Count > 1) + { + // Add IsValidFor guards to all but the last unguarded element (fallback) + for (var elementIndex = 0; elementIndex < unguardedElements.Count - 1; elementIndex++) + { + var element = unguardedElements[elementIndex]; + whenGuards[element.RuleElement] = $"{{0}}.IsValidFor{element.RuleElement.Name}()"; + } + } + } + } + + // Rebuild the overall ordered list respecting the reordered duplicate groups + var reorderedElements = new List<(NonTerminalElement RuleElement, IClass UmlClass)>(); + var processedDuplicateClasses = new HashSet(); + + foreach (var element in mappedNonTerminalElements) + { + if (duplicateClasses.TryGetValue(element.UmlClass, out var duplicateGroup)) + { + if (processedDuplicateClasses.Add(element.UmlClass)) + { + // Insert all elements of this duplicate group in their reordered sequence + reorderedElements.AddRange(duplicateGroup); + } + } + else + { + reorderedElements.Add(element); + } + } + + mappedNonTerminalElements = reorderedElements; + + // Re-sort to ensure proper switch ordering: more specific types first, + // default case last. This prevents a superclass case (e.g., IType) from + // catching everything before guarded subclass cases (e.g., IFeature when ...). + var defaultElement = mappedNonTerminalElements + .LastOrDefault(x => x.UmlClass == ruleGenerationContext.NamedElementToGenerate && !whenGuards.ContainsKey(x.RuleElement)); + + mappedNonTerminalElements.Sort((a, b) => + { + var aIsDefault = defaultElement.RuleElement != null && a.RuleElement == defaultElement.RuleElement; + var bIsDefault = defaultElement.RuleElement != null && b.RuleElement == defaultElement.RuleElement; + + if (aIsDefault && !bIsDefault) return 1; + if (bIsDefault && !aIsDefault) return -1; + + var depthA = a.UmlClass.QueryAllGeneralClassifiers().Count(); + var depthB = b.UmlClass.QueryAllGeneralClassifiers().Count(); + + return depthB.CompareTo(depthA); + }); + + var variableName = "poco"; + + if (ruleGenerationContext.CallerRule is AssignmentElement assignmentElement) + { + var cursorToUse = ruleGenerationContext.DefinedCursors.Single(x => x.ApplicableRuleElements.Contains(assignmentElement)); + variableName = $"{cursorToUse.CursorVariableName}.Current"; + } + + writer.WriteSafeString($"switch({variableName}){Environment.NewLine}"); + writer.WriteSafeString("{"); + + // defaultElement was already determined above during the re-sort + + foreach (var orderedNonTerminalElement in mappedNonTerminalElements) + { + var previousVariableName = ruleGenerationContext.CurrentVariableName; + var hasWhenGuard = whenGuards.TryGetValue(orderedNonTerminalElement.RuleElement, out var guardTemplate); + + if (orderedNonTerminalElement.RuleElement == defaultElement.RuleElement && !hasWhenGuard) + { + writer.WriteSafeString($"default:{Environment.NewLine}"); + ruleGenerationContext.CurrentVariableName = variableName; + } + else if (hasWhenGuard) + { + // Case with when guard for disambiguation + var guardVarName = $"poco{orderedNonTerminalElement.UmlClass.Name}{orderedNonTerminalElement.RuleElement.Name}"; + var resolvedGuard = string.Format(guardTemplate, guardVarName); + writer.WriteSafeString($"case {orderedNonTerminalElement.UmlClass.QueryFullyQualifiedTypeName()} {guardVarName} when {resolvedGuard}:{Environment.NewLine}"); + ruleGenerationContext.CurrentVariableName = guardVarName; + } + else + { + var caseVarName = $"poco{orderedNonTerminalElement.UmlClass.Name}"; + writer.WriteSafeString($"case {orderedNonTerminalElement.UmlClass.QueryFullyQualifiedTypeName()} {caseVarName}:{Environment.NewLine}"); + ruleGenerationContext.CurrentVariableName = caseVarName; + } + + var previousCaller = ruleGenerationContext.CallerRule; + ruleGenerationContext.CallerRule = orderedNonTerminalElement.RuleElement; + + ProcessNonTerminalElement(writer, orderedNonTerminalElement.UmlClass, orderedNonTerminalElement.RuleElement, ruleGenerationContext); + + ruleGenerationContext.CallerRule = previousCaller; + ruleGenerationContext.CurrentVariableName = previousVariableName; + writer.WriteSafeString($"{Environment.NewLine}break;{Environment.NewLine}"); + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + + if (ruleGenerationContext.CallerRule is AssignmentElement assignmentElementForMove) + { + var cursorForMove = ruleGenerationContext.DefinedCursors.Single(x => x.ApplicableRuleElements.Contains(assignmentElementForMove)); + writer.WriteSafeString($"{cursorForMove.CursorVariableName}.Move();{Environment.NewLine}"); + } + + break; + } + case AssignmentElement: + var assignmentElements = alternatives.SelectMany(x => x.Elements).OfType().ToList(); + var propertiesTarget = assignmentElements.Select(x => x.Property).Distinct().ToList(); + + if (propertiesTarget.Count == 1) + { + var targetProperty = umlClass.QueryAllProperties().Single(x => string.Equals(x.Name, propertiesTarget[0])); + + if (assignmentElements.All(x => x.Operator == "+=") && assignmentElements.All(x => x.Value is NonTerminalElement)) + { + // Dispatcher rule: multiple alternatives all += to same property + // Use cursor-based switch on cursor.Current type + var orderElementsByInheritance = OrderElementsByInheritance(assignmentElements.Select(x => x.Value).OfType().ToList(), umlClass.Cache, ruleGenerationContext); + + // Declare cursor for this property via cursorCache + var cursorVarName = $"{targetProperty.Name.LowerCaseFirstLetter()}Cursor"; + var existingCursor = ruleGenerationContext.DefinedCursors.FirstOrDefault(x => x.IsCursorValidForProperty(targetProperty)); + + if (existingCursor == null) + { + writer.WriteSafeString($"var {cursorVarName} = cursorCache.GetOrCreateCursor(poco.Id, \"{targetProperty.Name}\", poco.{targetProperty.QueryPropertyNameBasedOnUmlProperties()});{Environment.NewLine}"); + var cursorDef = new CursorDefinition { DefinedForProperty = targetProperty }; + + foreach (var assignmentElement in assignmentElements) + { + cursorDef.ApplicableRuleElements.Add(assignmentElement); + } + + ruleGenerationContext.DefinedCursors.Add(cursorDef); + } + else + { + cursorVarName = existingCursor.CursorVariableName; + + foreach (var assignmentElement in assignmentElements) + { + existingCursor.ApplicableRuleElements.Add(assignmentElement); + } + } + + writer.WriteSafeString($"switch({cursorVarName}.Current){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + foreach (var orderedElement in orderElementsByInheritance) + { + var numberOfElementOfSameType = orderElementsByInheritance.Count(x => x.UmlClass == orderedElement.UmlClass); + + if (numberOfElementOfSameType == 1) + { + writer.WriteSafeString($"case {orderedElement.UmlClass.QueryFullyQualifiedTypeName()} {orderedElement.UmlClass.Name.LowerCaseFirstLetter()}:{Environment.NewLine}"); + } + else + { + writer.WriteSafeString($"case {orderedElement.UmlClass.QueryFullyQualifiedTypeName()} {orderedElement.UmlClass.Name.LowerCaseFirstLetter()} when {orderedElement.UmlClass.Name.LowerCaseFirstLetter()}.IsValidFor{orderedElement.RuleElement.Name}():{Environment.NewLine}"); + } + + var previousVariableName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CurrentVariableName = orderedElement.UmlClass.Name.LowerCaseFirstLetter(); + ProcessNonTerminalElement(writer, orderedElement.UmlClass, orderedElement.RuleElement, ruleGenerationContext); + ruleGenerationContext.CurrentVariableName = previousVariableName; + writer.WriteSafeString($"{Environment.NewLine}{cursorVarName}.Move();{Environment.NewLine}"); + writer.WriteSafeString($"break;{Environment.NewLine}"); + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + // Mixed operator alternatives on same property - use cursor-based switch + var orderElementsByInheritance = OrderElementsByInheritance(assignmentElements.Select(x => x.Value).OfType().ToList(), umlClass.Cache, ruleGenerationContext); + + var cursorVarName = $"{targetProperty.Name.LowerCaseFirstLetter()}Cursor"; + var existingCursor = ruleGenerationContext.DefinedCursors.FirstOrDefault(x => x.IsCursorValidForProperty(targetProperty)); + + if (existingCursor == null) + { + writer.WriteSafeString($"var {cursorVarName} = cursorCache.GetOrCreateCursor(poco.Id, \"{targetProperty.Name}\", poco.{targetProperty.QueryPropertyNameBasedOnUmlProperties()});{Environment.NewLine}"); + var cursorDef = new CursorDefinition { DefinedForProperty = targetProperty }; + + foreach (var assignmentElement in assignmentElements) + { + cursorDef.ApplicableRuleElements.Add(assignmentElement); + } + + ruleGenerationContext.DefinedCursors.Add(cursorDef); + } + else + { + cursorVarName = existingCursor.CursorVariableName; + } + + writer.WriteSafeString($"if({cursorVarName}.Current != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"switch({cursorVarName}.Current){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + foreach (var orderedElement in orderElementsByInheritance) + { + if (orderedElement.UmlClass.Name == "Element") + { + writer.WriteSafeString($"case {{ }} {orderedElement.UmlClass.Name.LowerCaseFirstLetter()}:{Environment.NewLine}"); + } + else + { + writer.WriteSafeString($"case {orderedElement.UmlClass.QueryFullyQualifiedTypeName()} {orderedElement.UmlClass.Name.LowerCaseFirstLetter()}:{Environment.NewLine}"); + } + + var previousVariableName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CurrentVariableName = orderedElement.UmlClass.Name.LowerCaseFirstLetter(); + ProcessNonTerminalElement(writer, orderedElement.UmlClass, orderedElement.RuleElement, ruleGenerationContext); + ruleGenerationContext.CurrentVariableName = previousVariableName; + writer.WriteSafeString($"{Environment.NewLine}break;{Environment.NewLine}"); + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + writer.WriteSafeString($"{cursorVarName}.Move();{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + } + else + { + foreach (var alternative in alternatives) + { + DeclareAllRequiredCursors(writer, umlClass, alternative, ruleGenerationContext); + } + + var properties = umlClass.QueryAllProperties(); + + for (var alternativeIndex = 0; alternativeIndex < alternatives.Count; alternativeIndex++) + { + if (alternativeIndex != 0) + { + writer.WriteSafeString("else "); + } + + var assignment = assignmentElements[alternativeIndex]; + var targetProperty = properties.Single(x => string.Equals(x.Name, assignment.Property)); + + var iterator = ruleGenerationContext.DefinedCursors.SingleOrDefault(x => x.ApplicableRuleElements.Contains(assignment)); + + if (assignment.Operator != "+=") + { + writer.WriteSafeString($"if({targetProperty.QueryIfStatementContentForNonEmpty(iterator?.CursorVariableName ?? "poco")}){Environment.NewLine}"); + } + + writer.WriteSafeString($"{{{Environment.NewLine}"); + ProcessAssignmentElement(writer, umlClass, ruleGenerationContext, assignment, true); + writer.WriteSafeString($"{Environment.NewLine}}}{Environment.NewLine}"); + } + } + + break; + default: + { + var defaultHandCodedRuleName = alternatives.ElementAt(0).TextualNotationRule.RuleName; + writer.WriteSafeString($"Build{defaultHandCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + break; + } + } + } + + /// + /// Extracts all boolean property names (assigned via ?=) from the elements of a grammar rule. + /// These properties can be used as when guards to disambiguate switch cases that share the same UML class type. + /// + /// The to inspect + /// All available rules for recursive resolution of NonTerminal elements + /// A list of property names that are boolean-assigned in this rule + private static List QueryBooleanAssignmentProperties(TextualNotationRule rule, IReadOnlyList allRules) + { + var result = new List(); + CollectBooleanAssignmentProperties(rule.Alternatives.SelectMany(x => x.Elements).ToList(), allRules, result, new HashSet()); + return result; + } + + /// + /// Recursively collects boolean ?= assignment property names from a list of + /// + /// The elements to inspect + /// All available rules for resolving NonTerminal references + /// The accumulated list of boolean property names + /// Set of already-visited rule names to prevent infinite recursion + private static void CollectBooleanAssignmentProperties(IReadOnlyList elements, IReadOnlyList allRules, List result, HashSet visited) + { + foreach (var element in elements) + { + switch (element) + { + case AssignmentElement { Operator: "?=" } assignment: + result.Add(assignment.Property); + break; + case GroupElement groupElement: + foreach (var groupAlternative in groupElement.Alternatives) + { + CollectBooleanAssignmentProperties(groupAlternative.Elements, allRules, result, visited); + } + + break; + case NonTerminalElement nonTerminal: + var referencedRule = allRules.SingleOrDefault(x => x.RuleName == nonTerminal.Name); + + if (referencedRule != null && visited.Add(referencedRule.RuleName)) + { + CollectBooleanAssignmentProperties(referencedRule.Alternatives.SelectMany(x => x.Elements).ToList(), allRules, result, visited); + } + + break; + } + } + } + + /// + /// Orders a collection of based on the inheritance ordering, to build switch expression + /// + /// The collection of to order + /// The + /// The current + /// The collection of ordered with the associated + private static List<(NonTerminalElement RuleElement, IClass UmlClass)> OrderElementsByInheritance(List nonTerminalElements, IXmiElementCache cache, RuleGenerationContext ruleGenerationContext) + { + var mapping = new List<(NonTerminalElement RuleElement, IClass UmlClass)>(); + var elementClass = cache.Values.Single(x => x is IClass { Name: "Element" }); + + foreach (var nonTerminalElement in nonTerminalElements) + { + var referencedRule = ruleGenerationContext.AllRules.Single(x => x.RuleName == nonTerminalElement.Name); + var referencedClassName = referencedRule.TargetElementName ?? referencedRule.RuleName; + var referencedClass =(IClass)(cache.Values.SingleOrDefault(x => x is IClass umlClass && umlClass.Name == referencedClassName)?? elementClass); + mapping.Add((nonTerminalElement, referencedClass)); + } + + // Capture original indices for stable tie-breaking before sorting + var originalIndices = mapping.Select((item, itemIndex) => (item.RuleElement, itemIndex)) + .ToDictionary(x => x.RuleElement, x => x.itemIndex); + + mapping.Sort((a, b) => + { + // Push the current class to the end (used as default case) + var aIsNamed = a.UmlClass == ruleGenerationContext.NamedElementToGenerate; + var bIsNamed = b.UmlClass == ruleGenerationContext.NamedElementToGenerate; + + if (aIsNamed && !bIsNamed) return 1; + if (bIsNamed && !aIsNamed) return -1; + + if (a.UmlClass == b.UmlClass) return 0; + + // Sort by inheritance depth (more specific types first). + // Any subclass has strictly more ancestors than its superclass, + // so depth-based ordering is transitive and correct for switch case ordering. + var depthA = a.UmlClass.QueryAllGeneralClassifiers().Count(); + var depthB = b.UmlClass.QueryAllGeneralClassifiers().Count(); + + if (depthA != depthB) + { + return depthB.CompareTo(depthA); + } + + // Same depth: preserve original grammar order for stability + return originalIndices[a.RuleElement].CompareTo(originalIndices[b.RuleElement]); + }); + + return mapping; + } + + /// + /// Declares all required cursors for all present inside an + /// + /// The used to write into output content + /// The related + /// The to process + /// The current + private static void DeclareAllRequiredCursors(EncodedTextWriter writer, IClass umlClass, Alternatives alternatives, RuleGenerationContext ruleGenerationContext) + { + foreach (var ruleElement in alternatives.Elements) + { + switch (ruleElement) + { + case AssignmentElement assignmentElement: + DeclareCursorIfRequired(writer, umlClass, assignmentElement, ruleGenerationContext); + break; + case GroupElement groupElement: + foreach (var groupElementAlternative in groupElement.Alternatives) + { + DeclareAllRequiredCursors(writer, umlClass, groupElementAlternative, ruleGenerationContext); + } + + break; + } + } + } + + /// + /// Processes a + /// + /// The used to write into output content + /// The related + /// The to process + /// The current + /// + /// If the type of the is not supported + private static void ProcessRuleElement(EncodedTextWriter writer, IClass umlClass, RuleElement textualRuleElement, RuleGenerationContext ruleGenerationContext, bool isPartOfMultipleAlternative = false) + { + switch (textualRuleElement) + { + case TerminalElement terminalElement: + WriteTerminalAppend(writer, terminalElement.Value); + break; + case NonTerminalElement nonTerminalElement: + if (ruleGenerationContext.CallerRule is NonTerminalElement { Container: AssignmentElement assignmentElementContainer }) + { + var textualBuilderClass = ruleGenerationContext.NamedElementToGenerate as IClass; + var assignedProperty = textualBuilderClass.QueryAllProperties().SingleOrDefault(x => x.Name == assignmentElementContainer.Property); + ruleGenerationContext.CurrentVariableName = assignedProperty == null ? "poco" : $"poco.{assignedProperty.QueryPropertyNameBasedOnUmlProperties()}"; + } + else + { + ruleGenerationContext.CurrentVariableName = "poco"; + } + + ProcessNonTerminalElement(writer, umlClass, nonTerminalElement,ruleGenerationContext, isPartOfMultipleAlternative); + + break; + case GroupElement groupElement: + ruleGenerationContext.CallerRule = groupElement ; + + if (groupElement.IsCollection && groupElement.Alternatives.Count == 1) + { + var assignmentRule = groupElement.Alternatives.SelectMany(x => x.Elements).FirstOrDefault(x => x is AssignmentElement { Value: NonTerminalElement } || x is AssignmentElement {Value: ValueLiteralElement}); + + if (assignmentRule is AssignmentElement assignmentElement) + { + var cursorToUse = ruleGenerationContext.DefinedCursors.Single(x => x.ApplicableRuleElements.Contains(assignmentElement)); + writer.WriteSafeString($"{Environment.NewLine}while({cursorToUse.CursorVariableName}.Current != null){Environment.NewLine}"); + } + + writer.WriteSafeString($"{{{Environment.NewLine}"); + ProcessAlternatives(writer, umlClass, groupElement.Alternatives, ruleGenerationContext); + + if (assignmentRule is AssignmentElement assignmentElementForMove) + { + var cursorToUse = ruleGenerationContext.DefinedCursors.Single(x => x.ApplicableRuleElements.Contains(assignmentElementForMove)); + writer.WriteSafeString($"{cursorToUse.CursorVariableName}.Move();{Environment.NewLine}"); + } + + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + else if (groupElement.IsCollection) + { + // Collection group with += assignments: generate a while loop with cursor-based switch + // e.g., (ownedRelationship+=DefinitionMember|ownedRelationship+=AliasMember|ownedRelationship+=Import)* + var groupAssignments = groupElement.Alternatives + .SelectMany(alternative => alternative.Elements) + .OfType() + .Where(assignment => assignment.Operator == "+=") + .ToList(); + + var groupNonTerminals = groupAssignments + .Select(assignment => assignment.Value) + .OfType() + .ToList(); + + if (groupAssignments.Count > 0 && groupNonTerminals.Count == groupAssignments.Count) + { + var groupPropertyName = groupAssignments[0].Property; + var groupTargetProperty = umlClass.QueryAllProperties().SingleOrDefault(x => string.Equals(x.Name, groupPropertyName, StringComparison.OrdinalIgnoreCase)); + + if (groupTargetProperty != null) + { + var groupCursorVarName = $"{groupTargetProperty.Name.LowerCaseFirstLetter()}Cursor"; + var existingGroupCursor = ruleGenerationContext.DefinedCursors.FirstOrDefault(x => x.IsCursorValidForProperty(groupTargetProperty)); + + if (existingGroupCursor == null) + { + var groupPropertyAccessName = groupTargetProperty.QueryPropertyNameBasedOnUmlProperties(); + writer.WriteSafeString($"var {groupCursorVarName} = cursorCache.GetOrCreateCursor(poco.Id, \"{groupTargetProperty.Name}\", poco.{groupPropertyAccessName});{Environment.NewLine}"); + var groupCursorDef = new CursorDefinition { DefinedForProperty = groupTargetProperty }; + + foreach (var groupAssignment in groupAssignments) + { + groupCursorDef.ApplicableRuleElements.Add(groupAssignment); + } + + ruleGenerationContext.DefinedCursors.Add(groupCursorDef); + } + else + { + groupCursorVarName = existingGroupCursor.CursorVariableName; + } + + var groupOrderedElements = OrderElementsByInheritance(groupNonTerminals, umlClass.Cache, ruleGenerationContext); + + writer.WriteSafeString($"while ({groupCursorVarName}.Current != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"switch ({groupCursorVarName}.Current){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + foreach (var groupOrderedElement in groupOrderedElements) + { + var groupCaseVarName = groupOrderedElement.UmlClass.Name.LowerCaseFirstLetter(); + writer.WriteSafeString($"case {groupOrderedElement.UmlClass.QueryFullyQualifiedTypeName()} {groupCaseVarName}:{Environment.NewLine}"); + + var previousVariableName = ruleGenerationContext.CurrentVariableName; + var previousCaller = ruleGenerationContext.CallerRule; + ruleGenerationContext.CurrentVariableName = groupCaseVarName; + ruleGenerationContext.CallerRule = groupOrderedElement.RuleElement; + ProcessNonTerminalElement(writer, groupOrderedElement.UmlClass, groupOrderedElement.RuleElement, ruleGenerationContext); + ruleGenerationContext.CurrentVariableName = previousVariableName; + ruleGenerationContext.CallerRule = previousCaller; + + writer.WriteSafeString($"{Environment.NewLine}break;{Environment.NewLine}"); + } + + writer.WriteSafeString($"}}{Environment.NewLine}"); + writer.WriteSafeString($"{groupCursorVarName}.Move();{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + var handCodedRuleName = groupElement.TextualNotationRule?.RuleName ?? "Unknown"; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + var handCodedRuleName = groupElement.TextualNotationRule?.RuleName ?? "Unknown"; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + ProcessAlternatives(writer, umlClass, groupElement.Alternatives, ruleGenerationContext); + } + + if (!groupElement.IsOptional && !ruleGenerationContext.IsNextElementNewLineTerminal()) + { + writer.WriteSafeString($"{Environment.NewLine}stringBuilder.Append(' ');"); + } + + break; + case AssignmentElement assignmentElement: + ProcessAssignmentElement(writer, umlClass, ruleGenerationContext, assignmentElement, isPartOfMultipleAlternative); + break; + case NonParsingAssignmentElement nonParsingAssignmentElement: + writer.WriteSafeString($"// NonParsing Assignment Element : {nonParsingAssignmentElement.PropertyName} {nonParsingAssignmentElement.Operator} {nonParsingAssignmentElement.Value} => Does not have to be process"); + break; + case ValueLiteralElement valueLiteralElement: + if (valueLiteralElement.QueryIsQualifiedName()) + { + writer.WriteSafeString($"stringBuilder.Append({ruleGenerationContext.CurrentVariableName}.qualifiedName);{Environment.NewLine}"); + + if (!ruleGenerationContext.IsNextElementNewLineTerminal()) + { + writer.WriteSafeString("stringBuilder.Append(' ');"); + } + } + else + { + var handCodedRuleName = textualRuleElement.TextualNotationRule?.RuleName ?? "Unknown"; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + + break; + default: + throw new ArgumentException("Unknown element type"); + } + + writer.WriteSafeString(Environment.NewLine); + } + + /// + /// Processes an + /// + /// The used to write into output content + /// The related + /// The to process + /// The current + /// Asserts that the current is part of a multiple alternative process + private static void ProcessAssignmentElement(EncodedTextWriter writer, IClass umlClass, RuleGenerationContext ruleGenerationContext, AssignmentElement assignmentElement, bool isPartOfMultipleAlternative = false) + { + var properties = umlClass.QueryAllProperties(); + var targetProperty = properties.SingleOrDefault(x => string.Equals(x.Name, assignmentElement.Property, StringComparison.OrdinalIgnoreCase)); + + if (targetProperty != null) + { + if (targetProperty.QueryIsEnumerable()) + { + if (assignmentElement.Value is NonTerminalElement nonTerminalElement) + { + var cursorToUse = ruleGenerationContext.DefinedCursors.Single(x => x.ApplicableRuleElements.Contains(assignmentElement)); + var usedVariable = $"{cursorToUse.CursorVariableName}.Current"; + + var previousVariableName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CurrentVariableName = usedVariable; + var previousCaller = ruleGenerationContext.CallerRule; + ruleGenerationContext.CallerRule = assignmentElement; + ProcessNonTerminalElement(writer, umlClass, nonTerminalElement, ruleGenerationContext); + ruleGenerationContext.CurrentVariableName = previousVariableName; + ruleGenerationContext.CallerRule = previousCaller; + + if (!isPartOfMultipleAlternative && assignmentElement.Container is not GroupElement { IsCollection: true } && assignmentElement.Container is not GroupElement { IsOptional: true }) + { + writer.WriteSafeString($"{cursorToUse.CursorVariableName}.Move();{Environment.NewLine}"); + } + } + else if (assignmentElement.Value is GroupElement groupElement) + { + var previousCaller = ruleGenerationContext.CallerRule; + ruleGenerationContext.CallerRule = assignmentElement; + ProcessAlternatives(writer, umlClass, groupElement.Alternatives, ruleGenerationContext); + ruleGenerationContext.CallerRule = previousCaller; + } + else if (assignmentElement.Value is ValueLiteralElement valueLiteralElement && valueLiteralElement.QueryIsQualifiedName()) + { + var cursorToUse = ruleGenerationContext.DefinedCursors.Single(x => x.ApplicableRuleElements.Contains(assignmentElement)); + + writer.WriteSafeString($"{Environment.NewLine}if({cursorToUse.CursorVariableName}.Current != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.Append({cursorToUse.CursorVariableName}.Current.qualifiedName);{Environment.NewLine}"); + writer.WriteSafeString($"{cursorToUse.CursorVariableName}.Move();{Environment.NewLine}"); + writer.WriteSafeString("}"); + } + else + { + var handCodedRuleName = assignmentElement.TextualNotationRule?.RuleName ?? "Unknown"; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + } + } + else + { + if (assignmentElement.IsOptional) + { + writer.WriteSafeString($"{Environment.NewLine}if({targetProperty.QueryIfStatementContentForNonEmpty("poco")}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.Append(poco.{targetProperty.Name.CapitalizeFirstLetter()});{Environment.NewLine}"); + writer.WriteSafeString("}"); + } + else + { + var targetPropertyName = targetProperty.QueryPropertyNameBasedOnUmlProperties(); + + if (targetProperty.QueryIsString()) + { + writer.WriteSafeString($"stringBuilder.Append(poco.{targetPropertyName});"); + } + else if (targetProperty.QueryIsBool()) + { + if (assignmentElement.Value is TerminalElement terminalElement) + { + if (!isPartOfMultipleAlternative && assignmentElement.Container is not GroupElement) + { + writer.WriteSafeString($"if({targetProperty.QueryIfStatementContentForNonEmpty("poco")}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.Append(\" {terminalElement.Value} \");{Environment.NewLine}"); + writer.WriteSafeString('}'); + } + else + { + writer.WriteSafeString($"stringBuilder.Append(\" {terminalElement.Value} \");"); + } + } + else + { + writer.WriteSafeString($"stringBuilder.Append(poco.{targetPropertyName}.ToString().ToLower());"); + } + } + else if (targetProperty.QueryIsEnum()) + { + writer.WriteSafeString($"stringBuilder.Append(poco.{targetPropertyName}.ToString().ToLower());"); + } + else if (targetProperty.QueryIsReferenceType()) + { + switch (assignmentElement.Value) + { + case NonTerminalElement nonTerminalElement: + { + var previousCaller = ruleGenerationContext.CallerRule; + ruleGenerationContext.CallerRule = nonTerminalElement; + ruleGenerationContext.CurrentVariableName = $"poco.{targetPropertyName}"; + ProcessNonTerminalElement(writer, targetProperty.Type as IClass, nonTerminalElement, ruleGenerationContext, isPartOfMultipleAlternative); + ruleGenerationContext.CurrentVariableName = "poco"; + ruleGenerationContext.CallerRule = previousCaller; + break; + } + case ValueLiteralElement valueLiteralElement when valueLiteralElement.QueryIsQualifiedName(): + if (isPartOfMultipleAlternative) + { + writer.WriteSafeString($"stringBuilder.Append(poco.{targetPropertyName}.qualifiedName);{Environment.NewLine}"); + + if (!ruleGenerationContext.IsNextElementNewLineTerminal()) + { + writer.WriteSafeString("stringBuilder.Append(' ');"); + } + } + else + { + writer.WriteSafeString($"{Environment.NewLine}if (poco.{targetPropertyName} != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString($"stringBuilder.Append(poco.{targetPropertyName}.qualifiedName);{Environment.NewLine}"); + + if (!ruleGenerationContext.IsNextElementNewLineTerminal()) + { + writer.WriteSafeString("stringBuilder.Append(' ');"); + } + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + + break; + default: + var handCodedRuleName = assignmentElement.TextualNotationRule?.RuleName ?? "Unknown"; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);"); + break; + } + } + else + { + writer.WriteSafeString($"stringBuilder.Append(poco.{targetPropertyName}.ToString());"); + } + } + } + } + else + { + writer.WriteSafeString($"Build{assignmentElement.Property.CapitalizeFirstLetter()}(poco, cursorCache, stringBuilder);"); + } + } + + /// + /// Process a + /// + /// The used to write into output content + /// The related + /// The to process + /// The current + /// Asserts that the current is part of a multiple alternative process + private static void ProcessNonTerminalElement(EncodedTextWriter writer, IClass umlClass, NonTerminalElement nonTerminalElement, RuleGenerationContext ruleGenerationContext, bool isPartOfMultipleAlternative = false) + { + var referencedRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == nonTerminalElement.Name); + + string typeTarget; + + if (referencedRule == null) + { + typeTarget = umlClass.Name; + } + else + { + typeTarget = referencedRule.TargetElementName ?? referencedRule.RuleName; + } + + var isForProperty = ruleGenerationContext.CurrentVariableName.Contains('.'); + + var emitPropertyNullGuard = isForProperty && !isPartOfMultipleAlternative; + + if (emitPropertyNullGuard) + { + writer.WriteSafeString($"{Environment.NewLine}if ({ruleGenerationContext.CurrentVariableName} != null){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + } + + if (nonTerminalElement.IsCollection) + { + EmitCollectionNonTerminalLoop(writer, umlClass, nonTerminalElement, referencedRule, typeTarget, ruleGenerationContext); + + if (emitPropertyNullGuard) + { + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + + return; + } + + if (typeTarget != ruleGenerationContext.NamedElementToGenerate.Name) + { + var targetType = umlClass.Cache.Values.OfType().SingleOrDefault(x => x.Name == typeTarget); + + if (targetType != null) + { + if (targetType is IClass targetClass && (umlClass.QueryAllGeneralClassifiers().Contains(targetClass) || !ruleGenerationContext.CurrentVariableName.Contains("poco"))) + { + if (ruleGenerationContext.CallerRule is AssignmentElement ) + { + var castedVariableName = $"elementAs{targetClass.Name}"; + writer.WriteSafeString($"{Environment.NewLine}if ({ruleGenerationContext.CurrentVariableName} is {targetClass.QueryFullyQualifiedTypeName()} {castedVariableName}){Environment.NewLine}"); + ruleGenerationContext.CurrentVariableName = castedVariableName; + writer.WriteSafeString($"{{{Environment.NewLine}"); + } + + var emittedCondition = TryEmitOptionalCondition(writer, nonTerminalElement, referencedRule, targetClass, ruleGenerationContext, ruleGenerationContext.CurrentVariableName); + + writer.WriteSafeString($"{targetType.Name}TextualNotationBuilder.Build{nonTerminalElement.Name}({ruleGenerationContext.CurrentVariableName}, cursorCache, stringBuilder);"); + + if (emittedCondition) + { + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + + if (ruleGenerationContext.CallerRule is AssignmentElement) + { + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + } + else + { + var previousCaller = ruleGenerationContext.CallerRule; + ruleGenerationContext.CallerRule = nonTerminalElement; + var previousName = ruleGenerationContext.CurrentVariableName; + + ProcessAlternatives(writer, umlClass, referencedRule?.Alternatives, ruleGenerationContext, isPartOfMultipleAlternative); + ruleGenerationContext.CallerRule = previousCaller; + ruleGenerationContext.CurrentVariableName = previousName; + } + } + else + { + var previousCaller = ruleGenerationContext.CallerRule; + ruleGenerationContext.CallerRule = nonTerminalElement; + var previousName = ruleGenerationContext.CurrentVariableName; + + ProcessAlternatives(writer, umlClass, referencedRule?.Alternatives, ruleGenerationContext, isPartOfMultipleAlternative); + ruleGenerationContext.CallerRule = previousCaller; + ruleGenerationContext.CurrentVariableName = previousName; + } + } + else + { + // When referencedRule is null, this is a handcoded stub (non-existing grammar rule). + // Handcoded stubs take the parent POCO, not the cursor element. + var variableToUse = referencedRule != null ? ruleGenerationContext.CurrentVariableName : "poco"; + + var emittedSameClassCondition = TryEmitOptionalCondition(writer, nonTerminalElement, referencedRule, umlClass, ruleGenerationContext, variableToUse); + + writer.WriteSafeString($"Build{nonTerminalElement.Name}({variableToUse}, cursorCache, stringBuilder);"); + + if (emittedSameClassCondition) + { + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + } + + if (emitPropertyNullGuard) + { + writer.WriteSafeString($"{Environment.NewLine}}}"); + } + } + + /// + /// Emits a while loop for a collection NonTerminal (e.g., ActionBodyItem*). + /// Resolves which POCO collection property the rule consumes by recursively tracing through + /// NonTerminal references, then emits cursor creation + while loop + per-item builder call. + /// + /// The used to write into output content + /// The related + /// The with * or + suffix + /// The resolved for the NonTerminal, or null + /// The resolved target type name for the builder class + /// The current + private static void EmitCollectionNonTerminalLoop(EncodedTextWriter writer, IClass umlClass, NonTerminalElement nonTerminalElement, TextualNotationRule referencedRule, string typeTarget, RuleGenerationContext ruleGenerationContext) + { + // Resolve which collection property this NonTerminal ultimately consumes + if (referencedRule != null) + { + var collectionPropertyNames = referencedRule.QueryCollectionPropertyNames(ruleGenerationContext.AllRules); + + if (collectionPropertyNames.Count == 1) + { + var propertyName = collectionPropertyNames.Single(); + var allProperties = umlClass.QueryAllProperties(); + var targetProperty = allProperties.SingleOrDefault(x => string.Equals(x.Name, propertyName, StringComparison.OrdinalIgnoreCase)); + + if (targetProperty != null && targetProperty.QueryIsEnumerable()) + { + // Ensure cursor is declared + var existingCursor = ruleGenerationContext.DefinedCursors.SingleOrDefault(x => x.IsCursorValidForProperty(targetProperty)); + string cursorVariableName; + + if (existingCursor != null) + { + cursorVariableName = existingCursor.CursorVariableName; + } + else + { + var cursorDefinition = new CursorDefinition { DefinedForProperty = targetProperty }; + var propertyAccessName = targetProperty.QueryPropertyNameBasedOnUmlProperties(); + writer.WriteSafeString($"var {cursorDefinition.CursorVariableName} = cursorCache.GetOrCreateCursor({ruleGenerationContext.CurrentVariableName}.Id, \"{targetProperty.Name}\", {ruleGenerationContext.CurrentVariableName}.{propertyAccessName});{Environment.NewLine}"); + ruleGenerationContext.DefinedCursors.Add(cursorDefinition); + cursorVariableName = cursorDefinition.CursorVariableName; + } + + // Resolve the correct builder class name for the per-item call + var perItemCall = ResolveBuilderCall(umlClass, nonTerminalElement, typeTarget, ruleGenerationContext); + + // When a collection NonTerminal is followed by another element sharing the same cursor, + // the while condition must exclude the next sibling's type to avoid consuming its elements. + // e.g., CalculationBodyItem* ResultExpressionMember → while (current is not IResultExpressionMembership) + var whileTypeExclusion = ResolveCollectionWhileTypeCondition(cursorVariableName, umlClass, referencedRule, ruleGenerationContext); + + // Build the full while condition: merged pattern to avoid "merge into pattern" warnings + var whileCondition = string.IsNullOrWhiteSpace(whileTypeExclusion) + ? $"{cursorVariableName}.Current != null" + : whileTypeExclusion; + + if (perItemCall != null) + { + // Emit while loop calling the per-item builder method with explicit Move() + writer.WriteSafeString($"while ({whileCondition}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + writer.WriteSafeString(perItemCall); + writer.WriteSafeString($"{Environment.NewLine}{cursorVariableName}.Move();{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + else + { + // Type incompatible: inline the referenced rule's alternatives inside the while loop + writer.WriteSafeString($"while ({whileCondition}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + + var previousCaller = ruleGenerationContext.CallerRule; + var previousName = ruleGenerationContext.CurrentVariableName; + ruleGenerationContext.CallerRule = nonTerminalElement; + + ProcessAlternatives(writer, umlClass, referencedRule.Alternatives, ruleGenerationContext); + + ruleGenerationContext.CallerRule = previousCaller; + ruleGenerationContext.CurrentVariableName = previousName; + + writer.WriteSafeString($"{Environment.NewLine}{cursorVariableName}.Move();{Environment.NewLine}"); + writer.WriteSafeString($"}}{Environment.NewLine}"); + } + + return; + } + } + } + + // Fallback for unresolvable cases — delegate to handcoded method + var handCodedRuleName = nonTerminalElement.TextualNotationRule?.RuleName ?? nonTerminalElement.Name; + writer.WriteSafeString($"Build{handCodedRuleName}HandCoded({ruleGenerationContext.CurrentVariableName ?? "poco"}, cursorCache, stringBuilder);{Environment.NewLine}"); + } + + /// + /// Resolves a type condition clause for the while loop in a collection NonTerminal loop. + /// When the collection has sibling elements after it, the while loop must stop before consuming those elements. + /// + /// The primary approach is a positive condition based on the collection item's own assignment target type + /// (e.g., UsageExtensionKeyword assigns to PrefixMetadataMember:OwningMembershipwhile (cursor.Current is IOwningMembership)). + /// + /// + /// Falls back to a negative exclusion based on the next sibling's target type when the positive approach + /// is not available (e.g., CalculationBodyItem* ResultExpressionMemberwhile (cursor.Current is not IResultExpressionMembership)). + /// + /// + /// The cursor variable name used in the while condition + /// The related + /// The resolved for the collection NonTerminal + /// The current + /// A type condition clause string, or empty string if no condition is needed + private static string ResolveCollectionWhileTypeCondition(string cursorVariableName, IClass umlClass, TextualNotationRule collectionRule, RuleGenerationContext ruleGenerationContext) + { + var siblings = ruleGenerationContext.CurrentSiblingElements; + var currentIndex = ruleGenerationContext.CurrentElementIndex; + + if (siblings == null || currentIndex + 1 >= siblings.Count) + { + return ""; + } + + // Primary approach: positive condition from the collection item's += assignment target type. + // Only applicable when ALL alternatives are += assignments (no mixed NonTerminal alternatives). + if (collectionRule != null) + { + var allElements = collectionRule.Alternatives.SelectMany(alternative => alternative.Elements).ToList(); + var assignmentNonTerminals = allElements + .OfType() + .Where(assignment => assignment.Operator == "+=") + .Select(assignment => assignment.Value) + .OfType() + .ToList(); + + var hasOnlyAssignments = allElements.All(element => element is AssignmentElement or NonParsingAssignmentElement); + + if (assignmentNonTerminals.Count > 0 && hasOnlyAssignments) + { + // Use the first assignment's target type as the positive condition + var itemRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == assignmentNonTerminals[0].Name); + var itemTypeTarget = itemRule != null ? (itemRule.TargetElementName ?? itemRule.RuleName) : null; + + if (itemTypeTarget != null) + { + var itemTargetClass = umlClass.Cache.Values.OfType() + .SingleOrDefault(x => x.Name == itemTypeTarget) as IClass; + + if (itemTargetClass != null) + { + return $"{cursorVariableName}.Current is {itemTargetClass.QueryFullyQualifiedTypeName()}"; + } + } + } + } + + // Fallback: negative exclusion based on the next sibling's target type + var nextSibling = siblings[currentIndex + 1]; + NonTerminalElement nextNonTerminal = null; + + switch (nextSibling) + { + case NonTerminalElement nonTerminal: + nextNonTerminal = nonTerminal; + break; + case AssignmentElement { Value: NonTerminalElement assignmentNonTerminal }: + nextNonTerminal = assignmentNonTerminal; + break; + case GroupElement groupElement: + nextNonTerminal = groupElement.Alternatives + .SelectMany(alternative => alternative.Elements) + .OfType() + .Select(assignment => assignment.Value) + .OfType() + .FirstOrDefault(); + break; + } + + if (nextNonTerminal == null) + { + return ""; + } + + var nextRule = ruleGenerationContext.AllRules.SingleOrDefault(x => x.RuleName == nextNonTerminal.Name); + var nextTypeTarget = nextRule != null ? (nextRule.TargetElementName ?? nextRule.RuleName) : null; + + if (nextTypeTarget == null) + { + return ""; + } + + var nextTargetClass = umlClass.Cache.Values.OfType() + .SingleOrDefault(x => x.Name == nextTypeTarget) as IClass; + + if (nextTargetClass == null) + { + return ""; + } + + return $"{cursorVariableName}.Current is not null and not {nextTargetClass.QueryFullyQualifiedTypeName()}"; + } + + /// + /// Resolves the builder method call string for a NonTerminal element, handling type targeting + /// (e.g., when ActionBodyItem : Type = means the builder lives on TypeTextualNotationBuilder). + /// Returns null when the target type is not compatible with the current poco variable + /// (e.g., when the rule targets a subclass like Package but poco is INamespace). + /// + /// The related + /// The to resolve + /// The resolved target type name + /// The current + /// A C# call expression string, or null if the types are incompatible + private static string ResolveBuilderCall(IClass umlClass, NonTerminalElement nonTerminalElement, string typeTarget, RuleGenerationContext ruleGenerationContext) + { + if (typeTarget == ruleGenerationContext.NamedElementToGenerate.Name) + { + return $"Build{nonTerminalElement.Name}({ruleGenerationContext.CurrentVariableName}, cursorCache, stringBuilder);"; + } + + var targetType = umlClass.Cache.Values.OfType().SingleOrDefault(x => x.Name == typeTarget); + + if (targetType is IClass targetClass) + { + // Check type compatibility: the target class must be the same as or a superclass of the current class + // e.g., Type is a superclass of AcceptActionUsage → compatible (IAcceptActionUsage IS an IType) + // e.g., Package is a subclass of Namespace → NOT compatible (INamespace is NOT an IPackage) + if (umlClass.QueryAllGeneralClassifiers().Contains(targetClass)) + { + return $"{targetType.Name}TextualNotationBuilder.Build{nonTerminalElement.Name}({ruleGenerationContext.CurrentVariableName}, cursorCache, stringBuilder);"; + } + + // Type is not compatible — caller should inline the rule alternatives + return null; + } + + return $"Build{nonTerminalElement.Name}({ruleGenerationContext.CurrentVariableName}, cursorCache, stringBuilder);"; + } + + /// + /// Declares a cursor to perform iteration over a collection, if required to declare it. + /// Uses cursorCache.GetOrCreateCursor to share cursor state across method calls. + /// + /// The used to write into output content + /// The related + /// The to process + /// The current + private static void DeclareCursorIfRequired(EncodedTextWriter writer, IClass umlClass, AssignmentElement assignmentElement, RuleGenerationContext ruleGenerationContext) + { + var allProperties = umlClass.QueryAllProperties(); + var targetProperty = allProperties.SingleOrDefault(x => string.Equals(x.Name, assignmentElement.Property, StringComparison.OrdinalIgnoreCase)); + + if (targetProperty == null || !targetProperty.QueryIsEnumerable()) + { + return; + } + + // Check if a cursor already exists for this property + if (ruleGenerationContext.DefinedCursors.SingleOrDefault(x => x.IsCursorValidForProperty(targetProperty) || x.ApplicableRuleElements.Contains(assignmentElement)) is { } alreadyDefinedCursor) + { + alreadyDefinedCursor.ApplicableRuleElements.Add(assignmentElement); + return; + } + + switch (assignmentElement.Value) + { + case NonTerminalElement: + case ValueLiteralElement: + case GroupElement: + { + var cursorToUse = new CursorDefinition + { + DefinedForProperty = targetProperty + }; + + cursorToUse.ApplicableRuleElements.Add(assignmentElement); + + var propertyAccessName = targetProperty.QueryPropertyNameBasedOnUmlProperties(); + writer.WriteSafeString($"var {cursorToUse.CursorVariableName} = cursorCache.GetOrCreateCursor(poco.Id, \"{targetProperty.Name}\", poco.{propertyAccessName});"); + writer.WriteSafeString(Environment.NewLine); + ruleGenerationContext.DefinedCursors.Add(cursorToUse); + break; + } + case AssignmentElement containedAssignment: + DeclareCursorIfRequired(writer, umlClass, containedAssignment, ruleGenerationContext); + break; + } + } + + /// + /// Terminals that should be emitted using AppendLine instead of Append, + /// because they represent structural delimiters that end a line in the textual notation. + /// + private static readonly HashSet NewLineTerminals = ["{", "}", ";"]; + + /// + /// Terminals after which no trailing space should be emitted, + /// because the next element is directly adjacent (e.g., content inside angle brackets, closing angle bracket, or the ~ prefix operator). + /// + private static readonly HashSet NoTrailingSpaceTerminals = ["<", ">", "~"]; + + /// + /// Writes the stringBuilder.Append or stringBuilder.AppendLine call for a terminal value, + /// applying formatting rules derived from the SysML v2 textual notation conventions: + /// + /// {, }, ; are emitted with AppendLine (newline after) + /// <, >, and ~ are emitted with no trailing space (adjacent to surrounding content) + /// , is emitted with a trailing space + /// Multi-character terminals (keywords) are emitted with a trailing space + /// Other single-character terminals are emitted as-is + /// + /// + /// The used to write into output content + /// The terminal string value to emit + private static void WriteTerminalAppend(EncodedTextWriter writer, string terminalValue) + { + if (NewLineTerminals.Contains(terminalValue)) + { + writer.WriteSafeString($"stringBuilder.AppendLine(\"{terminalValue}\");"); + return; + } + + if (NoTrailingSpaceTerminals.Contains(terminalValue)) + { + writer.WriteSafeString($"stringBuilder.Append(\"{terminalValue}\");"); + return; + } + + if (terminalValue.Length > 1 || terminalValue == ",") + { + writer.WriteSafeString($"stringBuilder.Append(\"{terminalValue} \");"); + return; + } + + writer.WriteSafeString($"stringBuilder.Append(\"{terminalValue}\");"); + } + + /// + /// Writes a terminal value with a leading space, used for keyword-like terminals that appear + /// as alternatives in untyped multi-alternative rules (e.g., '~' | 'conjugates'). + /// The leading space ensures visual separation from the preceding element. + /// Structural terminals ({, }, ;) still use AppendLine. + /// + /// The used to write into output content + /// The terminal string value to emit + private static void WriteTerminalAppendWithLeadingSpace(EncodedTextWriter writer, string terminalValue) + { + if (NewLineTerminals.Contains(terminalValue)) + { + writer.WriteSafeString($"stringBuilder.AppendLine(\"{terminalValue}\");"); + return; + } + + if (NoTrailingSpaceTerminals.Contains(terminalValue)) + { + writer.WriteSafeString($"stringBuilder.Append(\" {terminalValue}\");"); + return; + } + + writer.WriteSafeString($"stringBuilder.Append(\" {terminalValue} \");"); + } + + /// + /// Generates an inline condition string for an optional NonTerminal by recursively resolving + /// the referenced rule's property references and building a compound boolean expression. + /// + /// The that the optional NonTerminal references + /// The on which properties are resolved (the class the referenced rule targets) + /// All available rules for recursive resolution + /// The variable name to use in the condition (e.g., poco or poco.ownedMemberFeature) + /// The condition string (e.g., !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0), or null if no properties could be resolved + private static string GenerateInlineOptionalCondition(TextualNotationRule referencedRule, IClass targetClass, IReadOnlyList allRules, string variableName) + { + var propertyNames = referencedRule.QueryAllReferencedPropertyNames(allRules); + + if (propertyNames.Count == 0) + { + return null; + } + + var allProperties = targetClass.QueryAllProperties(); + var conditionParts = new List(); + + foreach (var propertyName in propertyNames) + { + var property = allProperties.FirstOrDefault(x => string.Equals(x.Name, propertyName, StringComparison.OrdinalIgnoreCase)); + + if (property == null) + { + continue; + } + + var umlPropertyName = property.QueryPropertyNameBasedOnUmlProperties(); + + if (property.QueryIsEnumerable()) + { + conditionParts.Add($"{variableName}.{umlPropertyName}.Count != 0"); + } + else + { + conditionParts.Add(property.QueryIfStatementContentForNonEmpty(variableName)); + } + } + + return conditionParts.Count != 0 ? string.Join(" || ", conditionParts) : null; + } + + /// + /// Emits an optional condition wrapping block for an optional NonTerminal element. + /// When the referenced rule has resolvable properties, emits an inline condition. + /// Otherwise emits no condition (the call proceeds unconditionally). + /// + /// The used to write into output content + /// The optional + /// The resolved , or null for handcoded stubs + /// The on which properties are resolved (the class the referenced rule targets) + /// The current + /// The variable name to use in the condition (e.g., poco or poco.ownedMemberFeature) + /// true if a condition block was opened (caller must close it), false otherwise + private static bool TryEmitOptionalCondition(EncodedTextWriter writer, NonTerminalElement nonTerminalElement, TextualNotationRule referencedRule, IClass targetClass, RuleGenerationContext ruleGenerationContext, string variableName) + { + if (!nonTerminalElement.IsOptional || nonTerminalElement.IsCollection) + { + return false; + } + + if (referencedRule == null) + { + return false; + } + + var condition = GenerateInlineOptionalCondition(referencedRule, targetClass, ruleGenerationContext.AllRules, variableName); + + if (condition == null) + { + return false; + } + + writer.WriteSafeString($"{Environment.NewLine}if ({condition}){Environment.NewLine}"); + writer.WriteSafeString($"{{{Environment.NewLine}"); + return true; + } + + /// + /// Keeps tracks of defined cursor for enumerable + /// + private class CursorDefinition + { + /// + /// Gets or sets the that have to have a cursor defined + /// + public IProperty DefinedForProperty { get; init; } + + /// + /// Gets the name of the variable defined for the cursor + /// + public string CursorVariableName => $"{this.DefinedForProperty.Name.LowerCaseFirstLetter()}Cursor"; + + /// + /// Provides a collection of that will use the defined cursor + /// + public HashSet ApplicableRuleElements { get; } = []; + + /// + /// Asserts that the current is valid for an + /// + /// The specific + /// True if the is valid for the provided property + public bool IsCursorValidForProperty(IProperty property) + { + return property == this.DefinedForProperty; + } + } + + /// + /// Provides context over the rule generation history + /// + private class RuleGenerationContext + { + /// + /// Gets or sets the collection of + /// + public List DefinedCursors { get; set; } + + /// + /// Gets the collection of all available + /// + public List AllRules { get; } = []; + + /// + /// Gets or sets the that called other rule + /// + public RuleElement CallerRule { get; set; } + + /// Initializes a new instance of the class. + public RuleGenerationContext(INamedElement namedElementToGenerate) + { + this.NamedElementToGenerate = namedElementToGenerate; + } + + /// + /// Gets the that is used in the current generation + /// + public INamedElement NamedElementToGenerate { get; } + + /// + /// Gets or sets the current name of the variable to process + /// + public string CurrentVariableName { get; set; } + + /// + /// Gets or sets the sibling elements of the current processing context, + /// used to determine whether a trailing space should be suppressed. + /// + public IReadOnlyList CurrentSiblingElements { get; set; } + + /// + /// Gets or sets the index of the element currently being processed + /// within . + /// + public int CurrentElementIndex { get; set; } + + /// + /// Determines whether the next sibling element is a terminal that uses AppendLine + /// (e.g., {, }, ;), in which case a trailing space would be unnecessary. + /// + /// true if the next sibling is a newline terminal; false otherwise + public bool IsNextElementNewLineTerminal() + { + if (this.CurrentSiblingElements == null) + { + return false; + } + + var nextIndex = this.CurrentElementIndex + 1; + + if (nextIndex >= this.CurrentSiblingElements.Count) + { + return false; + } + + return this.CurrentSiblingElements[nextIndex] is TerminalElement { Value: "{" or "}" or ";" }; + } + + /// + /// Determines whether the current element is the last in the sibling list, + /// meaning no more content follows and a trailing space would be unnecessary. + /// + /// true if this is the last element; false otherwise + public bool IsLastElement() + { + if (this.CurrentSiblingElements == null) + { + return false; + } + + return this.CurrentElementIndex + 1 >= this.CurrentSiblingElements.Count; + } + } + } +} diff --git a/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj b/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj index 3389fd24..d223f7e0 100644 --- a/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj +++ b/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj @@ -19,8 +19,9 @@ en-US - - + + + @@ -222,6 +223,12 @@ Always + + Always + + + Always + @@ -240,4 +247,17 @@ Always + + + datamodel\kebnf.g4 + + + datamodel\KerML-textual-bnf.kebnf + Always + + + datamodel\SysML-textual-bnf.kebnf + Always + + \ No newline at end of file diff --git a/SysML2.NET.CodeGenerator/Templates/Uml/core-textual-notation-builder-facade-template.hbs b/SysML2.NET.CodeGenerator/Templates/Uml/core-textual-notation-builder-facade-template.hbs new file mode 100644 index 00000000..e41972e0 --- /dev/null +++ b/SysML2.NET.CodeGenerator/Templates/Uml/core-textual-notation-builder-facade-template.hbs @@ -0,0 +1,60 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides access to built textual notation for via + /// + public class TextualNotationBuilderFacade: ITextualNotationBuilderFacade + { + /// + /// Queries the Textual Notation of an + /// + /// The to built textual notation from + /// The built textual notation string + public string QueryTextualNotationOfElement(IElement element) + { + switch (element) + { + {{#each this as | class |}} + case SysML2.NET.Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace this }}.{{ this.Name }} poco{{ this.Name }}: + var {{String.LowerCaseFirstLetter this.Name }}TextualNotationBuilder = new {{ this.Name }}TextualNotationBuilder(this); + return {{String.LowerCaseFirstLetter this.Name }}TextualNotationBuilder.BuildTextualNotation(poco{{ this.Name }}); + + {{/each}} + default: + throw new ArgumentOutOfRangeException(nameof(element), "Provided element is not supported"); + } + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET.CodeGenerator/Templates/Uml/core-textual-notation-builder-template.hbs b/SysML2.NET.CodeGenerator/Templates/Uml/core-textual-notation-builder-template.hbs new file mode 100644 index 00000000..6c4504ed --- /dev/null +++ b/SysML2.NET.CodeGenerator/Templates/Uml/core-textual-notation-builder-template.hbs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class {{this.Context.Name}}TextualNotationBuilder + { + {{#each this.Rules as | rule | }} + /// + /// Builds the Textual Notation string for the rule {{Rule.RuleName}} + /// {{Rule.RawRule}} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void Build{{rule.RuleName}}({{ #NamedElement.WriteFullyQualifiedTypeName ../this.Context }} poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + {{RulesHelper.WriteRule rule ../this.Context ../this.AllRules}} + } + {{#unless @last}} + + {{/unless}} + {{/each}} + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET.Tests/Extend/PackageExtensionsTestFixture.cs b/SysML2.NET.Tests/Extend/PackageExtensionsTestFixture.cs index e9f5c68f..9886cf4c 100644 --- a/SysML2.NET.Tests/Extend/PackageExtensionsTestFixture.cs +++ b/SysML2.NET.Tests/Extend/PackageExtensionsTestFixture.cs @@ -23,16 +23,76 @@ namespace SysML2.NET.Tests.Extend using System; using NUnit.Framework; - + + using SysML2.NET.Core.POCO.Kernel.Associations; + using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Kernel.Packages; + using SysML2.NET.Core.POCO.Root.Annotations; + using SysML2.NET.Core.POCO.Root.Namespaces; + using SysML2.NET.Extensions; + + using Type = SysML2.NET.Core.POCO.Core.Types.Type; [TestFixture] public class PackageExtensionsTestFixture { [Test] - public void ComputeFilterCondition_ThrowsNotSupportedException() + public void VerifyComputeFilterCondition() + { + Assert.That(() => ((IPackage)null).ComputeFilterCondition(), Throws.TypeOf()); + + var package = new Package(); + + Assert.That(package.ComputeFilterCondition(), Is.Empty); + var membership = new ElementFilterMembership(); + var expression = new BooleanExpression(); + + var annotation = new Annotation(); + var comment = new Comment(); + + package.AssignOwnership(membership, expression); + package.AssignOwnership(annotation, comment); + + Assert.That(package.ComputeFilterCondition, Throws.InstanceOf()); + } + + [Test] + public void VerifyComputeRedefinedImportedMembershipsOperation() { - Assert.That(() => ((IPackage)null).ComputeFilterCondition(), Throws.TypeOf()); + Assert.That(() => ((IPackage)null).ComputeRedefinedImportedMembershipsOperation([]), Throws.TypeOf()); + + var package = new Package(); + + Assert.That(package.ComputeRedefinedImportedMembershipsOperation([]), Is.Empty); + + var importMember = new MembershipImport(); + var type = new Type(); + + package.AssignOwnership(importMember, type); + Assert.That(()=> package.ComputeRedefinedImportedMembershipsOperation([]), Throws.InstanceOf()); + + var membership = new ElementFilterMembership(); + var expression = new BooleanExpression(); + package.AssignOwnership(membership, expression); + Assert.That(()=> package.ComputeRedefinedImportedMembershipsOperation([]), Throws.InstanceOf()); + } + + [Test] + public void VerifyComputeIncludeAsMemberOperation() + { + Assert.That(() => ((IPackage)null).ComputeIncludeAsMemberOperation(null), Throws.TypeOf()); + + var package = new Package(); + Assert.That(package.ComputeIncludeAsMemberOperation(null), Is.False); + + var element = new Type(); + Assert.That(package.ComputeIncludeAsMemberOperation(element), Is.True); + var membership = new ElementFilterMembership(); + var expression = new BooleanExpression(); + + package.AssignOwnership(membership, expression); + + Assert.That(() => package.ComputeIncludeAsMemberOperation(element), Throws.TypeOf()); } } } diff --git a/SysML2.NET/Extend/PackageExtensions.cs b/SysML2.NET/Extend/PackageExtensions.cs index 58a88ae7..94ad5fe4 100644 --- a/SysML2.NET/Extend/PackageExtensions.cs +++ b/SysML2.NET/Extend/PackageExtensions.cs @@ -22,6 +22,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Packages { using System; using System.Collections.Generic; + using System.Linq; using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Root.Annotations; @@ -37,16 +38,16 @@ internal static class PackageExtensions /// /// Computes the derived property. /// + /// OCL2: filterCondition = ownedMembership-> selectByKind(ElementFilterMembership).condition /// /// The subject /// /// /// the computed result /// - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal static List ComputeFilterCondition(this IPackage packageSubject) { - throw new NotSupportedException("Create a GitHub issue when this method is required"); + return packageSubject == null ? throw new ArgumentNullException(nameof(packageSubject)) : [..packageSubject.ownedMembership.OfType().Select(x => x.condition)]; } /// @@ -61,10 +62,23 @@ internal static List ComputeFilterCondition(this IPackage packageSu /// /// The expected collection of /// - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal static List ComputeRedefinedImportedMembershipsOperation(this IPackage packageSubject, List excluded) { - throw new NotSupportedException("Create a GitHub issue when this method is required"); + if (packageSubject == null) + { + throw new ArgumentNullException(nameof(packageSubject)); + } + + var importedMembership= packageSubject.ComputeImportedMembershipsOperation(excluded); + var filters = packageSubject.ComputeFilterCondition(); + + if (filters.Count == 0) + { + return importedMembership; + } + + var validImportedMembership = importedMembership.Where(membership => filters.All(x => x.CheckCondition(membership))).ToList(); + return validImportedMembership; } /// @@ -79,10 +93,20 @@ internal static List ComputeRedefinedImportedMembershipsOperation(t /// /// The expected /// - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal static bool ComputeIncludeAsMemberOperation(this IPackage packageSubject, IElement element) { - throw new NotSupportedException("Create a GitHub issue when this method is required"); + if (packageSubject == null) + { + throw new ArgumentNullException(nameof(packageSubject)); + } + + if (element == null) + { + return false; + } + + var filters = packageSubject.ComputeFilterCondition(); + return filters.Count == 0 || filters.All(x => x.CheckCondition(element)); } } } diff --git a/SysML2.NET/Extensions/EnumerableExtensions.cs b/SysML2.NET/Extensions/EnumerableExtensions.cs new file mode 100644 index 00000000..57bd6961 --- /dev/null +++ b/SysML2.NET/Extensions/EnumerableExtensions.cs @@ -0,0 +1,46 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.Extensions +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// Extension methods for the interface + /// + internal static class EnumerableExtensions + { + /// + /// Filters out all where the type matches one of the requested + /// + /// The collection to filters + /// A collection of that should be used for filtering + /// A collection of + internal static IEnumerable GetElementsOfType(this IEnumerable collection, params Type[] elementTypes) + { + return from object element in collection where elementTypes.Contains(element.GetType()) select element as IElement; + } + } +} diff --git a/SysML2.NET/TextualNotation/ActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..f1cff7c3 --- /dev/null +++ b/SysML2.NET/TextualNotation/ActionUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Actions; + + /// + /// Hand-coded part of the + /// + public static partial class ActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule StateActionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildStateActionUsageHandCoded(IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildStateActionUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/AllocationUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AllocationUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..0b0c695d --- /dev/null +++ b/SysML2.NET/TextualNotation/AllocationUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Allocations; + + /// + /// Hand-coded part of the + /// + public static partial class AllocationUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AllocationUsageDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildAllocationUsageDeclarationHandCoded(IAllocationUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildAllocationUsageDeclarationHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/AssertConstraintUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AssertConstraintUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..4ef2fc36 --- /dev/null +++ b/SysML2.NET/TextualNotation/AssertConstraintUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Constraints; + + /// + /// Hand-coded part of the + /// + public static partial class AssertConstraintUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AssertConstraintUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildAssertConstraintUsageHandCoded(IAssertConstraintUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildAssertConstraintUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AcceptActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AcceptActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..557fc1d5 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AcceptActionUsageTextualNotationBuilder.cs @@ -0,0 +1,168 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AcceptActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AcceptNode + /// AcceptNode:AcceptActionUsage=OccurrenceUsagePrefixAcceptNodeDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAcceptNode(SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + BuildAcceptNodeDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule AcceptNodeDeclaration + /// AcceptNodeDeclaration:AcceptActionUsage=ActionNodeUsageDeclaration?'accept'AcceptParameterPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAcceptNodeDeclaration(SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + ActionUsageTextualNotationBuilder.BuildActionNodeUsageDeclaration(poco, cursorCache, stringBuilder); + } + stringBuilder.Append("accept "); + BuildAcceptParameterPart(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule AcceptParameterPart + /// AcceptParameterPart:AcceptActionUsage=ownedRelationship+=PayloadParameterMember('via'ownedRelationship+=NodeParameterMember)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAcceptParameterPart(SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildPayloadParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("via "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildNodeParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + } + + + } + + /// + /// Builds the Textual Notation string for the rule StateAcceptActionUsage + /// StateAcceptActionUsage:AcceptActionUsage=AcceptNodeDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateAcceptActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildAcceptNodeDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule TriggerAction + /// TriggerAction:AcceptActionUsage=AcceptParameterPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTriggerAction(SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildAcceptParameterPart(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule TransitionAcceptActionUsage + /// TransitionAcceptActionUsage:AcceptActionUsage=AcceptNodeDeclaration('{'ActionBodyItem*'}')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionAcceptActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildAcceptNodeDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.importedMembership.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsVariation || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.isReference || poco.IsIndividual || poco.PortionKind.HasValue || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildActionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.AppendLine("}"); + } + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActionDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActionDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..6e107d0b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActionDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ActionDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ActionDefinition + /// ActionDefinition=OccurrenceDefinitionPrefix'action''def'DefinitionDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionDefinition(SysML2.NET.Core.POCO.Systems.Actions.IActionDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("action "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..4aaa6a75 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActionUsageTextualNotationBuilder.cs @@ -0,0 +1,291 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ActionUsageDeclaration + /// ActionUsageDeclaration:ActionUsage=UsageDeclarationValuePart? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionUsageDeclaration(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ActionNode + /// ActionNode:ActionUsage=ControlNode|SendNode|AcceptNode|AssignmentNode|TerminateNode|IfNode|WhileLoopNode|ForLoopNode + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionNode(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Actions.IWhileLoopActionUsage pocoWhileLoopActionUsage: + WhileLoopActionUsageTextualNotationBuilder.BuildWhileLoopNode(pocoWhileLoopActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IForLoopActionUsage pocoForLoopActionUsage: + ForLoopActionUsageTextualNotationBuilder.BuildForLoopNode(pocoForLoopActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IControlNode pocoControlNode: + ControlNodeTextualNotationBuilder.BuildControlNode(pocoControlNode, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.ISendActionUsage pocoSendActionUsage: + SendActionUsageTextualNotationBuilder.BuildSendNode(pocoSendActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage pocoAcceptActionUsage: + AcceptActionUsageTextualNotationBuilder.BuildAcceptNode(pocoAcceptActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IAssignmentActionUsage pocoAssignmentActionUsage: + AssignmentActionUsageTextualNotationBuilder.BuildAssignmentNode(pocoAssignmentActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.ITerminateActionUsage pocoTerminateActionUsage: + TerminateActionUsageTextualNotationBuilder.BuildTerminateNode(pocoTerminateActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IIfActionUsage pocoIfActionUsage: + IfActionUsageTextualNotationBuilder.BuildIfNode(pocoIfActionUsage, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule ActionNodeUsageDeclaration + /// ActionNodeUsageDeclaration:ActionUsage='action'UsageDeclaration? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionNodeUsageDeclaration(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("action "); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ActionNodePrefix + /// ActionNodePrefix:ActionUsage=OccurrenceUsagePrefixActionNodeUsageDeclaration? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionNodePrefix(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + BuildActionNodeUsageDeclaration(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule AssignmentNodeDeclaration + /// AssignmentNodeDeclaration:ActionUsage=(ActionNodeUsageDeclaration)?'assign'ownedRelationship+=AssignmentTargetMemberownedRelationship+=FeatureChainMember':='ownedRelationship+=NodeParameterMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssignmentNodeDeclaration(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + BuildActionNodeUsageDeclaration(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("assign "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildAssignmentTargetMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildFeatureChainMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(":= "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildNodeParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ActionBodyParameter + /// ActionBodyParameter:ActionUsage=('action'UsageDeclaration?)?'{'ActionBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionBodyParameter(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + stringBuilder.Append("action "); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + } + } + + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildActionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.AppendLine("}"); + + } + + /// + /// Builds the Textual Notation string for the rule StateActionUsage + /// StateActionUsage:ActionUsage=EmptyActionUsage';'|StatePerformActionUsage|StateAcceptActionUsage|StateSendActionUsage|StateAssignmentActionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildStateActionUsageHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule EmptyActionUsage + /// EmptyActionUsage:ActionUsage={} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + + /// + /// Builds the Textual Notation string for the rule EffectBehaviorUsage + /// EffectBehaviorUsage:ActionUsage=EmptyActionUsage|TransitionPerformActionUsage|TransitionAcceptActionUsage|TransitionSendActionUsage|TransitionAssignmentActionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEffectBehaviorUsage(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Actions.IPerformActionUsage pocoPerformActionUsage: + PerformActionUsageTextualNotationBuilder.BuildTransitionPerformActionUsage(pocoPerformActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage pocoAcceptActionUsage: + AcceptActionUsageTextualNotationBuilder.BuildTransitionAcceptActionUsage(pocoAcceptActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.ISendActionUsage pocoSendActionUsage: + SendActionUsageTextualNotationBuilder.BuildTransitionSendActionUsage(pocoSendActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IAssignmentActionUsage pocoAssignmentActionUsage: + AssignmentActionUsageTextualNotationBuilder.BuildTransitionAssignmentActionUsage(pocoAssignmentActionUsage, cursorCache, stringBuilder); + break; + default: + BuildEmptyActionUsage(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule ActionUsage + /// ActionUsage=OccurrenceUsagePrefix'action'ActionUsageDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("action "); + BuildActionUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActorMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActorMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..f1818e57 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ActorMembershipTextualNotationBuilder.cs @@ -0,0 +1,66 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ActorMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ActorMember + /// ActorMember:ActorMembership=MemberPrefixownedRelatedElement+=ActorUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActorMember(SysML2.NET.Core.POCO.Systems.Requirements.IActorMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Parts.IPartUsage elementAsPartUsage) + { + PartUsageTextualNotationBuilder.BuildActorUsage(elementAsPartUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AllocationDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AllocationDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..b01fce0c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AllocationDefinitionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AllocationDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AllocationDefinition + /// AllocationDefinition=OccurrenceDefinitionPrefix'allocation''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAllocationDefinition(SysML2.NET.Core.POCO.Systems.Allocations.IAllocationDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("allocation "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AllocationUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AllocationUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..730751e6 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AllocationUsageTextualNotationBuilder.cs @@ -0,0 +1,68 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AllocationUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AllocationUsageDeclaration + /// AllocationUsageDeclaration:AllocationUsage='allocation'UsageDeclaration('allocate'ConnectorPart)?|'allocate'ConnectorPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAllocationUsageDeclaration(SysML2.NET.Core.POCO.Systems.Allocations.IAllocationUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildAllocationUsageDeclarationHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule AllocationUsage + /// AllocationUsage=OccurrenceUsagePrefixAllocationUsageDeclarationUsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAllocationUsage(SysML2.NET.Core.POCO.Systems.Allocations.IAllocationUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + BuildAllocationUsageDeclaration(poco, cursorCache, stringBuilder); + UsageTextualNotationBuilder.BuildUsageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnalysisCaseDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnalysisCaseDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..ec6dd16c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnalysisCaseDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AnalysisCaseDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AnalysisCaseDefinition + /// AnalysisCaseDefinition=OccurrenceDefinitionPrefix'analysis''def'DefinitionDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAnalysisCaseDefinition(SysML2.NET.Core.POCO.Systems.AnalysisCases.IAnalysisCaseDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("analysis "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnalysisCaseUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnalysisCaseUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..3ac1df36 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnalysisCaseUsageTextualNotationBuilder.cs @@ -0,0 +1,63 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AnalysisCaseUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AnalysisCaseUsage + /// AnalysisCaseUsage=OccurrenceUsagePrefix'analysis'ConstraintUsageDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAnalysisCaseUsage(SysML2.NET.Core.POCO.Systems.AnalysisCases.IAnalysisCaseUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("analysis "); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnnotatingElementTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnnotatingElementTextualNotationBuilder.cs new file mode 100644 index 00000000..d29bccc5 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnnotatingElementTextualNotationBuilder.cs @@ -0,0 +1,68 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AnnotatingElementTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AnnotatingElement + /// AnnotatingElement=Comment|Documentation|TextualRepresentation|MetadataFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAnnotatingElement(SysML2.NET.Core.POCO.Root.Annotations.IAnnotatingElement poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Metadata.IMetadataFeature pocoMetadataFeature: + MetadataFeatureTextualNotationBuilder.BuildMetadataFeature(pocoMetadataFeature, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Annotations.IDocumentation pocoDocumentation: + DocumentationTextualNotationBuilder.BuildDocumentation(pocoDocumentation, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Annotations.IComment pocoComment: + CommentTextualNotationBuilder.BuildComment(pocoComment, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Annotations.ITextualRepresentation pocoTextualRepresentation: + TextualRepresentationTextualNotationBuilder.BuildTextualRepresentation(pocoTextualRepresentation, cursorCache, stringBuilder); + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnnotationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnnotationTextualNotationBuilder.cs new file mode 100644 index 00000000..d61c95cc --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AnnotationTextualNotationBuilder.cs @@ -0,0 +1,114 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AnnotationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedAnnotation + /// OwnedAnnotation:Annotation=ownedRelatedElement+=AnnotatingElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedAnnotation(SysML2.NET.Core.POCO.Root.Annotations.IAnnotation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotatingElement elementAsAnnotatingElement) + { + AnnotatingElementTextualNotationBuilder.BuildAnnotatingElement(elementAsAnnotatingElement, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PrefixMetadataAnnotation + /// PrefixMetadataAnnotation:Annotation='#'annotatingElement=PrefixMetadataUsage{ownedRelatedElement+=annotatingElement} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrefixMetadataAnnotation(SysML2.NET.Core.POCO.Root.Annotations.IAnnotation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("#"); + + if (poco.annotatingElement != null) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildOwnedFeatureTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + // NonParsing Assignment Element : ownedRelatedElement += annotatingElement => Does not have to be process + + } + + /// + /// Builds the Textual Notation string for the rule Annotation + /// Annotation=annotatedElement=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAnnotation(SysML2.NET.Core.POCO.Root.Annotations.IAnnotation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.AnnotatedElement != null) + { + stringBuilder.Append(poco.AnnotatedElement.qualifiedName); + stringBuilder.Append(' '); + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssertConstraintUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssertConstraintUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..dcb1dea9 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssertConstraintUsageTextualNotationBuilder.cs @@ -0,0 +1,66 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AssertConstraintUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AssertConstraintUsage + /// AssertConstraintUsage=OccurrenceUsagePrefix'assert'(isNegated?='not')?(ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?|'constraint'ConstraintUsageDeclaration)CalculationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssertConstraintUsage(SysML2.NET.Core.POCO.Systems.Constraints.IAssertConstraintUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("assert "); + + if (poco.IsNegated) + { + stringBuilder.Append(" not "); + stringBuilder.Append(' '); + } + + BuildAssertConstraintUsageHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + TypeTextualNotationBuilder.BuildCalculationBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssignmentActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssignmentActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..bb468c16 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssignmentActionUsageTextualNotationBuilder.cs @@ -0,0 +1,97 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AssignmentActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AssignmentNode + /// AssignmentNode:AssignmentActionUsage=OccurrenceUsagePrefixAssignmentNodeDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssignmentNode(SysML2.NET.Core.POCO.Systems.Actions.IAssignmentActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + ActionUsageTextualNotationBuilder.BuildAssignmentNodeDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule StateAssignmentActionUsage + /// StateAssignmentActionUsage:AssignmentActionUsage=AssignmentNodeDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateAssignmentActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IAssignmentActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + ActionUsageTextualNotationBuilder.BuildAssignmentNodeDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule TransitionAssignmentActionUsage + /// TransitionAssignmentActionUsage:AssignmentActionUsage=AssignmentNodeDeclaration('{'ActionBodyItem*'}')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionAssignmentActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IAssignmentActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + ActionUsageTextualNotationBuilder.BuildAssignmentNodeDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.importedMembership.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsVariation || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.isReference || poco.IsIndividual || poco.PortionKind.HasValue || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildActionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.AppendLine("}"); + } + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssociationStructureTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssociationStructureTextualNotationBuilder.cs new file mode 100644 index 00000000..d325de65 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssociationStructureTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AssociationStructureTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AssociationStructure + /// AssociationStructure=TypePrefix'assoc''struct'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssociationStructure(SysML2.NET.Core.POCO.Kernel.Associations.IAssociationStructure poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("assoc "); + stringBuilder.Append("struct "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssociationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssociationTextualNotationBuilder.cs new file mode 100644 index 00000000..94eddcf7 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AssociationTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AssociationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Association + /// Association=TypePrefix'assoc'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssociation(SysML2.NET.Core.POCO.Kernel.Associations.IAssociation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("assoc "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AttributeDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AttributeDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..fd645a85 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AttributeDefinitionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AttributeDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AttributeDefinition + /// AttributeDefinition:AttributeDefinition=DefinitionPrefix'attribute''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAttributeDefinition(SysML2.NET.Core.POCO.Systems.Attributes.IAttributeDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + DefinitionTextualNotationBuilder.BuildDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("attribute "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AttributeUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AttributeUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..903a2b11 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/AttributeUsageTextualNotationBuilder.cs @@ -0,0 +1,56 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class AttributeUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AttributeUsage + /// AttributeUsage:AttributeUsage=UsagePrefix'attribute'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAttributeUsage(SysML2.NET.Core.POCO.Systems.Attributes.IAttributeUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("attribute "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BehaviorTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BehaviorTextualNotationBuilder.cs new file mode 100644 index 00000000..f591dcf6 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BehaviorTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class BehaviorTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Behavior + /// Behavior=TypePrefix'behavior'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBehavior(SysML2.NET.Core.POCO.Kernel.Behaviors.IBehavior poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("behavior "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BindingConnectorAsUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BindingConnectorAsUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..d6dfed39 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BindingConnectorAsUsageTextualNotationBuilder.cs @@ -0,0 +1,88 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class BindingConnectorAsUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule BindingConnectorAsUsage + /// BindingConnectorAsUsage=UsagePrefix('binding'UsageDeclaration)?'bind'ownedRelationship+=ConnectorEndMember'='ownedRelationship+=ConnectorEndMemberUsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBindingConnectorAsUsage(SysML2.NET.Core.POCO.Systems.Connections.IBindingConnectorAsUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + UsageTextualNotationBuilder.BuildUsagePrefix(poco, cursorCache, stringBuilder); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.OwnedRelatedElement.Count != 0 || poco.IsOrdered) + { + stringBuilder.Append("binding "); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("bind "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("="); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + UsageTextualNotationBuilder.BuildUsageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BindingConnectorTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BindingConnectorTextualNotationBuilder.cs new file mode 100644 index 00000000..ab8c85c3 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BindingConnectorTextualNotationBuilder.cs @@ -0,0 +1,87 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class BindingConnectorTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule BindingConnectorDeclaration + /// BindingConnectorDeclaration:BindingConnector=FeatureDeclaration('of'ownedRelationship+=ConnectorEndMember'='ownedRelationship+=ConnectorEndMember)?|(isSufficient?='all')?('of'?ownedRelationship+=ConnectorEndMember'='ownedRelationship+=ConnectorEndMember)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBindingConnectorDeclaration(SysML2.NET.Core.POCO.Kernel.Connectors.IBindingConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildBindingConnectorDeclarationHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule BindingConnector + /// BindingConnector=FeaturePrefix'binding'BindingConnectorDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBindingConnector(SysML2.NET.Core.POCO.Kernel.Connectors.IBindingConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("binding "); + BuildBindingConnectorDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BooleanExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BooleanExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..d6f4de7b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/BooleanExpressionTextualNotationBuilder.cs @@ -0,0 +1,80 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class BooleanExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule BooleanExpression + /// BooleanExpression=FeaturePrefix'bool'FeatureDeclarationValuePart?FunctionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBooleanExpression(SysML2.NET.Core.POCO.Kernel.Functions.IBooleanExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("bool "); + FeatureTextualNotationBuilder.BuildFeatureDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildFunctionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CalculationDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CalculationDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..9ae93a4e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CalculationDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class CalculationDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule CalculationDefinition + /// CalculationDefinition=OccurrenceDefinitionPrefix'calc''def'DefinitionDeclarationCalculationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCalculationDefinition(SysML2.NET.Core.POCO.Systems.Calculations.ICalculationDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("calc "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCalculationBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CalculationUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CalculationUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..c2e48cfc --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CalculationUsageTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class CalculationUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule CalculationUsage + /// CalculationUsage:CalculationUsage=OccurrenceUsagePrefix'calc'ActionUsageDeclarationCalculationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCalculationUsage(SysML2.NET.Core.POCO.Systems.Calculations.ICalculationUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("calc "); + ActionUsageTextualNotationBuilder.BuildActionUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCalculationBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CaseDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CaseDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..46a623db --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CaseDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class CaseDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule CaseDefinition + /// CaseDefinition=OccurrenceDefinitionPrefix'case''def'DefinitionDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCaseDefinition(SysML2.NET.Core.POCO.Systems.Cases.ICaseDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("case "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CaseUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CaseUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..c9c8b22b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CaseUsageTextualNotationBuilder.cs @@ -0,0 +1,63 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class CaseUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule CaseUsage + /// CaseUsage=OccurrenceUsagePrefix'case'ConstraintUsageDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCaseUsage(SysML2.NET.Core.POCO.Systems.Cases.ICaseUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("case "); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ClassTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ClassTextualNotationBuilder.cs new file mode 100644 index 00000000..b9d7d4ad --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ClassTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ClassTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Class + /// Class=TypePrefix'class'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildClass(SysML2.NET.Core.POCO.Kernel.Classes.IClass poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("class "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ClassifierTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ClassifierTextualNotationBuilder.cs new file mode 100644 index 00000000..781549e7 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ClassifierTextualNotationBuilder.cs @@ -0,0 +1,191 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ClassifierTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SubclassificationPart + /// SubclassificationPart:Classifier=SPECIALIZESownedRelationship+=OwnedSubclassification(','ownedRelationship+=OwnedSubclassification)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSubclassificationPart(SysML2.NET.Core.POCO.Core.Classifiers.IClassifier poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" :> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification elementAsSubclassification) + { + SubclassificationTextualNotationBuilder.BuildOwnedSubclassification(elementAsSubclassification, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification elementAsSubclassification) + { + SubclassificationTextualNotationBuilder.BuildOwnedSubclassification(elementAsSubclassification, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule ClassifierDeclaration + /// ClassifierDeclaration:Classifier=(isSufficient?='all')?Identification(ownedRelationship+=OwnedMultiplicity)?(SuperclassingPart|ConjugationPart)?TypeRelationshipPart* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildClassifierDeclaration(SysML2.NET.Core.POCO.Core.Classifiers.IClassifier poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (poco.IsSufficient) + { + stringBuilder.Append(" all "); + stringBuilder.Append(' '); + } + + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildOwnedMultiplicity(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Types.IType pocoType: + TypeTextualNotationBuilder.BuildConjugationPart(pocoType, cursorCache, stringBuilder); + break; + default: + BuildSuperclassingPart(poco, cursorCache, stringBuilder); + break; + } + + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildTypeRelationshipPart(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule SuperclassingPart + /// SuperclassingPart:Classifier=SPECIALIZESownedRelationship+=OwnedSubclassification(','ownedRelationship+=OwnedSubclassification)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSuperclassingPart(SysML2.NET.Core.POCO.Core.Classifiers.IClassifier poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" :> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification elementAsSubclassification) + { + SubclassificationTextualNotationBuilder.BuildOwnedSubclassification(elementAsSubclassification, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification elementAsSubclassification) + { + SubclassificationTextualNotationBuilder.BuildOwnedSubclassification(elementAsSubclassification, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule Classifier + /// Classifier=TypePrefix'classifier'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildClassifier(SysML2.NET.Core.POCO.Core.Classifiers.IClassifier poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("classifier "); + BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CollectExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CollectExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..e6a9aacf --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CollectExpressionTextualNotationBuilder.cs @@ -0,0 +1,77 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class CollectExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule CollectExpression + /// CollectExpression=ownedRelationship+=PrimaryArgumentMember'.'ownedRelationship+=BodyArgumentMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCollectExpression(SysML2.NET.Core.POCO.Kernel.Expressions.ICollectExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildPrimaryArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("."); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildBodyArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CommentTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CommentTextualNotationBuilder.cs new file mode 100644 index 00000000..781ecc00 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CommentTextualNotationBuilder.cs @@ -0,0 +1,102 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class CommentTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Comment + /// Comment=('comment'Identification('about'ownedRelationship+=Annotation(','ownedRelationship+=Annotation)*)?)?('locale'locale=STRING_VALUE)?body=REGULAR_COMMENT + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildComment(SysML2.NET.Core.POCO.Root.Annotations.IComment poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("comment "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("about "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + } + + stringBuilder.Append(' '); + } + + + if (!string.IsNullOrWhiteSpace(poco.Locale)) + { + stringBuilder.Append("locale "); + stringBuilder.Append(poco.Locale); + stringBuilder.Append(' '); + } + + stringBuilder.Append(poco.Body); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConcernDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConcernDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..4fe21009 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConcernDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConcernDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConcernDefinition + /// ConcernDefinition=OccurrenceDefinitionPrefix'concern''def'DefinitionDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConcernDefinition(SysML2.NET.Core.POCO.Systems.Requirements.IConcernDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("concern "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConcernUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConcernUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..13a98961 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConcernUsageTextualNotationBuilder.cs @@ -0,0 +1,69 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConcernUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FramedConcernUsage + /// FramedConcernUsage:ConcernUsage=ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?CalculationBody|(UsageExtensionKeyword*'concern'|UsageExtensionKeyword+)CalculationUsageDeclarationCalculationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFramedConcernUsage(SysML2.NET.Core.POCO.Systems.Requirements.IConcernUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildFramedConcernUsageHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule ConcernUsage + /// ConcernUsage=OccurrenceUsagePrefix'concern'ConstraintUsageDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConcernUsage(SysML2.NET.Core.POCO.Systems.Requirements.IConcernUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("concern "); + ConstraintUsageTextualNotationBuilder.BuildConstraintUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugatedPortDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugatedPortDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..371c458f --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugatedPortDefinitionTextualNotationBuilder.cs @@ -0,0 +1,65 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConjugatedPortDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConjugatedPortDefinition + /// ConjugatedPortDefinition=ownedRelationship+=PortConjugation + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConjugatedPortDefinition(SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Ports.IPortConjugation elementAsPortConjugation) + { + PortConjugationTextualNotationBuilder.BuildPortConjugation(elementAsPortConjugation, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugatedPortTypingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugatedPortTypingTextualNotationBuilder.cs new file mode 100644 index 00000000..550c255a --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugatedPortTypingTextualNotationBuilder.cs @@ -0,0 +1,55 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConjugatedPortTypingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConjugatedPortTyping + /// ConjugatedPortTyping:ConjugatedPortTyping='~'originalPortDefinition=~[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConjugatedPortTyping(SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortTyping poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("~"); + BuildOriginalPortDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugationTextualNotationBuilder.cs new file mode 100644 index 00000000..57245c25 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConjugationTextualNotationBuilder.cs @@ -0,0 +1,107 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConjugationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedConjugation + /// OwnedConjugation:Conjugation=originalType=[QualifiedName]|originalType=FeatureChain{ownedRelatedElement+=originalType} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedConjugation(SysML2.NET.Core.POCO.Core.Types.IConjugation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.OriginalType) && poco.OriginalType is SysML2.NET.Core.POCO.Core.Features.IFeature chainedOriginalTypeAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureChain(chainedOriginalTypeAsFeature, cursorCache, stringBuilder); + } + else if (poco.OriginalType != null) + { + stringBuilder.Append(poco.OriginalType.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule Conjugation + /// Conjugation=('conjugation'Identification)?'conjugate'(conjugatedType=[QualifiedName]|conjugatedType=FeatureChain{ownedRelatedElement+=conjugatedType})CONJUGATES(originalType=[QualifiedName]|originalType=FeatureChain{ownedRelatedElement+=originalType})RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConjugation(SysML2.NET.Core.POCO.Core.Types.IConjugation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("conjugation "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("conjugate "); + if (poco.OwnedRelatedElement.Contains(poco.ConjugatedType) && poco.ConjugatedType is SysML2.NET.Core.POCO.Core.Features.IFeature chainedConjugatedTypeAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureChain(chainedConjugatedTypeAsFeature, cursorCache, stringBuilder); + } + else if (poco.ConjugatedType != null) + { + stringBuilder.Append(poco.ConjugatedType.qualifiedName); + stringBuilder.Append(' '); + } + + stringBuilder.Append(' '); + stringBuilder.Append(" ~"); + if (poco.OwnedRelatedElement.Contains(poco.OriginalType) && poco.OriginalType is SysML2.NET.Core.POCO.Core.Features.IFeature chainedOriginalTypeAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureChain(chainedOriginalTypeAsFeature, cursorCache, stringBuilder); + } + else if (poco.OriginalType != null) + { + stringBuilder.Append(poco.OriginalType.qualifiedName); + stringBuilder.Append(' '); + } + + stringBuilder.Append(' '); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectionDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectionDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..973f5640 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectionDefinitionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConnectionDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConnectionDefinition + /// ConnectionDefinition=OccurrenceDefinitionPrefix'connection''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConnectionDefinition(SysML2.NET.Core.POCO.Systems.Connections.IConnectionDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("connection "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..ea345ae7 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectionUsageTextualNotationBuilder.cs @@ -0,0 +1,168 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConnectionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConnectorPart + /// ConnectorPart:ConnectionUsage=BinaryConnectorPart|NaryConnectorPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConnectorPart(SysML2.NET.Core.POCO.Systems.Connections.IConnectionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Connections.IConnectionUsage pocoConnectionUsageBinaryConnectorPart when pocoConnectionUsageBinaryConnectorPart.IsValidForBinaryConnectorPart(): + BuildBinaryConnectorPart(pocoConnectionUsageBinaryConnectorPart, cursorCache, stringBuilder); + break; + default: + BuildNaryConnectorPart(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule BinaryConnectorPart + /// BinaryConnectorPart:ConnectionUsage=ownedRelationship+=ConnectorEndMember'to'ownedRelationship+=ConnectorEndMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBinaryConnectorPart(SysML2.NET.Core.POCO.Systems.Connections.IConnectionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("to "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule NaryConnectorPart + /// NaryConnectorPart:ConnectionUsage='('ownedRelationship+=ConnectorEndMember','ownedRelationship+=ConnectorEndMember(','ownedRelationship+=ConnectorEndMember)*')' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNaryConnectorPart(SysML2.NET.Core.POCO.Systems.Connections.IConnectionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("("); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(")"); + + } + + /// + /// Builds the Textual Notation string for the rule ConnectionUsage + /// ConnectionUsage=OccurrenceUsagePrefix('connection'UsageDeclarationValuePart?('connect'ConnectorPart)?|'connect'ConnectorPart)UsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConnectionUsage(SysML2.NET.Core.POCO.Systems.Connections.IConnectionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + BuildConnectionUsageHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + UsageTextualNotationBuilder.BuildUsageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectorTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectorTextualNotationBuilder.cs new file mode 100644 index 00000000..b70b4b69 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConnectorTextualNotationBuilder.cs @@ -0,0 +1,193 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConnectorTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConnectorDeclaration + /// ConnectorDeclaration:Connector=BinaryConnectorDeclaration|NaryConnectorDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConnectorDeclaration(SysML2.NET.Core.POCO.Kernel.Connectors.IConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Connectors.IConnector pocoConnectorBinaryConnectorDeclaration when pocoConnectorBinaryConnectorDeclaration.IsValidForBinaryConnectorDeclaration(): + BuildBinaryConnectorDeclaration(pocoConnectorBinaryConnectorDeclaration, cursorCache, stringBuilder); + break; + default: + BuildNaryConnectorDeclaration(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule BinaryConnectorDeclaration + /// BinaryConnectorDeclaration:Connector=(FeatureDeclaration?'from'|isSufficient?='all''from'?)?ownedRelationship+=ConnectorEndMember'to'ownedRelationship+=ConnectorEndMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBinaryConnectorDeclaration(SysML2.NET.Core.POCO.Kernel.Connectors.IConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildBinaryConnectorDeclarationHandCoded(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("to "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule NaryConnectorDeclaration + /// NaryConnectorDeclaration:Connector=FeatureDeclaration?'('ownedRelationship+=ConnectorEndMember','ownedRelationship+=ConnectorEndMember(','ownedRelationship+=ConnectorEndMember)*')' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNaryConnectorDeclaration(SysML2.NET.Core.POCO.Kernel.Connectors.IConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (poco.IsSufficient || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildFeatureDeclaration(poco, cursorCache, stringBuilder); + } + stringBuilder.Append("("); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(")"); + + } + + /// + /// Builds the Textual Notation string for the rule Connector + /// Connector=FeaturePrefix'connector'(FeatureDeclaration?ValuePart?|ConnectorDeclaration)TypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConnector(SysML2.NET.Core.POCO.Kernel.Connectors.IConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("connector "); + BuildConnectorHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstraintDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstraintDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..e8c45c3d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstraintDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConstraintDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConstraintDefinition + /// ConstraintDefinition=OccurrenceDefinitionPrefix'constraint''def'DefinitionDeclarationCalculationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConstraintDefinition(SysML2.NET.Core.POCO.Systems.Constraints.IConstraintDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("constraint "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCalculationBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstraintUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstraintUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..1ebfae1e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstraintUsageTextualNotationBuilder.cs @@ -0,0 +1,87 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConstraintUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConstraintUsageDeclaration + /// ConstraintUsageDeclaration:ConstraintUsage=UsageDeclarationValuePart? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConstraintUsageDeclaration(SysML2.NET.Core.POCO.Systems.Constraints.IConstraintUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule RequirementConstraintUsage + /// RequirementConstraintUsage:ConstraintUsage=ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?RequirementBody|(UsageExtensionKeyword*'constraint'|UsageExtensionKeyword+)ConstraintUsageDeclarationCalculationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementConstraintUsage(SysML2.NET.Core.POCO.Systems.Constraints.IConstraintUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildRequirementConstraintUsageHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule ConstraintUsage + /// ConstraintUsage=OccurrenceUsagePrefix'constraint'ConstraintUsageDeclarationCalculationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConstraintUsage(SysML2.NET.Core.POCO.Systems.Constraints.IConstraintUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("constraint "); + BuildConstraintUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCalculationBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstructorExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstructorExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..5d17dced --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ConstructorExpressionTextualNotationBuilder.cs @@ -0,0 +1,77 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ConstructorExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConstructorExpression + /// ConstructorExpression='new'ownedRelationship+=InstantiatedTypeMemberownedRelationship+=ConstructorResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConstructorExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IConstructorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("new "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildInstantiatedTypeMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildConstructorResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ControlNodeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ControlNodeTextualNotationBuilder.cs new file mode 100644 index 00000000..37ca2d23 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ControlNodeTextualNotationBuilder.cs @@ -0,0 +1,68 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ControlNodeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ControlNode + /// ControlNode=MergeNode|DecisionNode|JoinNode|ForkNode + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildControlNode(SysML2.NET.Core.POCO.Systems.Actions.IControlNode poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Actions.IMergeNode pocoMergeNode: + MergeNodeTextualNotationBuilder.BuildMergeNode(pocoMergeNode, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IDecisionNode pocoDecisionNode: + DecisionNodeTextualNotationBuilder.BuildDecisionNode(pocoDecisionNode, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IJoinNode pocoJoinNode: + JoinNodeTextualNotationBuilder.BuildJoinNode(pocoJoinNode, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IForkNode pocoForkNode: + ForkNodeTextualNotationBuilder.BuildForkNode(pocoForkNode, cursorCache, stringBuilder); + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CrossSubsettingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CrossSubsettingTextualNotationBuilder.cs new file mode 100644 index 00000000..c84fc953 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/CrossSubsettingTextualNotationBuilder.cs @@ -0,0 +1,62 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class CrossSubsettingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedCrossSubsetting + /// OwnedCrossSubsetting:CrossSubsetting=crossedFeature=[QualifiedName]|crossedFeature=OwnedFeatureChain{ownedRelatedElement+=crossedFeature} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedCrossSubsetting(SysML2.NET.Core.POCO.Core.Features.ICrossSubsetting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.CrossedFeature) && poco.CrossedFeature is SysML2.NET.Core.POCO.Core.Features.IFeature chainedCrossedFeatureAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedCrossedFeatureAsFeature, cursorCache, stringBuilder); + } + else if (poco.CrossedFeature != null) + { + stringBuilder.Append(poco.CrossedFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DataTypeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DataTypeTextualNotationBuilder.cs new file mode 100644 index 00000000..c3219f05 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DataTypeTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class DataTypeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule DataType + /// DataType=TypePrefix'datatype'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDataType(SysML2.NET.Core.POCO.Kernel.DataTypes.IDataType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("datatype "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DecisionNodeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DecisionNodeTextualNotationBuilder.cs new file mode 100644 index 00000000..e1c19e4b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DecisionNodeTextualNotationBuilder.cs @@ -0,0 +1,60 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class DecisionNodeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule DecisionNode + /// DecisionNode=ControlNodePrefixisComposite?='decide'UsageDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDecisionNode(SysML2.NET.Core.POCO.Systems.Actions.IDecisionNode poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildControlNodePrefix(poco, cursorCache, stringBuilder); + if (poco.IsComposite) + { + stringBuilder.Append(" decide "); + } + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..48b0a32c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DefinitionTextualNotationBuilder.cs @@ -0,0 +1,155 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class DefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule DefinitionExtensionKeyword + /// DefinitionExtensionKeyword:Definition=ownedRelationship+=PrefixMetadataMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinitionExtensionKeyword(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule DefinitionPrefix + /// DefinitionPrefix:Definition=BasicDefinitionPrefix?DefinitionExtensionKeyword* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinitionPrefix(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + } + else if (poco.IsVariation) + { + stringBuilder.Append(" variation "); + } + + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildDefinitionExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule DefinitionDeclaration + /// DefinitionDeclaration:Definition=IdentificationSubclassificationPart? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinitionDeclaration(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0) + { + ClassifierTextualNotationBuilder.BuildSubclassificationPart(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ExtendedDefinition + /// ExtendedDefinition:Definition=BasicDefinitionPrefix?DefinitionExtensionKeyword+'def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExtendedDefinition(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + } + else if (poco.IsVariation) + { + stringBuilder.Append(" variation "); + } + + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + BuildDefinitionExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.Append("def "); + BuildDefinition(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule Definition + /// Definition=DefinitionDeclarationDefinitionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinition(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildDefinitionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DependencyTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DependencyTextualNotationBuilder.cs new file mode 100644 index 00000000..a3a40873 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DependencyTextualNotationBuilder.cs @@ -0,0 +1,121 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class DependencyTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Dependency + /// Dependency=(ownedRelationship+=PrefixMetadataAnnotation)*'dependency'DependencyDeclarationRelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDependency(SysML2.NET.Core.POCO.Root.Dependencies.IDependency poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildPrefixMetadataAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append("dependency "); + var clientCursor = cursorCache.GetOrCreateCursor(poco.Id, "client", poco.Client); + var supplierCursor = cursorCache.GetOrCreateCursor(poco.Id, "supplier", poco.Supplier); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append("from "); + stringBuilder.Append(' '); + } + + + if (clientCursor.Current != null) + { + stringBuilder.Append(clientCursor.Current.qualifiedName); + clientCursor.Move(); + } + + while (clientCursor.Current != null) + { + stringBuilder.Append(", "); + + if (clientCursor.Current != null) + { + stringBuilder.Append(clientCursor.Current.qualifiedName); + clientCursor.Move(); + } + clientCursor.Move(); + + } + stringBuilder.Append("to "); + + if (supplierCursor.Current != null) + { + stringBuilder.Append(supplierCursor.Current.qualifiedName); + supplierCursor.Move(); + } + + while (supplierCursor.Current != null) + { + stringBuilder.Append(", "); + + if (supplierCursor.Current != null) + { + stringBuilder.Append(supplierCursor.Current.qualifiedName); + supplierCursor.Move(); + } + supplierCursor.Move(); + + } + + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DifferencingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DifferencingTextualNotationBuilder.cs new file mode 100644 index 00000000..4288f521 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DifferencingTextualNotationBuilder.cs @@ -0,0 +1,71 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class DifferencingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Differencing + /// Differencing=differencingType=[QualifiedName]|ownedRelatedElement+=OwnedFeatureChain + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDifferencing(SysML2.NET.Core.POCO.Core.Types.IDifferencing poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + if (poco.DifferencingType != null) + { + stringBuilder.Append(poco.DifferencingType.qualifiedName); + stringBuilder.Append(' '); + } + else + { + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(elementAsFeature, cursorCache, stringBuilder); + } + } + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DisjoiningTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DisjoiningTextualNotationBuilder.cs new file mode 100644 index 00000000..c9b07d9b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DisjoiningTextualNotationBuilder.cs @@ -0,0 +1,107 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class DisjoiningTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedDisjoining + /// OwnedDisjoining:Disjoining=disjoiningType=[QualifiedName]|disjoiningType=FeatureChain{ownedRelatedElement+=disjoiningType} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedDisjoining(SysML2.NET.Core.POCO.Core.Types.IDisjoining poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.DisjoiningType) && poco.DisjoiningType is SysML2.NET.Core.POCO.Core.Features.IFeature chainedDisjoiningTypeAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureChain(chainedDisjoiningTypeAsFeature, cursorCache, stringBuilder); + } + else if (poco.DisjoiningType != null) + { + stringBuilder.Append(poco.DisjoiningType.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule Disjoining + /// Disjoining=('disjoining'Identification)?'disjoint'(typeDisjoined=[QualifiedName]|typeDisjoined=FeatureChain{ownedRelatedElement+=typeDisjoined})'from'(disjoiningType=[QualifiedName]|disjoiningType=FeatureChain{ownedRelatedElement+=disjoiningType})RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDisjoining(SysML2.NET.Core.POCO.Core.Types.IDisjoining poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("disjoining "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("disjoint "); + if (poco.OwnedRelatedElement.Contains(poco.TypeDisjoined) && poco.TypeDisjoined is SysML2.NET.Core.POCO.Core.Features.IFeature chainedTypeDisjoinedAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureChain(chainedTypeDisjoinedAsFeature, cursorCache, stringBuilder); + } + else if (poco.TypeDisjoined != null) + { + stringBuilder.Append(poco.TypeDisjoined.qualifiedName); + stringBuilder.Append(' '); + } + + stringBuilder.Append(' '); + stringBuilder.Append("from "); + if (poco.OwnedRelatedElement.Contains(poco.DisjoiningType) && poco.DisjoiningType is SysML2.NET.Core.POCO.Core.Features.IFeature chainedDisjoiningTypeAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureChain(chainedDisjoiningTypeAsFeature, cursorCache, stringBuilder); + } + else if (poco.DisjoiningType != null) + { + stringBuilder.Append(poco.DisjoiningType.qualifiedName); + stringBuilder.Append(' '); + } + + stringBuilder.Append(' '); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DocumentationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DocumentationTextualNotationBuilder.cs new file mode 100644 index 00000000..8f96b881 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/DocumentationTextualNotationBuilder.cs @@ -0,0 +1,64 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class DocumentationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Documentation + /// Documentation='doc'Identification('locale'locale=STRING_VALUE)?body=REGULAR_COMMENT + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDocumentation(SysML2.NET.Core.POCO.Root.Annotations.IDocumentation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("doc "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + if (!string.IsNullOrWhiteSpace(poco.Locale)) + { + stringBuilder.Append("locale "); + stringBuilder.Append(poco.Locale); + stringBuilder.Append(' '); + } + + stringBuilder.Append(poco.Body); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ElementFilterMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ElementFilterMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..199fc143 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ElementFilterMembershipTextualNotationBuilder.cs @@ -0,0 +1,94 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ElementFilterMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ElementFilterMember + /// ElementFilterMember:ElementFilterMembership=MemberPrefix'filter'ownedRelatedElement+=OwnedExpression';' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildElementFilterMember(SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("filter "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + stringBuilder.AppendLine(";"); + + } + + /// + /// Builds the Textual Notation string for the rule FilterPackageMember + /// FilterPackageMember:ElementFilterMembership='['ownedRelatedElement+=OwnedExpression']' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFilterPackageMember(SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + stringBuilder.Append("["); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + stringBuilder.Append("]"); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ElementTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ElementTextualNotationBuilder.cs new file mode 100644 index 00000000..87de9ba5 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ElementTextualNotationBuilder.cs @@ -0,0 +1,305 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ElementTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Identification + /// Identification:Element=('<'declaredShortName=NAME'>')?(declaredName=NAME)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIdentification(SysML2.NET.Core.POCO.Root.Elements.IElement poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName)) + { + stringBuilder.Append("<"); + stringBuilder.Append(poco.DeclaredShortName); + stringBuilder.Append(">"); + stringBuilder.Append(' '); + } + + + if (!string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append(poco.DeclaredName); + } + + + } + + /// + /// Builds the Textual Notation string for the rule DefinitionElement + /// DefinitionElement:Element=Package|LibraryPackage|AnnotatingElement|Dependency|AttributeDefinition|EnumerationDefinition|OccurrenceDefinition|IndividualDefinition|ItemDefinition|PartDefinition|ConnectionDefinition|FlowDefinition|InterfaceDefinition|PortDefinition|ActionDefinition|CalculationDefinition|StateDefinition|ConstraintDefinition|RequirementDefinition|ConcernDefinition|CaseDefinition|AnalysisCaseDefinition|VerificationCaseDefinition|UseCaseDefinition|ViewDefinition|ViewpointDefinition|RenderingDefinition|MetadataDefinition|ExtendedDefinition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinitionElement(SysML2.NET.Core.POCO.Root.Elements.IElement poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceDefinition pocoInterfaceDefinition: + InterfaceDefinitionTextualNotationBuilder.BuildInterfaceDefinition(pocoInterfaceDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Connections.IConnectionDefinition pocoConnectionDefinition: + ConnectionDefinitionTextualNotationBuilder.BuildConnectionDefinition(pocoConnectionDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Flows.IFlowDefinition pocoFlowDefinition: + FlowDefinitionTextualNotationBuilder.BuildFlowDefinition(pocoFlowDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Requirements.IConcernDefinition pocoConcernDefinition: + ConcernDefinitionTextualNotationBuilder.BuildConcernDefinition(pocoConcernDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.AnalysisCases.IAnalysisCaseDefinition pocoAnalysisCaseDefinition: + AnalysisCaseDefinitionTextualNotationBuilder.BuildAnalysisCaseDefinition(pocoAnalysisCaseDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.VerificationCases.IVerificationCaseDefinition pocoVerificationCaseDefinition: + VerificationCaseDefinitionTextualNotationBuilder.BuildVerificationCaseDefinition(pocoVerificationCaseDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.UseCases.IUseCaseDefinition pocoUseCaseDefinition: + UseCaseDefinitionTextualNotationBuilder.BuildUseCaseDefinition(pocoUseCaseDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IViewpointDefinition pocoViewpointDefinition: + ViewpointDefinitionTextualNotationBuilder.BuildViewpointDefinition(pocoViewpointDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Requirements.IRequirementDefinition pocoRequirementDefinition: + RequirementDefinitionTextualNotationBuilder.BuildRequirementDefinition(pocoRequirementDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Cases.ICaseDefinition pocoCaseDefinition: + CaseDefinitionTextualNotationBuilder.BuildCaseDefinition(pocoCaseDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IRenderingDefinition pocoRenderingDefinition: + RenderingDefinitionTextualNotationBuilder.BuildRenderingDefinition(pocoRenderingDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IViewDefinition pocoViewDefinition: + ViewDefinitionTextualNotationBuilder.BuildViewDefinition(pocoViewDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Metadata.IMetadataDefinition pocoMetadataDefinition: + MetadataDefinitionTextualNotationBuilder.BuildMetadataDefinition(pocoMetadataDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Calculations.ICalculationDefinition pocoCalculationDefinition: + CalculationDefinitionTextualNotationBuilder.BuildCalculationDefinition(pocoCalculationDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Constraints.IConstraintDefinition pocoConstraintDefinition: + ConstraintDefinitionTextualNotationBuilder.BuildConstraintDefinition(pocoConstraintDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Parts.IPartDefinition pocoPartDefinition: + PartDefinitionTextualNotationBuilder.BuildPartDefinition(pocoPartDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.States.IStateDefinition pocoStateDefinition: + StateDefinitionTextualNotationBuilder.BuildStateDefinition(pocoStateDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Items.IItemDefinition pocoItemDefinition: + ItemDefinitionTextualNotationBuilder.BuildItemDefinition(pocoItemDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Ports.IPortDefinition pocoPortDefinition: + PortDefinitionTextualNotationBuilder.BuildPortDefinition(pocoPortDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IActionDefinition pocoActionDefinition: + ActionDefinitionTextualNotationBuilder.BuildActionDefinition(pocoActionDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationDefinition pocoEnumerationDefinition: + EnumerationDefinitionTextualNotationBuilder.BuildEnumerationDefinition(pocoEnumerationDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Attributes.IAttributeDefinition pocoAttributeDefinition: + AttributeDefinitionTextualNotationBuilder.BuildAttributeDefinition(pocoAttributeDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceDefinition pocoOccurrenceDefinitionOccurrenceDefinition when pocoOccurrenceDefinitionOccurrenceDefinition.IsValidForOccurrenceDefinition(): + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinition(pocoOccurrenceDefinitionOccurrenceDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceDefinition pocoOccurrenceDefinition: + OccurrenceDefinitionTextualNotationBuilder.BuildIndividualDefinition(pocoOccurrenceDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IDefinition pocoDefinition: + DefinitionTextualNotationBuilder.BuildExtendedDefinition(pocoDefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Packages.ILibraryPackage pocoLibraryPackage: + LibraryPackageTextualNotationBuilder.BuildLibraryPackage(pocoLibraryPackage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Dependencies.IDependency pocoDependency: + DependencyTextualNotationBuilder.BuildDependency(pocoDependency, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Packages.IPackage pocoPackage: + PackageTextualNotationBuilder.BuildPackage(pocoPackage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Annotations.IAnnotatingElement pocoAnnotatingElement: + AnnotatingElementTextualNotationBuilder.BuildAnnotatingElement(pocoAnnotatingElement, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule OwnedRelatedElement + /// OwnedRelatedElement:Element=NonFeatureElement|FeatureElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedRelatedElement(SysML2.NET.Core.POCO.Root.Elements.IElement poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeature: + FeatureTextualNotationBuilder.BuildFeatureElement(pocoFeature, cursorCache, stringBuilder); + break; + default: + BuildNonFeatureElement(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule MemberElement + /// MemberElement:Element=AnnotatingElement|NonFeatureElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMemberElement(SysML2.NET.Core.POCO.Root.Elements.IElement poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Root.Annotations.IAnnotatingElement pocoAnnotatingElement: + AnnotatingElementTextualNotationBuilder.BuildAnnotatingElement(pocoAnnotatingElement, cursorCache, stringBuilder); + break; + default: + BuildNonFeatureElement(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule NonFeatureElement + /// NonFeatureElement:Element=Dependency|Namespace|Type|Classifier|DataType|Class|Structure|Metaclass|Association|AssociationStructure|Interaction|Behavior|Function|Predicate|Multiplicity|Package|LibraryPackage|Specialization|Conjugation|Subclassification|Disjoining|FeatureInverting|FeatureTyping|Subsetting|Redefinition|TypeFeaturing + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonFeatureElement(SysML2.NET.Core.POCO.Root.Elements.IElement poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Associations.IAssociationStructure pocoAssociationStructure: + AssociationStructureTextualNotationBuilder.BuildAssociationStructure(pocoAssociationStructure, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Interactions.IInteraction pocoInteraction: + InteractionTextualNotationBuilder.BuildInteraction(pocoInteraction, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Functions.IPredicate pocoPredicate: + PredicateTextualNotationBuilder.BuildPredicate(pocoPredicate, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Metadata.IMetaclass pocoMetaclass: + MetaclassTextualNotationBuilder.BuildMetaclass(pocoMetaclass, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Functions.IFunction pocoFunction: + FunctionTextualNotationBuilder.BuildFunction(pocoFunction, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Structures.IStructure pocoStructure: + StructureTextualNotationBuilder.BuildStructure(pocoStructure, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Associations.IAssociation pocoAssociation: + AssociationTextualNotationBuilder.BuildAssociation(pocoAssociation, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Behaviors.IBehavior pocoBehavior: + BehaviorTextualNotationBuilder.BuildBehavior(pocoBehavior, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.DataTypes.IDataType pocoDataType: + DataTypeTextualNotationBuilder.BuildDataType(pocoDataType, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Classes.IClass pocoClass: + ClassTextualNotationBuilder.BuildClass(pocoClass, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.IMultiplicity pocoMultiplicity: + MultiplicityTextualNotationBuilder.BuildMultiplicity(pocoMultiplicity, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.IRedefinition pocoRedefinition: + RedefinitionTextualNotationBuilder.BuildRedefinition(pocoRedefinition, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.ISubsetting pocoSubsetting: + SubsettingTextualNotationBuilder.BuildSubsetting(pocoSubsetting, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.IFeatureTyping pocoFeatureTyping: + FeatureTypingTextualNotationBuilder.BuildFeatureTyping(pocoFeatureTyping, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Classifiers.IClassifier pocoClassifier: + ClassifierTextualNotationBuilder.BuildClassifier(pocoClassifier, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Packages.ILibraryPackage pocoLibraryPackage: + LibraryPackageTextualNotationBuilder.BuildLibraryPackage(pocoLibraryPackage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification pocoSubclassification: + SubclassificationTextualNotationBuilder.BuildSubclassification(pocoSubclassification, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing pocoTypeFeaturing: + TypeFeaturingTextualNotationBuilder.BuildTypeFeaturing(pocoTypeFeaturing, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Dependencies.IDependency pocoDependency: + DependencyTextualNotationBuilder.BuildDependency(pocoDependency, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.IType pocoType: + TypeTextualNotationBuilder.BuildType(pocoType, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Packages.IPackage pocoPackage: + PackageTextualNotationBuilder.BuildPackage(pocoPackage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.ISpecialization pocoSpecialization: + SpecializationTextualNotationBuilder.BuildSpecialization(pocoSpecialization, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.IConjugation pocoConjugation: + ConjugationTextualNotationBuilder.BuildConjugation(pocoConjugation, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.IDisjoining pocoDisjoining: + DisjoiningTextualNotationBuilder.BuildDisjoining(pocoDisjoining, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.IFeatureInverting pocoFeatureInverting: + FeatureInvertingTextualNotationBuilder.BuildFeatureInverting(pocoFeatureInverting, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.INamespace pocoNamespace: + NamespaceTextualNotationBuilder.BuildNamespace(pocoNamespace, cursorCache, stringBuilder); + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EndFeatureMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EndFeatureMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..38e7de22 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EndFeatureMembershipTextualNotationBuilder.cs @@ -0,0 +1,161 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class EndFeatureMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SourceEndMember + /// SourceEndMember:EndFeatureMembership=ownedRelatedElement+=SourceEnd + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSourceEndMember(SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildSourceEnd(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ConnectorEndMember + /// ConnectorEndMember:EndFeatureMembership=ownedRelatedElement+=ConnectorEnd + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConnectorEndMember(SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildConnectorEnd(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceEndMember + /// InterfaceEndMember:EndFeatureMembership=ownedRelatedElement+=InterfaceEnd + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceEndMember(SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Ports.IPortUsage elementAsPortUsage) + { + PortUsageTextualNotationBuilder.BuildInterfaceEnd(elementAsPortUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FlowEndMember + /// FlowEndMember:EndFeatureMembership=ownedRelatedElement+=FlowEnd + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowEndMember(SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Interactions.IFlowEnd elementAsFlowEnd) + { + FlowEndTextualNotationBuilder.BuildFlowEnd(elementAsFlowEnd, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EmptyEndMember + /// EmptyEndMember:EndFeatureMembership=ownedRelatedElement+=EmptyFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyEndMember(SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildEmptyFeature(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EnumerationDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EnumerationDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..598d1da3 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EnumerationDefinitionTextualNotationBuilder.cs @@ -0,0 +1,100 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class EnumerationDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule EnumerationBody + /// EnumerationBody:EnumerationDefinition=';'|'{'(ownedRelationship+=AnnotatingMember|ownedRelationship+=EnumerationUsageMember)*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEnumerationBody(SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.AppendLine("{"); + while (ownedRelationshipCursor.Current != null) + { + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IVariantMembership variantMembership: + VariantMembershipTextualNotationBuilder.BuildEnumerationUsageMember(variantMembership, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership owningMembership: + OwningMembershipTextualNotationBuilder.BuildAnnotatingMember(owningMembership, cursorCache, stringBuilder); + break; + } + ownedRelationshipCursor.Move(); + } + + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule EnumerationDefinition + /// EnumerationDefinition=DefinitionExtensionKeyword*'enum''def'DefinitionDeclarationEnumerationBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEnumerationDefinition(SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + DefinitionTextualNotationBuilder.BuildDefinitionExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.Append("enum "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + BuildEnumerationBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EnumerationUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EnumerationUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..6897410e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EnumerationUsageTextualNotationBuilder.cs @@ -0,0 +1,70 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class EnumerationUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule EnumeratedValue + /// EnumeratedValue:EnumerationUsage='enum'?Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEnumeratedValue(SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("enum "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule EnumerationUsage + /// EnumerationUsage:EnumerationUsage=UsagePrefix'enum'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEnumerationUsage(SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("enum "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EventOccurrenceUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EventOccurrenceUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..8bda58fa --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/EventOccurrenceUsageTextualNotationBuilder.cs @@ -0,0 +1,83 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class EventOccurrenceUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MessageEvent + /// MessageEvent:EventOccurrenceUsage=ownedRelationship+=OwnedReferenceSubsetting + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMessageEvent(SysML2.NET.Core.POCO.Systems.Occurrences.IEventOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting elementAsReferenceSubsetting) + { + ReferenceSubsettingTextualNotationBuilder.BuildOwnedReferenceSubsetting(elementAsReferenceSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EventOccurrenceUsage + /// EventOccurrenceUsage=OccurrenceUsagePrefix'event'(ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?|'occurrence'UsageDeclaration?)UsageCompletion + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEventOccurrenceUsage(SysML2.NET.Core.POCO.Systems.Occurrences.IEventOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("event "); + BuildEventOccurrenceUsageHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + UsageTextualNotationBuilder.BuildUsageCompletion(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExhibitStateUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExhibitStateUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..e4025a5b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExhibitStateUsageTextualNotationBuilder.cs @@ -0,0 +1,64 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ExhibitStateUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ExhibitStateUsage + /// ExhibitStateUsage=OccurrenceUsagePrefix'exhibit'(ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?|'state'UsageDeclaration)ValuePart?StateUsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExhibitStateUsage(SysML2.NET.Core.POCO.Systems.States.IExhibitStateUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("exhibit "); + BuildExhibitStateUsageHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + StateUsageTextualNotationBuilder.BuildStateUsageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExposeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExposeTextualNotationBuilder.cs new file mode 100644 index 00000000..392956e5 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExposeTextualNotationBuilder.cs @@ -0,0 +1,66 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ExposeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Expose + /// Expose='expose'(MembershipExpose|NamespaceExpose)RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExpose(SysML2.NET.Core.POCO.Systems.Views.IExpose poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("expose "); + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Views.IMembershipExpose pocoMembershipExpose: + MembershipExposeTextualNotationBuilder.BuildMembershipExpose(pocoMembershipExpose, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.INamespaceExpose pocoNamespaceExpose: + NamespaceExposeTextualNotationBuilder.BuildNamespaceExpose(pocoNamespaceExpose, cursorCache, stringBuilder); + break; + } + + stringBuilder.Append(' '); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..41f8b650 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ExpressionTextualNotationBuilder.cs @@ -0,0 +1,278 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedExpression + /// OwnedExpression:Expression=ConditionalExpression|ConditionalBinaryOperatorExpression|BinaryOperatorExpression|UnaryOperatorExpression|ClassificationExpression|MetaclassificationExpression|ExtentExpression|PrimaryExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedExpression(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpressionConditionalExpression when pocoOperatorExpressionConditionalExpression.IsValidForConditionalExpression(): + OperatorExpressionTextualNotationBuilder.BuildConditionalExpression(pocoOperatorExpressionConditionalExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpressionConditionalBinaryOperatorExpression when pocoOperatorExpressionConditionalBinaryOperatorExpression.IsValidForConditionalBinaryOperatorExpression(): + OperatorExpressionTextualNotationBuilder.BuildConditionalBinaryOperatorExpression(pocoOperatorExpressionConditionalBinaryOperatorExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpressionBinaryOperatorExpression when pocoOperatorExpressionBinaryOperatorExpression.IsValidForBinaryOperatorExpression(): + OperatorExpressionTextualNotationBuilder.BuildBinaryOperatorExpression(pocoOperatorExpressionBinaryOperatorExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpressionUnaryOperatorExpression when pocoOperatorExpressionUnaryOperatorExpression.IsValidForUnaryOperatorExpression(): + OperatorExpressionTextualNotationBuilder.BuildUnaryOperatorExpression(pocoOperatorExpressionUnaryOperatorExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpressionClassificationExpression when pocoOperatorExpressionClassificationExpression.IsValidForClassificationExpression(): + OperatorExpressionTextualNotationBuilder.BuildClassificationExpression(pocoOperatorExpressionClassificationExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpressionMetaclassificationExpression when pocoOperatorExpressionMetaclassificationExpression.IsValidForMetaclassificationExpression(): + OperatorExpressionTextualNotationBuilder.BuildMetaclassificationExpression(pocoOperatorExpressionMetaclassificationExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpression: + OperatorExpressionTextualNotationBuilder.BuildExtentExpression(pocoOperatorExpression, cursorCache, stringBuilder); + break; + default: + BuildPrimaryExpression(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule PrimaryExpression + /// PrimaryExpression:Expression=FeatureChainExpression|NonFeatureChainPrimaryExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrimaryExpression(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureChainExpression pocoFeatureChainExpression: + FeatureChainExpressionTextualNotationBuilder.BuildFeatureChainExpression(pocoFeatureChainExpression, cursorCache, stringBuilder); + break; + default: + BuildNonFeatureChainPrimaryExpression(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule NonFeatureChainPrimaryExpression + /// NonFeatureChainPrimaryExpression:Expression=BracketExpression|IndexExpression|SequenceExpression|SelectExpression|CollectExpression|FunctionOperationExpression|BaseExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonFeatureChainPrimaryExpression(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Expressions.IIndexExpression pocoIndexExpression: + IndexExpressionTextualNotationBuilder.BuildIndexExpression(pocoIndexExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.ISelectExpression pocoSelectExpression: + SelectExpressionTextualNotationBuilder.BuildSelectExpression(pocoSelectExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.ICollectExpression pocoCollectExpression: + CollectExpressionTextualNotationBuilder.BuildCollectExpression(pocoCollectExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression pocoOperatorExpression: + OperatorExpressionTextualNotationBuilder.BuildBracketExpression(pocoOperatorExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IInvocationExpression pocoInvocationExpression: + InvocationExpressionTextualNotationBuilder.BuildFunctionOperationExpression(pocoInvocationExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Functions.IExpression pocoExpressionSequenceExpression when pocoExpressionSequenceExpression.IsValidForSequenceExpression(): + BuildSequenceExpression(pocoExpressionSequenceExpression, cursorCache, stringBuilder); + break; + default: + BuildBaseExpression(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule SequenceExpression + /// SequenceExpression:Expression='('SequenceExpressionList')' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSequenceExpression(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("("); + BuildSequenceExpressionList(poco, cursorCache, stringBuilder); + stringBuilder.Append(")"); + + } + + /// + /// Builds the Textual Notation string for the rule SequenceExpressionList + /// SequenceExpressionList:Expression=OwnedExpression','?|SequenceOperatorExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSequenceExpressionList(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildSequenceExpressionListHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule FunctionReference + /// FunctionReference:Expression=ownedRelationship+=ReferenceTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionReference(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildReferenceTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule BaseExpression + /// BaseExpression:Expression=NullExpression|LiteralExpression|FeatureReferenceExpression|MetadataAccessExpression|InvocationExpression|ConstructorExpression|BodyExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBaseExpression(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Expressions.IInvocationExpression pocoInvocationExpression: + InvocationExpressionTextualNotationBuilder.BuildInvocationExpression(pocoInvocationExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IConstructorExpression pocoConstructorExpression: + ConstructorExpressionTextualNotationBuilder.BuildConstructorExpression(pocoConstructorExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.INullExpression pocoNullExpression: + NullExpressionTextualNotationBuilder.BuildNullExpression(pocoNullExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralExpression pocoLiteralExpression: + LiteralExpressionTextualNotationBuilder.BuildLiteralExpression(pocoLiteralExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression pocoFeatureReferenceExpressionFeatureReferenceExpression when pocoFeatureReferenceExpressionFeatureReferenceExpression.IsValidForFeatureReferenceExpression(): + FeatureReferenceExpressionTextualNotationBuilder.BuildFeatureReferenceExpression(pocoFeatureReferenceExpressionFeatureReferenceExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression pocoFeatureReferenceExpression: + FeatureReferenceExpressionTextualNotationBuilder.BuildBodyExpression(pocoFeatureReferenceExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IMetadataAccessExpression pocoMetadataAccessExpression: + MetadataAccessExpressionTextualNotationBuilder.BuildMetadataAccessExpression(pocoMetadataAccessExpression, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule ExpressionBody + /// ExpressionBody:Expression='{'FunctionBodyPart'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExpressionBody(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.AppendLine("{"); + TypeTextualNotationBuilder.BuildFunctionBodyPart(poco, cursorCache, stringBuilder); + stringBuilder.AppendLine("}"); + + } + + /// + /// Builds the Textual Notation string for the rule Expression + /// Expression=FeaturePrefix'expr'FeatureDeclarationValuePart?FunctionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExpression(SysML2.NET.Core.POCO.Kernel.Functions.IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("expr "); + FeatureTextualNotationBuilder.BuildFeatureDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildFunctionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureChainExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureChainExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..1528ecbc --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureChainExpressionTextualNotationBuilder.cs @@ -0,0 +1,77 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureChainExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeatureChainExpression + /// FeatureChainExpression=ownedRelationship+=NonFeatureChainPrimaryArgumentMember'.'ownedRelationship+=FeatureChainMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureChainExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureChainExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildNonFeatureChainPrimaryArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("."); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildFeatureChainMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureChainingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureChainingTextualNotationBuilder.cs new file mode 100644 index 00000000..e86a0fe6 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureChainingTextualNotationBuilder.cs @@ -0,0 +1,59 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureChainingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedFeatureChaining + /// OwnedFeatureChaining:FeatureChaining=chainingFeature=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedFeatureChaining(SysML2.NET.Core.POCO.Core.Features.IFeatureChaining poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ChainingFeature != null) + { + stringBuilder.Append(poco.ChainingFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureDirectionKindTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureDirectionKindTextualNotationBuilder.cs new file mode 100644 index 00000000..b9d6903f --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureDirectionKindTextualNotationBuilder.cs @@ -0,0 +1,53 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureDirectionKindTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeatureDirection + /// FeatureDirection:FeatureDirectionKind='in'|'out'|'inout' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureDirection(SysML2.NET.Core.Core.Types.FeatureDirectionKind poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureInvertingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureInvertingTextualNotationBuilder.cs new file mode 100644 index 00000000..3a298af3 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureInvertingTextualNotationBuilder.cs @@ -0,0 +1,112 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureInvertingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedFeatureInverting + /// OwnedFeatureInverting:FeatureInverting=invertingFeature=[QualifiedName]|invertingFeature=OwnedFeatureChain{ownedRelatedElement+=invertingFeature} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedFeatureInverting(SysML2.NET.Core.POCO.Core.Features.IFeatureInverting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.InvertingFeature) && poco.InvertingFeature is SysML2.NET.Core.POCO.Core.Features.IFeature chainedInvertingFeatureAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedInvertingFeatureAsFeature, cursorCache, stringBuilder); + } + else if (poco.InvertingFeature != null) + { + stringBuilder.Append(poco.InvertingFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule FeatureInverting + /// FeatureInverting=('inverting'Identification?)?'inverse'(featureInverted=[QualifiedName]|featureInverted=OwnedFeatureChain{ownedRelatedElement+=featureInverted})'of'(invertingFeature=[QualifiedName]|ownedRelatedElement+=OwnedFeatureChain{ownedRelatedElement+=invertingFeature})RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureInverting(SysML2.NET.Core.POCO.Core.Features.IFeatureInverting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("inverting "); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + } + stringBuilder.Append(' '); + } + + stringBuilder.Append("inverse "); + if (poco.OwnedRelatedElement.Contains(poco.FeatureInverted) && poco.FeatureInverted is SysML2.NET.Core.POCO.Core.Features.IFeature chainedFeatureInvertedAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedFeatureInvertedAsFeature, cursorCache, stringBuilder); + } + else if (poco.FeatureInverted != null) + { + stringBuilder.Append(poco.FeatureInverted.qualifiedName); + stringBuilder.Append(' '); + } + + stringBuilder.Append(' '); + stringBuilder.Append("of "); + if (poco.OwnedRelatedElement.Contains(poco.InvertingFeature) && poco.InvertingFeature is SysML2.NET.Core.POCO.Core.Features.IFeature chainedInvertingFeatureAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedInvertingFeatureAsFeature, cursorCache, stringBuilder); + } + else if (poco.InvertingFeature != null) + { + stringBuilder.Append(poco.InvertingFeature.qualifiedName); + stringBuilder.Append(' '); + } + + stringBuilder.Append(' '); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..3c1c536e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureMembershipTextualNotationBuilder.cs @@ -0,0 +1,710 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule NonOccurrenceUsageMember + /// NonOccurrenceUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=NonOccurrenceUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonOccurrenceUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildNonOccurrenceUsageElement(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OccurrenceUsageMember + /// OccurrenceUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=OccurrenceUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOccurrenceUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildOccurrenceUsageElement(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule StructureUsageMember + /// StructureUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=StructureUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStructureUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildStructureUsageElement(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule BehaviorUsageMember + /// BehaviorUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=BehaviorUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBehaviorUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildBehaviorUsageElement(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule SourceSuccessionMember + /// SourceSuccessionMember:FeatureMembership='then'ownedRelatedElement+=SourceSuccession + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSourceSuccessionMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + stringBuilder.Append("then "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage elementAsSuccessionAsUsage) + { + SuccessionAsUsageTextualNotationBuilder.BuildSourceSuccession(elementAsSuccessionAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceNonOccurrenceUsageMember + /// InterfaceNonOccurrenceUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=InterfaceNonOccurrenceUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceNonOccurrenceUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildInterfaceNonOccurrenceUsageElement(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceOccurrenceUsageMember + /// InterfaceOccurrenceUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=InterfaceOccurrenceUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceOccurrenceUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildInterfaceOccurrenceUsageElement(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FlowPayloadFeatureMember + /// FlowPayloadFeatureMember:FeatureMembership=ownedRelatedElement+=FlowPayloadFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowPayloadFeatureMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Interactions.IPayloadFeature elementAsPayloadFeature) + { + PayloadFeatureTextualNotationBuilder.BuildFlowPayloadFeature(elementAsPayloadFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FlowFeatureMember + /// FlowFeatureMember:FeatureMembership=ownedRelatedElement+=FlowFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowFeatureMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildFlowFeature(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ActionBehaviorMember + /// ActionBehaviorMember:FeatureMembership=BehaviorUsageMember|ActionNodeMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionBehaviorMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Types.IFeatureMembership pocoFeatureMembershipBehaviorUsageMember when pocoFeatureMembershipBehaviorUsageMember.IsValidForBehaviorUsageMember(): + BuildBehaviorUsageMember(pocoFeatureMembershipBehaviorUsageMember, cursorCache, stringBuilder); + break; + default: + BuildActionNodeMember(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule InitialNodeMember + /// InitialNodeMember:FeatureMembership=MemberPrefix'first'memberFeature=[QualifiedName]RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInitialNodeMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("first "); + BuildMemberFeature(poco, cursorCache, stringBuilder); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule ActionNodeMember + /// ActionNodeMember:FeatureMembership=MemberPrefixownedRelatedElement+=ActionNode + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionNodeMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IActionUsage elementAsActionUsage) + { + ActionUsageTextualNotationBuilder.BuildActionNode(elementAsActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ActionTargetSuccessionMember + /// ActionTargetSuccessionMember:FeatureMembership=MemberPrefixownedRelatedElement+=ActionTargetSuccession + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionTargetSuccessionMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildActionTargetSuccession(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule GuardedSuccessionMember + /// GuardedSuccessionMember:FeatureMembership=MemberPrefixownedRelatedElement+=GuardedSuccession + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildGuardedSuccessionMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionUsage elementAsTransitionUsage) + { + TransitionUsageTextualNotationBuilder.BuildGuardedSuccession(elementAsTransitionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ForVariableDeclarationMember + /// ForVariableDeclarationMember:FeatureMembership=ownedRelatedElement+=UsageDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildForVariableDeclarationMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EntryTransitionMember + /// EntryTransitionMember:FeatureMembership=MemberPrefix(ownedRelatedElement+=GuardedTargetSuccession|'then'ownedRelatedElement+=TargetSuccession)';' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEntryTransitionMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + BuildEntryTransitionMemberHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.AppendLine(";"); + + } + + /// + /// Builds the Textual Notation string for the rule TransitionUsageMember + /// TransitionUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=TransitionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionUsage elementAsTransitionUsage) + { + TransitionUsageTextualNotationBuilder.BuildTransitionUsage(elementAsTransitionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule TargetTransitionUsageMember + /// TargetTransitionUsageMember:FeatureMembership=MemberPrefixownedRelatedElement+=TargetTransitionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTargetTransitionUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionUsage elementAsTransitionUsage) + { + TransitionUsageTextualNotationBuilder.BuildTargetTransitionUsage(elementAsTransitionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataBodyUsageMember + /// MetadataBodyUsageMember:FeatureMembership=ownedMemberFeature=MetadataBodyUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataBodyUsageMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberFeature != null) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("ref "); + stringBuilder.Append(" :>> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IRedefinition elementAsRedefinition) + { + RedefinitionTextualNotationBuilder.BuildOwnedRedefinition(elementAsRedefinition, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (poco.ownedMemberFeature != null) + { + + if (poco.ownedMemberFeature.OwnedRelationship.Count != 0 || poco.ownedMemberFeature.type.Count != 0 || poco.ownedMemberFeature.chainingFeature.Count != 0 || poco.ownedMemberFeature.IsOrdered) + { + FeatureTextualNotationBuilder.BuildFeatureSpecializationPart(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + } + + if (poco.ownedMemberFeature != null) + { + + if (poco.ownedMemberFeature.OwnedRelationship.Count != 0 || poco.ownedMemberFeature.type.Count != 0 || poco.ownedMemberFeature.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.ownedMemberFeature.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.ownedMemberFeature.DeclaredName) || poco.ownedMemberFeature.Direction.HasValue || poco.ownedMemberFeature.IsDerived || poco.ownedMemberFeature.IsAbstract || poco.ownedMemberFeature.IsConstant || poco.ownedMemberFeature.IsOrdered || poco.ownedMemberFeature.IsEnd || poco.ownedMemberFeature.importedMembership.Count != 0 || poco.ownedMemberFeature.IsComposite || poco.ownedMemberFeature.IsPortion || poco.ownedMemberFeature.IsVariable || poco.ownedMemberFeature.IsSufficient || poco.ownedMemberFeature.unioningType.Count != 0 || poco.ownedMemberFeature.intersectingType.Count != 0 || poco.ownedMemberFeature.differencingType.Count != 0 || poco.ownedMemberFeature.featuringType.Count != 0 || poco.ownedMemberFeature.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + } + + if (poco.ownedMemberFeature != null) + { + TypeTextualNotationBuilder.BuildMetadataBody(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + + } + + } + + /// + /// Builds the Textual Notation string for the rule OwnedFeatureMember + /// OwnedFeatureMember:FeatureMembership=MemberPrefixownedRelatedElement+=FeatureElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedFeatureMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureElement(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedExpressionReferenceMember + /// OwnedExpressionReferenceMember:FeatureMembership=ownedRelationship+=OwnedExpressionReference + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedExpressionReferenceMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression elementAsFeatureReferenceExpression) + { + FeatureReferenceExpressionTextualNotationBuilder.BuildOwnedExpressionReference(elementAsFeatureReferenceExpression, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedExpressionMember + /// OwnedExpressionMember:FeatureMembership=ownedFeatureMember=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedExpressionMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildOwnedFeatureMember(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule SequenceExpressionListMember + /// SequenceExpressionListMember:FeatureMembership=ownedMemberFeature=SequenceExpressionList + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSequenceExpressionListMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberFeature != null) + { + BuildSequenceExpressionListHandCoded(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule FunctionReferenceMember + /// FunctionReferenceMember:FeatureMembership=ownedMemberFeature=FunctionReference + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionReferenceMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberFeature != null) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildReferenceTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + } + + /// + /// Builds the Textual Notation string for the rule NamedArgumentMember + /// NamedArgumentMember:FeatureMembership=ownedMemberFeature=NamedArgument + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamedArgumentMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberFeature != null) + { + FeatureTextualNotationBuilder.BuildNamedArgument(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ExpressionBodyMember + /// ExpressionBodyMember:FeatureMembership=ownedMemberFeature=ExpressionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExpressionBodyMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberFeature != null) + { + stringBuilder.AppendLine("{"); + + if (poco.ownedMemberFeature != null) + { + TypeTextualNotationBuilder.BuildFunctionBodyPart(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + stringBuilder.AppendLine("}"); + + } + + } + + /// + /// Builds the Textual Notation string for the rule PayloadFeatureMember + /// PayloadFeatureMember:FeatureMembership=ownedRelatedElement=PayloadFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPayloadFeatureMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildPayloadFeature(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataBodyFeatureMember + /// MetadataBodyFeatureMember:FeatureMembership=ownedMemberFeature=MetadataBodyFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataBodyFeatureMember(SysML2.NET.Core.POCO.Core.Types.IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberFeature != null) + { + FeatureTextualNotationBuilder.BuildMetadataBodyFeature(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureReferenceExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureReferenceExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..353e4676 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureReferenceExpressionTextualNotationBuilder.cs @@ -0,0 +1,172 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureReferenceExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SatisfactionReferenceExpression + /// SatisfactionReferenceExpression:FeatureReferenceExpression=ownedRelationship+=FeatureChainMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSatisfactionReferenceExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildFeatureChainMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedExpressionReference + /// OwnedExpressionReference:FeatureReferenceExpression=ownedRelationship+=OwnedExpressionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedExpressionReference(SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildOwnedExpressionMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FunctionReferenceExpression + /// FunctionReferenceExpression:FeatureReferenceExpression=ownedRelationship+=FunctionReferenceMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionReferenceExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildFunctionReferenceMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FeatureReferenceExpression + /// FeatureReferenceExpression:FeatureReferenceExpression=ownedRelationship+=FeatureReferenceMemberownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureReferenceExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildFeatureReferenceMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule BodyExpression + /// BodyExpression:FeatureReferenceExpression=ownedRelationship+=ExpressionBodyMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBodyExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildExpressionBodyMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureTextualNotationBuilder.cs new file mode 100644 index 00000000..ed0e5779 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureTextualNotationBuilder.cs @@ -0,0 +1,1221 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ValuePart + /// ValuePart:Feature=ownedRelationship+=FeatureValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildValuePart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildFeatureValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FeatureSpecializationPart + /// FeatureSpecializationPart:Feature=FeatureSpecialization+MultiplicityPart?FeatureSpecialization*|MultiplicityPartFeatureSpecialization* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureSpecializationPart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildFeatureSpecializationPartHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule FeatureSpecialization + /// FeatureSpecialization:Feature=Typings|Subsettings|References|Crosses|Redefinitions + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureSpecialization(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeatureTypings when pocoFeatureTypings.IsValidForTypings(): + BuildTypings(pocoFeatureTypings, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeatureSubsettings when pocoFeatureSubsettings.IsValidForSubsettings(): + BuildSubsettings(pocoFeatureSubsettings, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeatureReferences when pocoFeatureReferences.IsValidForReferences(): + BuildReferences(pocoFeatureReferences, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeatureCrosses when pocoFeatureCrosses.IsValidForCrosses(): + BuildCrosses(pocoFeatureCrosses, cursorCache, stringBuilder); + break; + default: + BuildRedefinitions(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule Typings + /// Typings:Feature=TypedBy(','ownedRelationship+=FeatureTyping)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypings(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildTypedBy(poco, cursorCache, stringBuilder); + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildFeatureTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule TypedBy + /// TypedBy:Feature=DEFINED_BYownedRelationship+=FeatureTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypedBy(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(":"); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildFeatureTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule Subsettings + /// Subsettings:Feature=Subsets(','ownedRelationship+=OwnedSubsetting)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSubsettings(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildSubsets(poco, cursorCache, stringBuilder); + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.ISubsetting elementAsSubsetting) + { + SubsettingTextualNotationBuilder.BuildOwnedSubsetting(elementAsSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule Subsets + /// Subsets:Feature=SUBSETSownedRelationship+=OwnedSubsetting + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSubsets(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" :> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.ISubsetting elementAsSubsetting) + { + SubsettingTextualNotationBuilder.BuildOwnedSubsetting(elementAsSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule References + /// References:Feature=REFERENCESownedRelationship+=OwnedReferenceSubsetting + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildReferences(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" ::> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting elementAsReferenceSubsetting) + { + ReferenceSubsettingTextualNotationBuilder.BuildOwnedReferenceSubsetting(elementAsReferenceSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule Crosses + /// Crosses:Feature=CROSSESownedRelationship+=OwnedCrossSubsetting + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCrosses(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" => "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.ICrossSubsetting elementAsCrossSubsetting) + { + CrossSubsettingTextualNotationBuilder.BuildOwnedCrossSubsetting(elementAsCrossSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule Redefinitions + /// Redefinitions:Feature=Redefines(','ownedRelationship+=OwnedRedefinition)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRedefinitions(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildRedefines(poco, cursorCache, stringBuilder); + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IRedefinition elementAsRedefinition) + { + RedefinitionTextualNotationBuilder.BuildOwnedRedefinition(elementAsRedefinition, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule Redefines + /// Redefines:Feature=REDEFINESownedRelationship+=OwnedRedefinition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRedefines(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" :>> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IRedefinition elementAsRedefinition) + { + RedefinitionTextualNotationBuilder.BuildOwnedRedefinition(elementAsRedefinition, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedFeatureChain + /// OwnedFeatureChain:Feature=ownedRelationship+=OwnedFeatureChaining('.'ownedRelationship+=OwnedFeatureChaining)+ + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedFeatureChain(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureChaining elementAsFeatureChaining) + { + FeatureChainingTextualNotationBuilder.BuildOwnedFeatureChaining(elementAsFeatureChaining, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("."); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureChaining elementAsFeatureChaining) + { + FeatureChainingTextualNotationBuilder.BuildOwnedFeatureChaining(elementAsFeatureChaining, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(' '); + + } + + /// + /// Builds the Textual Notation string for the rule MultiplicityPart + /// MultiplicityPart:Feature=ownedRelationship+=OwnedMultiplicity|(ownedRelationship+=OwnedMultiplicity)?(isOrdered?='ordered'({isUnique=false}'nonunique')?|{isUnique=false}'nonunique'(isOrdered?='ordered')?) + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMultiplicityPart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildMultiplicityPartHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule OwnedCrossMultiplicity + /// OwnedCrossMultiplicity:Feature=ownedRelationship+=OwnedMultiplicity + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedCrossMultiplicity(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildOwnedMultiplicity(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PayloadFeature + /// PayloadFeature:Feature=Identification?PayloadFeatureSpecializationPartValuePart?|ownedRelationship+=OwnedFeatureTyping(ownedRelationship+=OwnedMultiplicity)?|ownedRelationship+=OwnedMultiplicityownedRelationship+=OwnedFeatureTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPayloadFeature(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildPayloadFeatureHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule PayloadFeatureSpecializationPart + /// PayloadFeatureSpecializationPart:Feature=(FeatureSpecialization)+MultiplicityPart?FeatureSpecialization*|MultiplicityPartFeatureSpecialization+ + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPayloadFeatureSpecializationPart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildPayloadFeatureSpecializationPartHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule FeatureChainPrefix + /// FeatureChainPrefix:Feature=(ownedRelationship+=OwnedFeatureChaining'.')+ownedRelationship+=OwnedFeatureChaining'.' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureChainPrefix(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureChaining elementAsFeatureChaining) + { + FeatureChainingTextualNotationBuilder.BuildOwnedFeatureChaining(elementAsFeatureChaining, cursorCache, stringBuilder); + } + } + stringBuilder.Append("."); + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(' '); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureChaining elementAsFeatureChaining) + { + FeatureChainingTextualNotationBuilder.BuildOwnedFeatureChaining(elementAsFeatureChaining, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("."); + + } + + /// + /// Builds the Textual Notation string for the rule TriggerValuePart + /// TriggerValuePart:Feature=ownedRelationship+=TriggerFeatureValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTriggerValuePart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildTriggerFeatureValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule Argument + /// Argument:Feature=ownedRelationship+=ArgumentValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildArgument(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildArgumentValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ArgumentExpression + /// ArgumentExpression:Feature=ownedRelationship+=ArgumentExpressionValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildArgumentExpression(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildArgumentExpressionValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FeatureElement + /// FeatureElement:Feature=Feature|Step|Expression|BooleanExpression|Invariant|Connector|BindingConnector|Succession|Flow|SuccessionFlow + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureElement(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Interactions.ISuccessionFlow pocoSuccessionFlow: + SuccessionFlowTextualNotationBuilder.BuildSuccessionFlow(pocoSuccessionFlow, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Functions.IInvariant pocoInvariant: + InvariantTextualNotationBuilder.BuildInvariant(pocoInvariant, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Interactions.IFlow pocoFlow: + FlowTextualNotationBuilder.BuildFlow(pocoFlow, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Functions.IBooleanExpression pocoBooleanExpression: + BooleanExpressionTextualNotationBuilder.BuildBooleanExpression(pocoBooleanExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Connectors.IBindingConnector pocoBindingConnector: + BindingConnectorTextualNotationBuilder.BuildBindingConnector(pocoBindingConnector, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Connectors.ISuccession pocoSuccession: + SuccessionTextualNotationBuilder.BuildSuccession(pocoSuccession, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Functions.IExpression pocoExpression: + ExpressionTextualNotationBuilder.BuildExpression(pocoExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Connectors.IConnector pocoConnector: + ConnectorTextualNotationBuilder.BuildConnector(pocoConnector, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Behaviors.IStep pocoStep: + StepTextualNotationBuilder.BuildStep(pocoStep, cursorCache, stringBuilder); + break; + default: + BuildFeature(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule EndFeaturePrefix + /// EndFeaturePrefix:Feature=(isConstant?='const'{isVariable=true})?isEnd?='end' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEndFeaturePrefix(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.IsConstant) + { + stringBuilder.Append(" const "); + // NonParsing Assignment Element : isVariable = true => Does not have to be process + stringBuilder.Append(' '); + } + + if (poco.IsEnd) + { + stringBuilder.Append(" end "); + } + + } + + /// + /// Builds the Textual Notation string for the rule BasicFeaturePrefix + /// BasicFeaturePrefix:Feature=(direction=FeatureDirection)?(isDerived?='derived')?(isAbstract?='abstract')?(isComposite?='composite'|isPortion?='portion')?(isVariable?='var'|isConstant?='const'{isVariable=true})? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBasicFeaturePrefix(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.Direction.HasValue) + { + stringBuilder.Append(poco.Direction.ToString().ToLower()); + stringBuilder.Append(' '); + } + + + if (poco.IsDerived) + { + stringBuilder.Append(" derived "); + stringBuilder.Append(' '); + } + + + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + stringBuilder.Append(' '); + } + + if (poco.IsComposite) + { + stringBuilder.Append(" composite "); + } + else if (poco.IsPortion) + { + stringBuilder.Append(" portion "); + } + + BuildBasicFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule FeatureDeclaration + /// FeatureDeclaration:Feature=(isSufficient?='all')?(FeatureIdentification(FeatureSpecializationPart|ConjugationPart)?|FeatureSpecializationPart|ConjugationPart)FeatureRelationshipPart* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureDeclaration(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.IsSufficient) + { + stringBuilder.Append(" all "); + stringBuilder.Append(' '); + } + + BuildFeatureDeclarationHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + BuildFeatureDeclarationHandCoded(poco, cursorCache, stringBuilder); + + + } + + /// + /// Builds the Textual Notation string for the rule FeatureIdentification + /// FeatureIdentification:Feature='<'declaredShortName=NAME'>'(declaredName=NAME)?|declaredName=NAME + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureIdentification(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildFeatureIdentificationHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule FeatureRelationshipPart + /// FeatureRelationshipPart:Feature=TypeRelationshipPart|ChainingPart|InvertingPart|TypeFeaturingPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureRelationshipPart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeatureChainingPart when pocoFeatureChainingPart.IsValidForChainingPart(): + BuildChainingPart(pocoFeatureChainingPart, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeatureInvertingPart when pocoFeatureInvertingPart.IsValidForInvertingPart(): + BuildInvertingPart(pocoFeatureInvertingPart, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.IType pocoType: + TypeTextualNotationBuilder.BuildTypeRelationshipPart(pocoType, cursorCache, stringBuilder); + break; + default: + BuildTypeFeaturingPart(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule ChainingPart + /// ChainingPart:Feature='chains'(ownedRelationship+=OwnedFeatureChaining|FeatureChain) + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildChainingPart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("chains "); + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureChaining elementAsFeatureChaining) + { + FeatureChainingTextualNotationBuilder.BuildOwnedFeatureChaining(elementAsFeatureChaining, cursorCache, stringBuilder); + } + } + } + else + { + BuildFeatureChain(poco, cursorCache, stringBuilder); + } + stringBuilder.Append(' '); + + } + + /// + /// Builds the Textual Notation string for the rule InvertingPart + /// InvertingPart:Feature='inverse''of'ownedRelationship+=OwnedFeatureInverting + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInvertingPart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("inverse "); + stringBuilder.Append("of "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureInverting elementAsFeatureInverting) + { + FeatureInvertingTextualNotationBuilder.BuildOwnedFeatureInverting(elementAsFeatureInverting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule TypeFeaturingPart + /// TypeFeaturingPart:Feature='featured''by'ownedRelationship+=OwnedTypeFeaturing(','ownedTypeFeaturing+=OwnedTypeFeaturing)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeFeaturingPart(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + var ownedTypeFeaturingCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedTypeFeaturing", poco.ownedTypeFeaturing); + stringBuilder.Append("featured "); + stringBuilder.Append("by "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing elementAsTypeFeaturing) + { + TypeFeaturingTextualNotationBuilder.BuildOwnedTypeFeaturing(elementAsTypeFeaturing, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedTypeFeaturingCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedTypeFeaturingCursor.Current != null) + { + + if (ownedTypeFeaturingCursor.Current is SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing elementAsTypeFeaturing) + { + TypeFeaturingTextualNotationBuilder.BuildOwnedTypeFeaturing(elementAsTypeFeaturing, cursorCache, stringBuilder); + } + } + ownedTypeFeaturingCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule FeatureChain + /// FeatureChain:Feature=ownedRelationship+=OwnedFeatureChaining('.'ownedRelationship+=OwnedFeatureChaining)+ + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureChain(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureChaining elementAsFeatureChaining) + { + FeatureChainingTextualNotationBuilder.BuildOwnedFeatureChaining(elementAsFeatureChaining, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("."); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureChaining elementAsFeatureChaining) + { + FeatureChainingTextualNotationBuilder.BuildOwnedFeatureChaining(elementAsFeatureChaining, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(' '); + + } + + /// + /// Builds the Textual Notation string for the rule MetadataArgument + /// MetadataArgument:Feature=ownedRelationship+=MetadataValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataArgument(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildMetadataValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule TypeReference + /// TypeReference:Feature=ownedRelationship+=ReferenceTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeReference(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildReferenceTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PrimaryArgument + /// PrimaryArgument:Feature=ownedRelationship+=PrimaryArgumentValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrimaryArgument(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildPrimaryArgumentValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule NonFeatureChainPrimaryArgument + /// NonFeatureChainPrimaryArgument:Feature=ownedRelationship+=NonFeatureChainPrimaryArgumentValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonFeatureChainPrimaryArgument(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildNonFeatureChainPrimaryArgumentValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule BodyArgument + /// BodyArgument:Feature=ownedRelationship+=BodyArgumentValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBodyArgument(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildBodyArgumentValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FunctionReferenceArgument + /// FunctionReferenceArgument:Feature=ownedRelationship+=FunctionReferenceArgumentValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionReferenceArgument(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildFunctionReferenceArgumentValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FeatureReference + /// FeatureReference:Feature=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureReference(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append(poco.qualifiedName); + stringBuilder.Append(' '); + + } + + /// + /// Builds the Textual Notation string for the rule ConstructorResult + /// ConstructorResult:Feature=ArgumentList + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConstructorResult(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildArgumentList(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule ArgumentList + /// ArgumentList:Feature='('(PositionalArgumentList|NamedArgumentList)?')' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildArgumentList(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("("); + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Features.IFeature pocoFeaturePositionalArgumentList when pocoFeaturePositionalArgumentList.IsValidForPositionalArgumentList(): + BuildPositionalArgumentList(pocoFeaturePositionalArgumentList, cursorCache, stringBuilder); + break; + default: + BuildNamedArgumentList(poco, cursorCache, stringBuilder); + break; + } + + stringBuilder.Append(")"); + + } + + /// + /// Builds the Textual Notation string for the rule PositionalArgumentList + /// PositionalArgumentList:Feature=e.ownedRelationship+=ArgumentMember(','e.ownedRelationship+=ArgumentMember)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPositionalArgumentList(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule NamedArgumentList + /// NamedArgumentList:Feature=ownedRelationship+=NamedArgumentMember(','ownedRelationship+=NamedArgumentMember)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamedArgumentList(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildNamedArgumentMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildNamedArgumentMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule NamedArgument + /// NamedArgument:Feature=ownedRelationship+=ParameterRedefinition'='ownedRelationship+=ArgumentValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamedArgument(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IRedefinition elementAsRedefinition) + { + RedefinitionTextualNotationBuilder.BuildParameterRedefinition(elementAsRedefinition, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("="); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildArgumentValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataBodyFeature + /// MetadataBodyFeature:Feature='feature'?(':>>'|'redefines')?ownedRelationship+=OwnedRedefinitionFeatureSpecializationPart?ValuePart?MetadataBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataBodyFeature(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("feature "); + stringBuilder.Append(" :>> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IRedefinition elementAsRedefinition) + { + RedefinitionTextualNotationBuilder.BuildOwnedRedefinition(elementAsRedefinition, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + BuildFeatureSpecializationPart(poco, cursorCache, stringBuilder); + } + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildMetadataBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule Feature + /// Feature=(FeaturePrefix('feature'|ownedRelationship+=PrefixMetadataMember)FeatureDeclaration?|(EndFeaturePrefix|BasicFeaturePrefix)FeatureDeclaration)ValuePart?TypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeature(SysML2.NET.Core.POCO.Core.Features.IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeatureHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureTypingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureTypingTextualNotationBuilder.cs new file mode 100644 index 00000000..e8b7bfc7 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureTypingTextualNotationBuilder.cs @@ -0,0 +1,101 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureTypingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedFeatureTyping + /// OwnedFeatureTyping:FeatureTyping=type=[QualifiedName]|type=OwnedFeatureChain{ownedRelatedElement+=type} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedFeatureTyping(SysML2.NET.Core.POCO.Core.Features.IFeatureTyping poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.Type) && poco.Type is SysML2.NET.Core.POCO.Core.Features.IFeature chainedTypeAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedTypeAsFeature, cursorCache, stringBuilder); + } + else if (poco.Type != null) + { + stringBuilder.Append(poco.Type.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule ReferenceTyping + /// ReferenceTyping:FeatureTyping=type=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildReferenceTyping(SysML2.NET.Core.POCO.Core.Features.IFeatureTyping poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.Type != null) + { + stringBuilder.Append(poco.Type.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule FeatureTyping + /// FeatureTyping=OwnedFeatureTyping|ConjugatedPortTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureTyping(SysML2.NET.Core.POCO.Core.Features.IFeatureTyping poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortTyping pocoConjugatedPortTyping: + ConjugatedPortTypingTextualNotationBuilder.BuildConjugatedPortTyping(pocoConjugatedPortTyping, cursorCache, stringBuilder); + break; + default: + BuildOwnedFeatureTyping(poco, cursorCache, stringBuilder); + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureValueTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureValueTextualNotationBuilder.cs new file mode 100644 index 00000000..df118211 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FeatureValueTextualNotationBuilder.cs @@ -0,0 +1,325 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FeatureValueTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TriggerFeatureValue + /// TriggerFeatureValue:FeatureValue=ownedRelatedElement+=TriggerExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTriggerFeatureValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.ITriggerInvocationExpression elementAsTriggerInvocationExpression) + { + TriggerInvocationExpressionTextualNotationBuilder.BuildTriggerExpression(elementAsTriggerInvocationExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ArgumentValue + /// ArgumentValue:FeatureValue=value=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildArgumentValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.value != null) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(poco.value, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ArgumentExpressionValue + /// ArgumentExpressionValue:FeatureValue=ownedRelatedElement+=OwnedExpressionReference + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildArgumentExpressionValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression elementAsFeatureReferenceExpression) + { + FeatureReferenceExpressionTextualNotationBuilder.BuildOwnedExpressionReference(elementAsFeatureReferenceExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FeatureBinding + /// FeatureBinding:FeatureValue=ownedRelatedElement+=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureBinding(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule AssignmentTargetBinding + /// AssignmentTargetBinding:FeatureValue=ownedRelatedElement+=NonFeatureChainPrimaryExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssignmentTargetBinding(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildNonFeatureChainPrimaryExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule SatisfactionFeatureValue + /// SatisfactionFeatureValue:FeatureValue=ownedRelatedElement+=SatisfactionReferenceExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSatisfactionFeatureValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression elementAsFeatureReferenceExpression) + { + FeatureReferenceExpressionTextualNotationBuilder.BuildSatisfactionReferenceExpression(elementAsFeatureReferenceExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataValue + /// MetadataValue:FeatureValue=value=MetadataReference + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.value != null) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildElementReferenceMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + } + + /// + /// Builds the Textual Notation string for the rule PrimaryArgumentValue + /// PrimaryArgumentValue:FeatureValue=value=PrimaryExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrimaryArgumentValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.value != null) + { + ExpressionTextualNotationBuilder.BuildPrimaryExpression(poco.value, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule NonFeatureChainPrimaryArgumentValue + /// NonFeatureChainPrimaryArgumentValue:FeatureValue=value=NonFeatureChainPrimaryExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonFeatureChainPrimaryArgumentValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.value != null) + { + ExpressionTextualNotationBuilder.BuildNonFeatureChainPrimaryExpression(poco.value, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule BodyArgumentValue + /// BodyArgumentValue:FeatureValue=value=BodyExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBodyArgumentValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.value != null) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildExpressionBodyMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + } + + /// + /// Builds the Textual Notation string for the rule FunctionReferenceArgumentValue + /// FunctionReferenceArgumentValue:FeatureValue=value=FunctionReferenceExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionReferenceArgumentValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.value != null) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildFunctionReferenceMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + } + + /// + /// Builds the Textual Notation string for the rule FeatureValue + /// FeatureValue=('='|isInitial?=':='|isDefault?='default'('='|isInitial?=':=')?)ownedRelatedElement+=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureValue(SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + BuildFeatureValueHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..347aff53 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowDefinitionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FlowDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FlowDefinition + /// FlowDefinition=OccurrenceDefinitionPrefix'flow''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowDefinition(SysML2.NET.Core.POCO.Systems.Flows.IFlowDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("flow "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowEndTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowEndTextualNotationBuilder.cs new file mode 100644 index 00000000..1a769668 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowEndTextualNotationBuilder.cs @@ -0,0 +1,80 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FlowEndTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FlowEnd + /// FlowEnd=(ownedRelationship+=FlowEndSubsetting)?ownedRelationship+=FlowFeatureMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowEnd(SysML2.NET.Core.POCO.Kernel.Interactions.IFlowEnd poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting elementAsReferenceSubsetting) + { + ReferenceSubsettingTextualNotationBuilder.BuildFlowEndSubsetting(elementAsReferenceSubsetting, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildFlowFeatureMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowTextualNotationBuilder.cs new file mode 100644 index 00000000..f6fdf20c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowTextualNotationBuilder.cs @@ -0,0 +1,75 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FlowTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Flow + /// Flow=FeaturePrefix'flow'FlowDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlow(SysML2.NET.Core.POCO.Kernel.Interactions.IFlow poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("flow "); + BuildFlowDeclarationHandCoded(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..e485d9d9 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FlowUsageTextualNotationBuilder.cs @@ -0,0 +1,98 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FlowUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Message + /// Message:FlowUsage=OccurrenceUsagePrefix'message'MessageDeclarationDefinitionBody{isAbstract=true} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMessage(SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("message "); + BuildMessageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildDefinitionBody(poco, cursorCache, stringBuilder); + // NonParsing Assignment Element : isAbstract = true => Does not have to be process + + } + + /// + /// Builds the Textual Notation string for the rule MessageDeclaration + /// MessageDeclaration:FlowUsage=UsageDeclarationValuePart?('of'ownedRelationship+=FlowPayloadFeatureMember)?('from'ownedRelationship+=MessageEventMember'to'ownedRelationship+=MessageEventMember)?|ownedRelationship+=MessageEventMember'to'ownedRelationship+=MessageEventMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMessageDeclaration(SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildMessageDeclarationHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule FlowDeclaration + /// FlowDeclaration:FlowUsage=UsageDeclarationValuePart?('of'ownedRelationship+=FlowPayloadFeatureMember)?('from'ownedRelationship+=FlowEndMember'to'ownedRelationship+=FlowEndMember)?|ownedRelationship+=FlowEndMember'to'ownedRelationship+=FlowEndMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowDeclaration(SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildFlowDeclarationHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule FlowUsage + /// FlowUsage=OccurrenceUsagePrefix'flow'FlowDeclarationDefinitionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowUsage(SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("flow "); + BuildFlowDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildDefinitionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ForLoopActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ForLoopActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..07ad083b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ForLoopActionUsageTextualNotationBuilder.cs @@ -0,0 +1,90 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ForLoopActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ForLoopNode + /// ForLoopNode:ForLoopActionUsage=ActionNodePrefix'for'ownedRelationship+=ForVariableDeclarationMember'in'ownedRelationship+=NodeParameterMemberownedRelationship+=ActionBodyParameterMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildForLoopNode(SysML2.NET.Core.POCO.Systems.Actions.IForLoopActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + ActionUsageTextualNotationBuilder.BuildActionNodePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("for "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildForVariableDeclarationMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("in "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildNodeParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildActionBodyParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ForkNodeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ForkNodeTextualNotationBuilder.cs new file mode 100644 index 00000000..f80f4aaa --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ForkNodeTextualNotationBuilder.cs @@ -0,0 +1,60 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ForkNodeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ForkNode + /// ForkNode=ControlNodePrefixisComposite?='fork'UsageDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildForkNode(SysML2.NET.Core.POCO.Systems.Actions.IForkNode poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildControlNodePrefix(poco, cursorCache, stringBuilder); + if (poco.IsComposite) + { + stringBuilder.Append(" fork "); + } + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FramedConcernMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FramedConcernMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..34643805 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FramedConcernMembershipTextualNotationBuilder.cs @@ -0,0 +1,71 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FramedConcernMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FramedConcernMember + /// FramedConcernMember:FramedConcernMembership=MemberPrefix?'frame'ownedRelatedElement+=FramedConcernUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFramedConcernMember(SysML2.NET.Core.POCO.Systems.Requirements.IFramedConcernMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (poco.Visibility != SysML2.NET.Core.Root.Namespaces.VisibilityKind.Public) + { + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + } + stringBuilder.Append("frame "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IConcernUsage elementAsConcernUsage) + { + ConcernUsageTextualNotationBuilder.BuildFramedConcernUsage(elementAsConcernUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FunctionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FunctionTextualNotationBuilder.cs new file mode 100644 index 00000000..da4b1e03 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/FunctionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class FunctionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Function + /// Function=TypePrefix'function'ClassifierDeclarationFunctionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunction(SysML2.NET.Core.POCO.Kernel.Functions.IFunction poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("function "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildFunctionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IfActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IfActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..c67cc688 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IfActionUsageTextualNotationBuilder.cs @@ -0,0 +1,95 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class IfActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule IfNode + /// IfNode:IfActionUsage=ActionNodePrefix'if'ownedRelationship+=ExpressionParameterMemberownedRelationship+=ActionBodyParameterMember('else'ownedRelationship+=(ActionBodyParameterMember|IfNodeParameterMember))? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIfNode(SysML2.NET.Core.POCO.Systems.Actions.IIfActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + ActionUsageTextualNotationBuilder.BuildActionNodePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("if "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildExpressionParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildActionBodyParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("else "); + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership pocoParameterMembershipActionBodyParameterMember when pocoParameterMembershipActionBodyParameterMember.IsValidForActionBodyParameterMember(): + ParameterMembershipTextualNotationBuilder.BuildActionBodyParameterMember(pocoParameterMembershipActionBodyParameterMember, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership pocoParameterMembership: + ParameterMembershipTextualNotationBuilder.BuildIfNodeParameterMember(pocoParameterMembership, cursorCache, stringBuilder); + break; + } + ownedRelationshipCursor.Move(); + + } + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ImportTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ImportTextualNotationBuilder.cs new file mode 100644 index 00000000..1d98639c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ImportTextualNotationBuilder.cs @@ -0,0 +1,85 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ImportTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ImportDeclaration + /// ImportDeclaration:Import=MembershipImport|NamespaceImport + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildImportDeclaration(SysML2.NET.Core.POCO.Root.Namespaces.IImport poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Root.Namespaces.IMembershipImport pocoMembershipImport: + MembershipImportTextualNotationBuilder.BuildMembershipImport(pocoMembershipImport, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.INamespaceImport pocoNamespaceImport: + NamespaceImportTextualNotationBuilder.BuildNamespaceImport(pocoNamespaceImport, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule Import + /// Import=visibility=VisibilityIndicator'import'(isImportAll?='all')?ImportDeclarationRelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildImport(SysML2.NET.Core.POCO.Root.Namespaces.IImport poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append(poco.Visibility.ToString().ToLower()); + stringBuilder.Append("import "); + + if (poco.IsImportAll) + { + stringBuilder.Append(" all "); + stringBuilder.Append(' '); + } + + BuildImportDeclaration(poco, cursorCache, stringBuilder); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IncludeUseCaseUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IncludeUseCaseUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..939b6ebd --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IncludeUseCaseUsageTextualNotationBuilder.cs @@ -0,0 +1,64 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class IncludeUseCaseUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule IncludeUseCaseUsage + /// IncludeUseCaseUsage=OccurrenceUsagePrefix'include'(ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?|'use''case'UsageDeclaration)ValuePart?CaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIncludeUseCaseUsage(SysML2.NET.Core.POCO.Systems.UseCases.IIncludeUseCaseUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("include "); + BuildIncludeUseCaseUsageHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IndexExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IndexExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..cbc2991f --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IndexExpressionTextualNotationBuilder.cs @@ -0,0 +1,79 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class IndexExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule IndexExpression + /// IndexExpression=ownedRelationship+=PrimaryArgumentMember'#''('ownedRelationship+=SequenceExpressionListMember')' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIndexExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IIndexExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildPrimaryArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("#"); + stringBuilder.Append("("); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildSequenceExpressionListMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(")"); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InteractionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InteractionTextualNotationBuilder.cs new file mode 100644 index 00000000..ad15d1af --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InteractionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class InteractionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Interaction + /// Interaction=TypePrefix'interaction'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInteraction(SysML2.NET.Core.POCO.Kernel.Interactions.IInteraction poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("interaction "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InterfaceDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InterfaceDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..7703a413 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InterfaceDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class InterfaceDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule InterfaceDefinition + /// InterfaceDefinition=OccurrenceDefinitionPrefix'interface''def'DefinitionDeclarationInterfaceBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceDefinition(SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("interface "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildInterfaceBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InterfaceUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InterfaceUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..4b7b941d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InterfaceUsageTextualNotationBuilder.cs @@ -0,0 +1,180 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class InterfaceUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule InterfaceUsageDeclaration + /// InterfaceUsageDeclaration:InterfaceUsage=UsageDeclarationValuePart?('connect'InterfacePart)?|InterfacePart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceUsageDeclaration(SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildInterfaceUsageDeclarationHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule InterfacePart + /// InterfacePart:InterfaceUsage=BinaryInterfacePart|NaryInterfacePart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfacePart(SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage pocoInterfaceUsageBinaryInterfacePart when pocoInterfaceUsageBinaryInterfacePart.IsValidForBinaryInterfacePart(): + BuildBinaryInterfacePart(pocoInterfaceUsageBinaryInterfacePart, cursorCache, stringBuilder); + break; + default: + BuildNaryInterfacePart(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule BinaryInterfacePart + /// BinaryInterfacePart:InterfaceUsage=ownedRelationship+=InterfaceEndMember'to'ownedRelationship+=InterfaceEndMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBinaryInterfacePart(SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildInterfaceEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("to "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildInterfaceEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule NaryInterfacePart + /// NaryInterfacePart:InterfaceUsage='('ownedRelationship+=InterfaceEndMember','ownedRelationship+=InterfaceEndMember(','ownedRelationship+=InterfaceEndMember)*')' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNaryInterfacePart(SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("("); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildInterfaceEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildInterfaceEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildInterfaceEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(")"); + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceUsage + /// InterfaceUsage=OccurrenceUsagePrefix'interface'InterfaceUsageDeclarationInterfaceBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceUsage(SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("interface "); + BuildInterfaceUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildInterfaceBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IntersectingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IntersectingTextualNotationBuilder.cs new file mode 100644 index 00000000..c3496707 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/IntersectingTextualNotationBuilder.cs @@ -0,0 +1,71 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class IntersectingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Intersecting + /// Intersecting=intersectingType=[QualifiedName]|ownedRelatedElement+=OwnedFeatureChain + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIntersecting(SysML2.NET.Core.POCO.Core.Types.IIntersecting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + if (poco.IntersectingType != null) + { + stringBuilder.Append(poco.IntersectingType.qualifiedName); + stringBuilder.Append(' '); + } + else + { + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(elementAsFeature, cursorCache, stringBuilder); + } + } + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InvariantTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InvariantTextualNotationBuilder.cs new file mode 100644 index 00000000..4bbfe37e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InvariantTextualNotationBuilder.cs @@ -0,0 +1,89 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class InvariantTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Invariant + /// Invariant=FeaturePrefix'inv'('true'|isNegated?='false')?FeatureDeclarationValuePart?FunctionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInvariant(SysML2.NET.Core.POCO.Kernel.Functions.IInvariant poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("inv "); + if (!poco.IsNegated) + { + stringBuilder.Append("true "); + + } + else + { + stringBuilder.Append(" false "); + } + FeatureTextualNotationBuilder.BuildFeatureDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildFunctionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InvocationExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InvocationExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..949b18fa --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/InvocationExpressionTextualNotationBuilder.cs @@ -0,0 +1,149 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class InvocationExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FunctionOperationExpression + /// FunctionOperationExpression:InvocationExpression=ownedRelationship+=PrimaryArgumentMember'->'ownedRelationship+=InvocationTypeMember(ownedRelationship+=BodyArgumentMember|ownedRelationship+=FunctionReferenceArgumentMember|ArgumentList)ownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionOperationExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IInvocationExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildPrimaryArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("-> "); + + if (ownedRelationshipCursor.Current != null) + { + BuildInvocationTypeMember(poco, cursorCache, stringBuilder); + } + ownedRelationshipCursor.Move(); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildBodyArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + } + else if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildFunctionReferenceArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + } + else + { + FeatureTextualNotationBuilder.BuildArgumentList(poco, cursorCache, stringBuilder); + } + stringBuilder.Append(' '); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule InvocationExpression + /// InvocationExpression:InvocationExpression=ownedRelationship+=InstantiatedTypeMemberArgumentListownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInvocationExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IInvocationExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildInstantiatedTypeMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + FeatureTextualNotationBuilder.BuildArgumentList(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ItemDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ItemDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..182f1709 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ItemDefinitionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ItemDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ItemDefinition + /// ItemDefinition=OccurrenceDefinitionPrefix'item''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildItemDefinition(SysML2.NET.Core.POCO.Systems.Items.IItemDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("item "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ItemUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ItemUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..136b2d6c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ItemUsageTextualNotationBuilder.cs @@ -0,0 +1,56 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ItemUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ItemUsage + /// ItemUsage=OccurrenceUsagePrefix'item'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildItemUsage(SysML2.NET.Core.POCO.Systems.Items.IItemUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("item "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/JoinNodeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/JoinNodeTextualNotationBuilder.cs new file mode 100644 index 00000000..86bcb5ce --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/JoinNodeTextualNotationBuilder.cs @@ -0,0 +1,60 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class JoinNodeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule JoinNode + /// JoinNode=ControlNodePrefixisComposite?='join'UsageDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildJoinNode(SysML2.NET.Core.POCO.Systems.Actions.IJoinNode poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildControlNodePrefix(poco, cursorCache, stringBuilder); + if (poco.IsComposite) + { + stringBuilder.Append(" join "); + } + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LibraryPackageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LibraryPackageTextualNotationBuilder.cs new file mode 100644 index 00000000..51479aba --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LibraryPackageTextualNotationBuilder.cs @@ -0,0 +1,75 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class LibraryPackageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule LibraryPackage + /// LibraryPackage=(isStandard?='standard')'library'(ownedRelationship+=PrefixMetadataMember)*PackageDeclarationPackageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildLibraryPackage(SysML2.NET.Core.POCO.Kernel.Packages.ILibraryPackage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" standard "); + + stringBuilder.Append(' '); + stringBuilder.Append("library "); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + PackageTextualNotationBuilder.BuildPackageDeclaration(poco, cursorCache, stringBuilder); + PackageTextualNotationBuilder.BuildPackageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralBooleanTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralBooleanTextualNotationBuilder.cs new file mode 100644 index 00000000..e407468b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralBooleanTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class LiteralBooleanTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule LiteralBoolean + /// LiteralBoolean=value=BooleanValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildLiteralBoolean(SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralBoolean poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append(poco.Value.ToString().ToLower()); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..4eeed7d0 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralExpressionTextualNotationBuilder.cs @@ -0,0 +1,72 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class LiteralExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule LiteralExpression + /// LiteralExpression=LiteralBoolean|LiteralString|LiteralInteger|LiteralReal|LiteralInfinity + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildLiteralExpression(SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralBoolean pocoLiteralBoolean: + LiteralBooleanTextualNotationBuilder.BuildLiteralBoolean(pocoLiteralBoolean, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralString pocoLiteralString: + LiteralStringTextualNotationBuilder.BuildLiteralString(pocoLiteralString, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralInteger pocoLiteralInteger: + LiteralIntegerTextualNotationBuilder.BuildLiteralInteger(pocoLiteralInteger, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralInfinity pocoLiteralInfinity: + LiteralInfinityTextualNotationBuilder.BuildLiteralInfinity(pocoLiteralInfinity, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Elements.IElement pocoElement: + BuildValue(poco, cursorCache, stringBuilder); + + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralInfinityTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralInfinityTextualNotationBuilder.cs new file mode 100644 index 00000000..3770b1c9 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralInfinityTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class LiteralInfinityTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule LiteralInfinity + /// LiteralInfinity='*' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildLiteralInfinity(SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralInfinity poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("*"); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralIntegerTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralIntegerTextualNotationBuilder.cs new file mode 100644 index 00000000..ffc6cf00 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralIntegerTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class LiteralIntegerTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule LiteralInteger + /// LiteralInteger=value=DECIMAL_VALUE + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildLiteralInteger(SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralInteger poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append(poco.Value.ToString()); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralStringTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralStringTextualNotationBuilder.cs new file mode 100644 index 00000000..efac7cc1 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/LiteralStringTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class LiteralStringTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule LiteralString + /// LiteralString=value=STRING_VALUE + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildLiteralString(SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralString poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append(poco.Value); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipExposeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipExposeTextualNotationBuilder.cs new file mode 100644 index 00000000..39cb2b5d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipExposeTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MembershipExposeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MembershipExpose + /// MembershipExpose=MembershipImport + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMembershipExpose(SysML2.NET.Core.POCO.Systems.Views.IMembershipExpose poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + MembershipImportTextualNotationBuilder.BuildMembershipImport(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipImportTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipImportTextualNotationBuilder.cs new file mode 100644 index 00000000..6d6bc531 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipImportTextualNotationBuilder.cs @@ -0,0 +1,66 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MembershipImportTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MembershipImport + /// MembershipImport=importedMembership=[QualifiedName]('::'isRecursive?='**')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMembershipImport(SysML2.NET.Core.POCO.Root.Namespaces.IMembershipImport poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ImportedMembership != null) + { + stringBuilder.Append(poco.ImportedMembership.qualifiedName); + stringBuilder.Append(' '); + } + + if (poco.IsRecursive) + { + stringBuilder.Append(":: "); + stringBuilder.Append(" ** "); + } + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..6f78e827 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MembershipTextualNotationBuilder.cs @@ -0,0 +1,228 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MemberPrefix + /// MemberPrefix:Membership=(visibility=VisibilityIndicator)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMemberPrefix(SysML2.NET.Core.POCO.Root.Namespaces.IMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.Visibility != SysML2.NET.Core.Root.Namespaces.VisibilityKind.Public) + { + stringBuilder.Append(poco.Visibility.ToString().ToLower()); + } + + + } + + /// + /// Builds the Textual Notation string for the rule AliasMember + /// AliasMember:Membership=MemberPrefix'alias'('<'memberShortName=NAME'>')?(memberName=NAME)?'for'memberElement=[QualifiedName]RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAliasMember(SysML2.NET.Core.POCO.Root.Namespaces.IMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("alias "); + + if (!string.IsNullOrWhiteSpace(poco.MemberShortName)) + { + stringBuilder.Append("<"); + stringBuilder.Append(poco.MemberShortName); + stringBuilder.Append(">"); + stringBuilder.Append(' '); + } + + + if (!string.IsNullOrWhiteSpace(poco.MemberName)) + { + stringBuilder.Append(poco.MemberName); + stringBuilder.Append(' '); + } + + stringBuilder.Append("for "); + + if (poco.MemberElement != null) + { + stringBuilder.Append(poco.MemberElement.qualifiedName); + stringBuilder.Append(' '); + } + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule FeatureChainMember + /// FeatureChainMember:Membership=memberElement=[QualifiedName]|OwnedFeatureChainMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureChainMember(SysML2.NET.Core.POCO.Root.Namespaces.IMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.MemberElement != null) + { + stringBuilder.Append(poco.MemberElement.qualifiedName); + stringBuilder.Append(' '); + } + else + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } + + /// + /// Builds the Textual Notation string for the rule FeatureReferenceMember + /// FeatureReferenceMember:Membership=memberElement=FeatureReference + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureReferenceMember(SysML2.NET.Core.POCO.Root.Namespaces.IMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.MemberElement != null) + { + stringBuilder.Append(poco.MemberElement.qualifiedName); + stringBuilder.Append(' '); + + } + + } + + /// + /// Builds the Textual Notation string for the rule ElementReferenceMember + /// ElementReferenceMember:Membership=memberElement=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildElementReferenceMember(SysML2.NET.Core.POCO.Root.Namespaces.IMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.MemberElement != null) + { + stringBuilder.Append(poco.MemberElement.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule InstantiatedTypeMember + /// InstantiatedTypeMember:Membership=memberElement=InstantiatedTypeReference|OwnedFeatureChainMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInstantiatedTypeMember(SysML2.NET.Core.POCO.Root.Namespaces.IMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.MemberElement != null) + { + stringBuilder.Append(poco.MemberElement.qualifiedName); + stringBuilder.Append(' '); + + } + else + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } + + /// + /// Builds the Textual Notation string for the rule MetadataBodyElement + /// MetadataBodyElement:Membership=NonFeatureMember|MetadataBodyFeatureMember|AliasMember|Import + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataBodyElement(SysML2.NET.Core.POCO.Root.Namespaces.IMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Types.IFeatureMembership pocoFeatureMembership: + FeatureMembershipTextualNotationBuilder.BuildMetadataBodyFeatureMember(pocoFeatureMembership, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership pocoOwningMembership: + OwningMembershipTextualNotationBuilder.BuildNonFeatureMember(pocoOwningMembership, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IImport pocoImport: + ImportTextualNotationBuilder.BuildImport(pocoImport, cursorCache, stringBuilder); + break; + default: + BuildAliasMember(poco, cursorCache, stringBuilder); + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MergeNodeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MergeNodeTextualNotationBuilder.cs new file mode 100644 index 00000000..3df8baa3 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MergeNodeTextualNotationBuilder.cs @@ -0,0 +1,60 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MergeNodeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MergeNode + /// MergeNode=ControlNodePrefixisComposite?='merge'UsageDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMergeNode(SysML2.NET.Core.POCO.Systems.Actions.IMergeNode poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildControlNodePrefix(poco, cursorCache, stringBuilder); + if (poco.IsComposite) + { + stringBuilder.Append(" merge "); + } + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetaclassTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetaclassTextualNotationBuilder.cs new file mode 100644 index 00000000..aee7a1f5 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetaclassTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MetaclassTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Metaclass + /// Metaclass=TypePrefix'metaclass'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetaclass(SysML2.NET.Core.POCO.Kernel.Metadata.IMetaclass poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("metaclass "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataAccessExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataAccessExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..3c514f73 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataAccessExpressionTextualNotationBuilder.cs @@ -0,0 +1,91 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MetadataAccessExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MetadataReference + /// MetadataReference:MetadataAccessExpression=ownedRelationship+=ElementReferenceMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataReference(SysML2.NET.Core.POCO.Kernel.Expressions.IMetadataAccessExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildElementReferenceMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataAccessExpression + /// MetadataAccessExpression=ownedRelationship+=ElementReferenceMember'.''metadata' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataAccessExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IMetadataAccessExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildElementReferenceMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("."); + stringBuilder.Append("metadata "); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..809f0780 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataDefinitionTextualNotationBuilder.cs @@ -0,0 +1,70 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MetadataDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MetadataDefinition + /// MetadataDefinition=(isAbstract?='abstract')?DefinitionExtensionKeyword*'metadata''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataDefinition(SysML2.NET.Core.POCO.Systems.Metadata.IMetadataDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + stringBuilder.Append(' '); + } + + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + DefinitionTextualNotationBuilder.BuildDefinitionExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.Append("metadata "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataFeatureTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataFeatureTextualNotationBuilder.cs new file mode 100644 index 00000000..97bf0489 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataFeatureTextualNotationBuilder.cs @@ -0,0 +1,162 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MetadataFeatureTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PrefixMetadataFeature + /// PrefixMetadataFeature:MetadataFeature=ownedRelationship+=OwnedFeatureTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrefixMetadataFeature(SysML2.NET.Core.POCO.Kernel.Metadata.IMetadataFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildOwnedFeatureTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataFeatureDeclaration + /// MetadataFeatureDeclaration:MetadataFeature=(Identification(':'|'typed''by'))?ownedRelationship+=OwnedFeatureTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataFeatureDeclaration(SysML2.NET.Core.POCO.Kernel.Metadata.IMetadataFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(":"); + stringBuilder.Append(' '); + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildOwnedFeatureTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataFeature + /// MetadataFeature=(ownedRelationship+=PrefixMetadataMember)*('@'|'metadata')MetadataFeatureDeclaration('about'ownedRelationship+=Annotation(','ownedRelationship+=Annotation)*)?MetadataBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataFeature(SysML2.NET.Core.POCO.Kernel.Metadata.IMetadataFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(" @ "); + stringBuilder.Append(' '); + BuildMetadataFeatureDeclaration(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("about "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(' '); + } + + TypeTextualNotationBuilder.BuildMetadataBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..f0da2996 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MetadataUsageTextualNotationBuilder.cs @@ -0,0 +1,153 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MetadataUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PrefixMetadataUsage + /// PrefixMetadataUsage:MetadataUsage=ownedRelationship+=OwnedFeatureTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrefixMetadataUsage(SysML2.NET.Core.POCO.Systems.Metadata.IMetadataUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildOwnedFeatureTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataUsageDeclaration + /// MetadataUsageDeclaration:MetadataUsage=(Identification(':'|'typed''by'))?ownedRelationship+=OwnedFeatureTyping + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataUsageDeclaration(SysML2.NET.Core.POCO.Systems.Metadata.IMetadataUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(":"); + stringBuilder.Append(' '); + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeatureTyping elementAsFeatureTyping) + { + FeatureTypingTextualNotationBuilder.BuildOwnedFeatureTyping(elementAsFeatureTyping, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataUsage + /// MetadataUsage=UsageExtensionKeyword*('@'|'metadata')MetadataUsageDeclaration('about'ownedRelationship+=Annotation(','ownedRelationship+=Annotation)*)?MetadataBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataUsage(SysML2.NET.Core.POCO.Systems.Metadata.IMetadataUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.Append(" @ "); + stringBuilder.Append(' '); + BuildMetadataUsageDeclaration(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("about "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(' '); + } + + TypeTextualNotationBuilder.BuildMetadataBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MultiplicityRangeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MultiplicityRangeTextualNotationBuilder.cs new file mode 100644 index 00000000..5e018ae7 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MultiplicityRangeTextualNotationBuilder.cs @@ -0,0 +1,138 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MultiplicityRangeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedMultiplicityRange + /// OwnedMultiplicityRange:MultiplicityRange=MultiplicityBounds + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedMultiplicityRange(SysML2.NET.Core.POCO.Kernel.Multiplicities.IMultiplicityRange poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildMultiplicityBounds(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule MultiplicityBounds + /// MultiplicityBounds:MultiplicityRange='['(ownedRelationship+=MultiplicityExpressionMember'..')?ownedRelationship+=MultiplicityExpressionMember']' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMultiplicityBounds(SysML2.NET.Core.POCO.Kernel.Multiplicities.IMultiplicityRange poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("["); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildMultiplicityExpressionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(".. "); + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildMultiplicityExpressionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("]"); + + } + + /// + /// Builds the Textual Notation string for the rule MultiplicityRange + /// MultiplicityRange='['(ownedRelationship+=MultiplicityExpressionMember'..')?ownedRelationship+=MultiplicityExpressionMember']' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMultiplicityRange(SysML2.NET.Core.POCO.Kernel.Multiplicities.IMultiplicityRange poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("["); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildMultiplicityExpressionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(".. "); + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildMultiplicityExpressionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("]"); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MultiplicityTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MultiplicityTextualNotationBuilder.cs new file mode 100644 index 00000000..d05463ba --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/MultiplicityTextualNotationBuilder.cs @@ -0,0 +1,90 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class MultiplicityTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule EmptyMultiplicity + /// EmptyMultiplicity:Multiplicity={} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyMultiplicity(SysML2.NET.Core.POCO.Core.Types.IMultiplicity poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + + /// + /// Builds the Textual Notation string for the rule MultiplicitySubset + /// MultiplicitySubset:Multiplicity='multiplicity'IdentificationSubsetsTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMultiplicitySubset(SysML2.NET.Core.POCO.Core.Types.IMultiplicity poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("multiplicity "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + FeatureTextualNotationBuilder.BuildSubsets(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule Multiplicity + /// Multiplicity=MultiplicitySubset|MultiplicityRange + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMultiplicity(SysML2.NET.Core.POCO.Core.Types.IMultiplicity poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Kernel.Multiplicities.IMultiplicityRange pocoMultiplicityRange: + MultiplicityRangeTextualNotationBuilder.BuildMultiplicityRange(pocoMultiplicityRange, cursorCache, stringBuilder); + break; + default: + BuildMultiplicitySubset(poco, cursorCache, stringBuilder); + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceExposeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceExposeTextualNotationBuilder.cs new file mode 100644 index 00000000..3c2cd39d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceExposeTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class NamespaceExposeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule NamespaceExpose + /// NamespaceExpose=NamespaceImport + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespaceExpose(SysML2.NET.Core.POCO.Systems.Views.INamespaceExpose poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + NamespaceImportTextualNotationBuilder.BuildNamespaceImport(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceImportTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceImportTextualNotationBuilder.cs new file mode 100644 index 00000000..f18d4eeb --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceImportTextualNotationBuilder.cs @@ -0,0 +1,53 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class NamespaceImportTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule NamespaceImport + /// NamespaceImport=importedNamespace=[QualifiedName]'::''*'('::'isRecursive?='**')?|importedNamespace=FilterPackage{ownedRelatedElement+=importedNamespace} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespaceImport(SysML2.NET.Core.POCO.Root.Namespaces.INamespaceImport poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildNamespaceImportHandCoded(poco, cursorCache, stringBuilder); + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceTextualNotationBuilder.cs new file mode 100644 index 00000000..c8554508 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NamespaceTextualNotationBuilder.cs @@ -0,0 +1,178 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class NamespaceTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RootNamespace + /// RootNamespace:Namespace=PackageBodyElement* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRootNamespace(SysML2.NET.Core.POCO.Root.Namespaces.INamespace poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership elementFilterMembership: + ElementFilterMembershipTextualNotationBuilder.BuildElementFilterMember(elementFilterMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership owningMembership: + OwningMembershipTextualNotationBuilder.BuildPackageMember(owningMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IMembership membership: + MembershipTextualNotationBuilder.BuildAliasMember(membership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IImport import: + ImportTextualNotationBuilder.BuildImport(import, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + } + + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule NamespaceDeclaration + /// NamespaceDeclaration:Namespace='namespace'Identification + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespaceDeclaration(SysML2.NET.Core.POCO.Root.Namespaces.INamespace poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("namespace "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule NamespaceBody + /// NamespaceBody:Namespace=';'|'{'NamespaceBodyElement*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespaceBody(SysML2.NET.Core.POCO.Root.Namespaces.INamespace poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildNamespaceBodyElement(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule NamespaceBodyElement + /// NamespaceBodyElement:Namespace=ownedRelationship+=NamespaceMember|ownedRelationship+=AliasMember|ownedRelationship+=Import + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespaceBodyElement(SysML2.NET.Core.POCO.Root.Namespaces.INamespace poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership owningMembership: + OwningMembershipTextualNotationBuilder.BuildNamespaceMember(owningMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IMembership membership: + MembershipTextualNotationBuilder.BuildAliasMember(membership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IImport import: + ImportTextualNotationBuilder.BuildImport(import, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule Namespace + /// Namespace=(ownedRelationship+=PrefixMetadataMember)*NamespaceDeclarationNamespaceBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespace(SysML2.NET.Core.POCO.Root.Namespaces.INamespace poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + BuildNamespaceDeclaration(poco, cursorCache, stringBuilder); + BuildNamespaceBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NullExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NullExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..ffc2417c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/NullExpressionTextualNotationBuilder.cs @@ -0,0 +1,53 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class NullExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule NullExpression + /// NullExpression:NullExpression='null'|'('')' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNullExpression(SysML2.NET.Core.POCO.Kernel.Expressions.INullExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("null "); + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ObjectiveMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ObjectiveMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..28169797 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ObjectiveMembershipTextualNotationBuilder.cs @@ -0,0 +1,67 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ObjectiveMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ObjectiveMember + /// ObjectiveMember:ObjectiveMembership=MemberPrefix'objective'ownedRelatedElement+=ObjectiveRequirementUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildObjectiveMember(SysML2.NET.Core.POCO.Systems.Cases.IObjectiveMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("objective "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage elementAsRequirementUsage) + { + RequirementUsageTextualNotationBuilder.BuildObjectiveRequirementUsage(elementAsRequirementUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OccurrenceDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OccurrenceDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..ef0b560c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OccurrenceDefinitionTextualNotationBuilder.cs @@ -0,0 +1,146 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class OccurrenceDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OccurrenceDefinitionPrefix + /// OccurrenceDefinitionPrefix:OccurrenceDefinition=BasicDefinitionPrefix?(isIndividual?='individual'ownedRelationship+=EmptyMultiplicityMember)?DefinitionExtensionKeyword* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOccurrenceDefinitionPrefix(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + } + else if (poco.IsVariation) + { + stringBuilder.Append(" variation "); + } + + + if (poco.IsIndividual && ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(" individual "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildEmptyMultiplicityMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + while (ownedRelationshipCursor.Current != null) + { + DefinitionTextualNotationBuilder.BuildDefinitionExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule IndividualDefinition + /// IndividualDefinition:OccurrenceDefinition=BasicDefinitionPrefix?isIndividual?='individual'DefinitionExtensionKeyword*'def'DefinitionownedRelationship+=EmptyMultiplicityMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIndividualDefinition(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + } + else if (poco.IsVariation) + { + stringBuilder.Append(" variation "); + } + + if (poco.IsIndividual) + { + stringBuilder.Append(" individual "); + } + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + DefinitionTextualNotationBuilder.BuildDefinitionExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildEmptyMultiplicityMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OccurrenceDefinition + /// OccurrenceDefinition=OccurrenceDefinitionPrefix'occurrence''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOccurrenceDefinition(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("occurrence "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OccurrenceUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OccurrenceUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..848c84c7 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OccurrenceUsageTextualNotationBuilder.cs @@ -0,0 +1,181 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class OccurrenceUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OccurrenceUsagePrefix + /// OccurrenceUsagePrefix:OccurrenceUsage=BasicUsagePrefix(isIndividual?='individual')?(portionKind=PortionKind{isPortion=true})?UsageExtensionKeyword* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOccurrenceUsagePrefix(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildBasicUsagePrefix(poco, cursorCache, stringBuilder); + + if (poco.IsIndividual) + { + stringBuilder.Append(" individual "); + stringBuilder.Append(' '); + } + + + if (poco.PortionKind.HasValue) + { + stringBuilder.Append(poco.PortionKind.ToString().ToLower()); + // NonParsing Assignment Element : isPortion = true => Does not have to be process + stringBuilder.Append(' '); + } + + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule IndividualUsage + /// IndividualUsage:OccurrenceUsage=BasicUsagePrefixisIndividual?='individual'UsageExtensionKeyword*Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIndividualUsage(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildBasicUsagePrefix(poco, cursorCache, stringBuilder); + if (poco.IsIndividual) + { + stringBuilder.Append(" individual "); + } + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule PortionUsage + /// PortionUsage:OccurrenceUsage=BasicUsagePrefix(isIndividual?='individual')?portionKind=PortionKindUsageExtensionKeyword*Usage{isPortion=true} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPortionUsage(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildBasicUsagePrefix(poco, cursorCache, stringBuilder); + + if (poco.IsIndividual) + { + stringBuilder.Append(" individual "); + stringBuilder.Append(' '); + } + + stringBuilder.Append(poco.PortionKind.ToString().ToLower()); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + // NonParsing Assignment Element : isPortion = true => Does not have to be process + + } + + /// + /// Builds the Textual Notation string for the rule ControlNodePrefix + /// ControlNodePrefix:OccurrenceUsage=RefPrefix(isIndividual?='individual')?(portionKind=PortionKind{isPortion=true})?UsageExtensionKeyword* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildControlNodePrefix(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildRefPrefix(poco, cursorCache, stringBuilder); + + if (poco.IsIndividual) + { + stringBuilder.Append(" individual "); + stringBuilder.Append(' '); + } + + + if (poco.PortionKind.HasValue) + { + stringBuilder.Append(poco.PortionKind.ToString().ToLower()); + // NonParsing Assignment Element : isPortion = true => Does not have to be process + stringBuilder.Append(' '); + } + + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule OccurrenceUsage + /// OccurrenceUsage=OccurrenceUsagePrefix'occurrence'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOccurrenceUsage(SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("occurrence "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OperatorExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OperatorExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..8a488311 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OperatorExpressionTextualNotationBuilder.cs @@ -0,0 +1,407 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class OperatorExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConditionalExpression + /// ConditionalExpression:OperatorExpression=operator='if'ownedRelationship+=ArgumentMember'?'ownedRelationship+=ArgumentExpressionMember'else'ownedRelationship+=ArgumentExpressionMemberownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConditionalExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(poco.Operator); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("?"); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentExpressionMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("else "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentExpressionMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ConditionalBinaryOperatorExpression + /// ConditionalBinaryOperatorExpression:OperatorExpression=ownedRelationship+=ArgumentMemberoperator=ConditionalBinaryOperatorownedRelationship+=ArgumentExpressionMemberownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConditionalBinaryOperatorExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(poco.Operator); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentExpressionMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule BinaryOperatorExpression + /// BinaryOperatorExpression:OperatorExpression=ownedRelationship+=ArgumentMemberoperator=BinaryOperatorownedRelationship+=ArgumentMemberownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBinaryOperatorExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(poco.Operator); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule UnaryOperatorExpression + /// UnaryOperatorExpression:OperatorExpression=operator=UnaryOperatorownedRelationship+=ArgumentMemberownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUnaryOperatorExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(poco.Operator); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ClassificationExpression + /// ClassificationExpression:OperatorExpression=(ownedRelationship+=ArgumentMember)?(operator=ClassificationTestOperatorownedRelationship+=TypeReferenceMember|operator=CastOperatorownedRelationship+=TypeResultMember)ownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildClassificationExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + BuildClassificationExpressionHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetaclassificationExpression + /// MetaclassificationExpression:OperatorExpression=ownedRelationship+=MetadataArgumentMember(operator=ClassificationTestOperatorownedRelationship+=TypeReferenceMember|operator=MetaCastOperatorownedRelationship+=TypeResultMember)ownedRelationship+=EmptyResultMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetaclassificationExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildMetadataArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + BuildMetaclassificationExpressionHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership elementAsReturnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildEmptyResultMember(elementAsReturnParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ExtentExpression + /// ExtentExpression:OperatorExpression=operator='all'ownedRelationship+=TypeReferenceMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExtentExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(poco.Operator); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildTypeReferenceMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule BracketExpression + /// BracketExpression:OperatorExpression=ownedRelationship+=PrimaryArgumentMemberoperator='['ownedRelationship+=SequenceExpressionListMember']' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBracketExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildPrimaryArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(poco.Operator); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildSequenceExpressionListMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("]"); + + } + + /// + /// Builds the Textual Notation string for the rule SequenceOperatorExpression + /// SequenceOperatorExpression:OperatorExpression=ownedRelationship+=OwnedExpressionMemberoperator=','ownedRelationship+=SequenceExpressionListMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSequenceOperatorExpression(SysML2.NET.Core.POCO.Kernel.Expressions.IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildOwnedExpressionMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(poco.Operator); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IFeatureMembership elementAsFeatureMembership) + { + FeatureMembershipTextualNotationBuilder.BuildSequenceExpressionListMember(elementAsFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OwningMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OwningMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..d69b6e9d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/OwningMembershipTextualNotationBuilder.cs @@ -0,0 +1,454 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class OwningMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule AnnotatingMember + /// AnnotatingMember:OwningMembership=ownedRelatedElement+=AnnotatingElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAnnotatingMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotatingElement elementAsAnnotatingElement) + { + AnnotatingElementTextualNotationBuilder.BuildAnnotatingElement(elementAsAnnotatingElement, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PackageMember + /// PackageMember:OwningMembership=MemberPrefix(ownedRelatedElement+=DefinitionElement|ownedRelatedElement=UsageElement) + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPackageMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + if (ownedRelatedElementCursor.Current != null) + { + switch (ownedRelatedElementCursor.Current) + { + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage usage: + UsageTextualNotationBuilder.BuildUsageElement(usage, cursorCache, stringBuilder); + break; + case { } element: + ElementTextualNotationBuilder.BuildDefinitionElement(element, cursorCache, stringBuilder); + break; + } + ownedRelatedElementCursor.Move(); + } + + stringBuilder.Append(' '); + + } + + /// + /// Builds the Textual Notation string for the rule DefinitionMember + /// DefinitionMember:OwningMembership=MemberPrefixownedRelatedElement+=DefinitionElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinitionMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Root.Elements.IElement elementAsElement) + { + ElementTextualNotationBuilder.BuildDefinitionElement(elementAsElement, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedCrossFeatureMember + /// OwnedCrossFeatureMember:OwningMembership=ownedRelatedElement+=OwnedCrossFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedCrossFeatureMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildOwnedCrossFeature(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedMultiplicity + /// OwnedMultiplicity:OwningMembership=ownedRelatedElement+=MultiplicityRange + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedMultiplicity(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Multiplicities.IMultiplicityRange elementAsMultiplicityRange) + { + MultiplicityRangeTextualNotationBuilder.BuildMultiplicityRange(elementAsMultiplicityRange, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MultiplicityExpressionMember + /// MultiplicityExpressionMember:OwningMembership=ownedRelatedElement+=(LiteralExpression|FeatureReferenceExpression) + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMultiplicityExpressionMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + switch (ownedRelatedElementCursor.Current) + { + case SysML2.NET.Core.POCO.Kernel.Expressions.ILiteralExpression pocoLiteralExpression: + LiteralExpressionTextualNotationBuilder.BuildLiteralExpression(pocoLiteralExpression, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Kernel.Expressions.IFeatureReferenceExpression pocoFeatureReferenceExpression: + FeatureReferenceExpressionTextualNotationBuilder.BuildFeatureReferenceExpression(pocoFeatureReferenceExpression, cursorCache, stringBuilder); + break; + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EmptyMultiplicityMember + /// EmptyMultiplicityMember:OwningMembership=ownedRelatedElement+=EmptyMultiplicity + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyMultiplicityMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Types.IMultiplicity elementAsMultiplicity) + { + MultiplicityTextualNotationBuilder.BuildEmptyMultiplicity(elementAsMultiplicity, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ConjugatedPortDefinitionMember + /// ConjugatedPortDefinitionMember:OwningMembership=ownedRelatedElement+=ConjugatedPortDefinition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConjugatedPortDefinitionMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Ports.IConjugatedPortDefinition elementAsConjugatedPortDefinition) + { + ConjugatedPortDefinitionTextualNotationBuilder.BuildConjugatedPortDefinition(elementAsConjugatedPortDefinition, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedCrossMultiplicityMember + /// OwnedCrossMultiplicityMember:OwningMembership=ownedRelatedElement+=OwnedCrossMultiplicity + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedCrossMultiplicityMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedCrossMultiplicity(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule OwnedFeatureChainMember + /// OwnedFeatureChainMember:OwningMembership=ownedRelatedElement+=OwnedFeatureChain + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedFeatureChainMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule TransitionSuccessionMember + /// TransitionSuccessionMember:OwningMembership=ownedRelatedElement+=TransitionSuccession + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionSuccessionMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Connectors.ISuccession elementAsSuccession) + { + SuccessionTextualNotationBuilder.BuildTransitionSuccession(elementAsSuccession, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PrefixMetadataMember + /// PrefixMetadataMember:OwningMembership='#'ownedRelatedElement=PrefixMetadataUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrefixMetadataMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + stringBuilder.Append("#"); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Metadata.IMetadataUsage elementAsMetadataUsage) + { + MetadataUsageTextualNotationBuilder.BuildPrefixMetadataUsage(elementAsMetadataUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule NamespaceMember + /// NamespaceMember:OwningMembership=NonFeatureMember|NamespaceFeatureMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespaceMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership pocoOwningMembershipNonFeatureMember when pocoOwningMembershipNonFeatureMember.IsValidForNonFeatureMember(): + BuildNonFeatureMember(pocoOwningMembershipNonFeatureMember, cursorCache, stringBuilder); + break; + default: + BuildNamespaceFeatureMember(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule NonFeatureMember + /// NonFeatureMember:OwningMembership=MemberPrefixownedRelatedElement+=MemberElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonFeatureMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Root.Elements.IElement elementAsElement) + { + ElementTextualNotationBuilder.BuildMemberElement(elementAsElement, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule NamespaceFeatureMember + /// NamespaceFeatureMember:OwningMembership=MemberPrefixownedRelatedElement+=FeatureElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNamespaceFeatureMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureElement(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FeatureMember + /// FeatureMember:OwningMembership=TypeFeatureMember|OwnedFeatureMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFeatureMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Types.IFeatureMembership pocoFeatureMembership: + FeatureMembershipTextualNotationBuilder.BuildOwnedFeatureMember(pocoFeatureMembership, cursorCache, stringBuilder); + break; + default: + BuildTypeFeatureMember(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule TypeFeatureMember + /// TypeFeatureMember:OwningMembership=MemberPrefix'member'ownedRelatedElement+=FeatureElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeFeatureMember(SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("member "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureElement(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PackageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PackageTextualNotationBuilder.cs new file mode 100644 index 00000000..1d6eecdd --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PackageTextualNotationBuilder.cs @@ -0,0 +1,180 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PackageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PackageDeclaration + /// PackageDeclaration:Package='package'Identification + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPackageDeclaration(SysML2.NET.Core.POCO.Kernel.Packages.IPackage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("package "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule PackageBody + /// PackageBody:Package=';'|'{'PackageBodyElement*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPackageBody(SysML2.NET.Core.POCO.Kernel.Packages.IPackage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildPackageBodyElement(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule PackageBodyElement + /// PackageBodyElement:Package=ownedRelationship+=PackageMember|ownedRelationship+=ElementFilterMember|ownedRelationship+=AliasMember|ownedRelationship+=Import + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPackageBodyElement(SysML2.NET.Core.POCO.Kernel.Packages.IPackage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership elementFilterMembership: + ElementFilterMembershipTextualNotationBuilder.BuildElementFilterMember(elementFilterMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership owningMembership: + OwningMembershipTextualNotationBuilder.BuildPackageMember(owningMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IMembership membership: + MembershipTextualNotationBuilder.BuildAliasMember(membership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IImport import: + ImportTextualNotationBuilder.BuildImport(import, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule FilterPackage + /// FilterPackage:Package=ownedRelationship+=FilterPackageImport(ownedRelationship+=FilterPackageMember)+ + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFilterPackage(SysML2.NET.Core.POCO.Kernel.Packages.IPackage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + BuildFilterPackageImport(poco, cursorCache, stringBuilder); + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership elementAsElementFilterMembership) + { + ElementFilterMembershipTextualNotationBuilder.BuildFilterPackageMember(elementAsElementFilterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.Append(' '); + + } + + /// + /// Builds the Textual Notation string for the rule Package + /// Package=(ownedRelationship+=PrefixMetadataMember)*PackageDeclarationPackageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPackage(SysML2.NET.Core.POCO.Kernel.Packages.IPackage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + BuildPackageDeclaration(poco, cursorCache, stringBuilder); + BuildPackageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ParameterMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ParameterMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..10bc1187 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ParameterMembershipTextualNotationBuilder.cs @@ -0,0 +1,383 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ParameterMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule MessageEventMember + /// MessageEventMember:ParameterMembership=ownedRelatedElement+=MessageEvent + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMessageEventMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Occurrences.IEventOccurrenceUsage elementAsEventOccurrenceUsage) + { + EventOccurrenceUsageTextualNotationBuilder.BuildMessageEvent(elementAsEventOccurrenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PayloadParameterMember + /// PayloadParameterMember:ParameterMembership=ownedRelatedElement+=PayloadParameter + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPayloadParameterMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildPayloadParameter(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ArgumentMember + /// ArgumentMember:ParameterMembership=ownedMemberParameter=Argument + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildArgumentMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberParameter != null) + { + FeatureTextualNotationBuilder.BuildArgument(poco.ownedMemberParameter, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ArgumentExpressionMember + /// ArgumentExpressionMember:ParameterMembership=ownedRelatedElement+=ArgumentExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildArgumentExpressionMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildArgumentExpression(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule NodeParameterMember + /// NodeParameterMember:ParameterMembership=ownedRelatedElement+=NodeParameter + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNodeParameterMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildNodeParameter(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EmptyParameterMember + /// EmptyParameterMember:ParameterMembership=ownedRelatedElement+=EmptyUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyParameterMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildEmptyUsage(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule AssignmentTargetMember + /// AssignmentTargetMember:ParameterMembership=ownedRelatedElement+=AssignmentTargetParameter + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssignmentTargetMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildAssignmentTargetParameter(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ExpressionParameterMember + /// ExpressionParameterMember:ParameterMembership=ownedRelatedElement+=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExpressionParameterMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ActionBodyParameterMember + /// ActionBodyParameterMember:ParameterMembership=ownedRelatedElement+=ActionBodyParameter + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionBodyParameterMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IActionUsage elementAsActionUsage) + { + ActionUsageTextualNotationBuilder.BuildActionBodyParameter(elementAsActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule IfNodeParameterMember + /// IfNodeParameterMember:ParameterMembership=ownedRelatedElement+=IfNode + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIfNodeParameterMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IIfActionUsage elementAsIfActionUsage) + { + IfActionUsageTextualNotationBuilder.BuildIfNode(elementAsIfActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataArgumentMember + /// MetadataArgumentMember:ParameterMembership=ownedRelatedElement+=MetadataArgument + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataArgumentMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildMetadataArgument(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule TypeReferenceMember + /// TypeReferenceMember:ParameterMembership=ownedMemberFeature=TypeReference + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeReferenceMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberFeature != null) + { + FeatureTextualNotationBuilder.BuildTypeReference(poco.ownedMemberFeature, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule PrimaryArgumentMember + /// PrimaryArgumentMember:ParameterMembership=ownedMemberParameter=PrimaryArgument + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPrimaryArgumentMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberParameter != null) + { + FeatureTextualNotationBuilder.BuildPrimaryArgument(poco.ownedMemberParameter, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule NonFeatureChainPrimaryArgumentMember + /// NonFeatureChainPrimaryArgumentMember:ParameterMembership=ownedMemberParameter=PrimaryArgument + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonFeatureChainPrimaryArgumentMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberParameter != null) + { + FeatureTextualNotationBuilder.BuildPrimaryArgument(poco.ownedMemberParameter, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule BodyArgumentMember + /// BodyArgumentMember:ParameterMembership=ownedMemberParameter=BodyArgument + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBodyArgumentMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberParameter != null) + { + FeatureTextualNotationBuilder.BuildBodyArgument(poco.ownedMemberParameter, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule FunctionReferenceArgumentMember + /// FunctionReferenceArgumentMember:ParameterMembership=ownedMemberParameter=FunctionReferenceArgument + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionReferenceArgumentMember(SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.ownedMemberParameter != null) + { + FeatureTextualNotationBuilder.BuildFunctionReferenceArgument(poco.ownedMemberParameter, cursorCache, stringBuilder); + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PartDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PartDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..bbcfc8cf --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PartDefinitionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PartDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PartDefinition + /// PartDefinition=OccurrenceDefinitionPrefix'part''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPartDefinition(SysML2.NET.Core.POCO.Systems.Parts.IPartDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("part "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PartUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PartUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..31811e10 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PartUsageTextualNotationBuilder.cs @@ -0,0 +1,98 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PartUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ActorUsage + /// ActorUsage:PartUsage='actor'UsageExtensionKeyword*Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActorUsage(SysML2.NET.Core.POCO.Systems.Parts.IPartUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("actor "); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule StakeholderUsage + /// StakeholderUsage:PartUsage='stakeholder'UsageExtensionKeyword*Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStakeholderUsage(SysML2.NET.Core.POCO.Systems.Parts.IPartUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("stakeholder "); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule PartUsage + /// PartUsage=OccurrenceUsagePrefix'part'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPartUsage(SysML2.NET.Core.POCO.Systems.Parts.IPartUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("part "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PayloadFeatureTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PayloadFeatureTextualNotationBuilder.cs new file mode 100644 index 00000000..a09fe8cc --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PayloadFeatureTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PayloadFeatureTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FlowPayloadFeature + /// FlowPayloadFeature:PayloadFeature=PayloadFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowPayloadFeature(SysML2.NET.Core.POCO.Kernel.Interactions.IPayloadFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + FeatureTextualNotationBuilder.BuildPayloadFeature(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PerformActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PerformActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..9f683114 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PerformActionUsageTextualNotationBuilder.cs @@ -0,0 +1,118 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PerformActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PerformActionUsageDeclaration + /// PerformActionUsageDeclaration:PerformActionUsage=(ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?|'action'UsageDeclaration)ValuePart? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPerformActionUsageDeclaration(SysML2.NET.Core.POCO.Systems.Actions.IPerformActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildPerformActionUsageDeclarationHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule StatePerformActionUsage + /// StatePerformActionUsage:PerformActionUsage=PerformActionUsageDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStatePerformActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IPerformActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildPerformActionUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule TransitionPerformActionUsage + /// TransitionPerformActionUsage:PerformActionUsage=PerformActionUsageDeclaration('{'ActionBodyItem*'}')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionPerformActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IPerformActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildPerformActionUsageDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.importedMembership.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsVariation || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.isReference || poco.IsIndividual || poco.PortionKind.HasValue || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildActionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.AppendLine("}"); + } + + + } + + /// + /// Builds the Textual Notation string for the rule PerformActionUsage + /// PerformActionUsage=OccurrenceUsagePrefix'perform'PerformActionUsageDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPerformActionUsage(SysML2.NET.Core.POCO.Systems.Actions.IPerformActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("perform "); + BuildPerformActionUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortConjugationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortConjugationTextualNotationBuilder.cs new file mode 100644 index 00000000..ecd35fe2 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortConjugationTextualNotationBuilder.cs @@ -0,0 +1,53 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PortConjugationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PortConjugation + /// PortConjugation={} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPortConjugation(SysML2.NET.Core.POCO.Systems.Ports.IPortConjugation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..cc593801 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortDefinitionTextualNotationBuilder.cs @@ -0,0 +1,70 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PortDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PortDefinition + /// PortDefinition=DefinitionPrefix'port''def'DefinitionownedRelationship+=ConjugatedPortDefinitionMember{conjugatedPortDefinition.ownedPortConjugator.originalPortDefinition=this} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPortDefinition(SysML2.NET.Core.POCO.Systems.Ports.IPortDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + DefinitionTextualNotationBuilder.BuildDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("port "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildConjugatedPortDefinitionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + // NonParsing Assignment Element : conjugatedPortDefinition.ownedPortConjugator.originalPortDefinition = this => Does not have to be process + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..585f17d3 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortUsageTextualNotationBuilder.cs @@ -0,0 +1,120 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PortUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule DefaultInterfaceEnd + /// DefaultInterfaceEnd:PortUsage=isEnd?='end'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefaultInterfaceEnd(SysML2.NET.Core.POCO.Systems.Ports.IPortUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.IsEnd) + { + stringBuilder.Append(" end "); + } + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceEnd + /// InterfaceEnd:PortUsage=(ownedRelationship+=OwnedCrossMultiplicityMember)?(declaredName=NAMEREFERENCES)?ownedRelationship+=OwnedReferenceSubsetting + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceEnd(SysML2.NET.Core.POCO.Systems.Ports.IPortUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildOwnedCrossMultiplicityMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + + if (!string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append(poco.DeclaredName); + stringBuilder.Append(" ::> "); + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting elementAsReferenceSubsetting) + { + ReferenceSubsettingTextualNotationBuilder.BuildOwnedReferenceSubsetting(elementAsReferenceSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PortUsage + /// PortUsage=OccurrenceUsagePrefix'port'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPortUsage(SysML2.NET.Core.POCO.Systems.Ports.IPortUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("port "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortionKindTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortionKindTextualNotationBuilder.cs new file mode 100644 index 00000000..e460904b --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PortionKindTextualNotationBuilder.cs @@ -0,0 +1,53 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PortionKindTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PortionKind + /// PortionKind='snapshot'|'timeslice' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPortionKind(SysML2.NET.Core.Systems.Occurrences.PortionKind poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PredicateTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PredicateTextualNotationBuilder.cs new file mode 100644 index 00000000..fb839a5c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/PredicateTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class PredicateTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Predicate + /// Predicate=TypePrefix'predicate'ClassifierDeclarationFunctionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPredicate(SysML2.NET.Core.POCO.Kernel.Functions.IPredicate poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("predicate "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildFunctionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RedefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RedefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..1a610499 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RedefinitionTextualNotationBuilder.cs @@ -0,0 +1,123 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RedefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedRedefinition + /// OwnedRedefinition:Redefinition=redefinedFeature=[QualifiedName]|redefinedFeature=OwnedFeatureChain{ownedRelatedElement+=redefinedFeature} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedRedefinition(SysML2.NET.Core.POCO.Core.Features.IRedefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.RedefinedFeature) && poco.RedefinedFeature is SysML2.NET.Core.POCO.Core.Features.IFeature chainedRedefinedFeatureAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedRedefinedFeatureAsFeature, cursorCache, stringBuilder); + } + else if (poco.RedefinedFeature != null) + { + stringBuilder.Append(poco.RedefinedFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule FlowFeatureRedefinition + /// FlowFeatureRedefinition:Redefinition=redefinedFeature=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowFeatureRedefinition(SysML2.NET.Core.POCO.Core.Features.IRedefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.RedefinedFeature != null) + { + stringBuilder.Append(poco.RedefinedFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule ParameterRedefinition + /// ParameterRedefinition:Redefinition=redefinedFeature=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildParameterRedefinition(SysML2.NET.Core.POCO.Core.Features.IRedefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.RedefinedFeature != null) + { + stringBuilder.Append(poco.RedefinedFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule Redefinition + /// Redefinition=('specialization'Identification)?'redefinition'SpecificTypeREDEFINESGeneralTypeRelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRedefinition(SysML2.NET.Core.POCO.Core.Features.IRedefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("specialization "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("redefinition "); + SpecializationTextualNotationBuilder.BuildSpecificType(poco, cursorCache, stringBuilder); + stringBuilder.Append(" :>> "); + SpecializationTextualNotationBuilder.BuildGeneralType(poco, cursorCache, stringBuilder); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReferenceSubsettingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReferenceSubsettingTextualNotationBuilder.cs new file mode 100644 index 00000000..2dff810c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReferenceSubsettingTextualNotationBuilder.cs @@ -0,0 +1,83 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ReferenceSubsettingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedReferenceSubsetting + /// OwnedReferenceSubsetting:ReferenceSubsetting=referencedFeature=[QualifiedName]|referencedFeature=OwnedFeatureChain{ownedRelatedElement+=referenceFeature} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedReferenceSubsetting(SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.ReferencedFeature) && poco.ReferencedFeature is SysML2.NET.Core.POCO.Core.Features.IFeature chainedReferencedFeatureAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedReferencedFeatureAsFeature, cursorCache, stringBuilder); + } + else if (poco.ReferencedFeature != null) + { + stringBuilder.Append(poco.ReferencedFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule FlowEndSubsetting + /// FlowEndSubsetting:ReferenceSubsetting=referencedFeature=[QualifiedName]|referencedFeature=FeatureChainPrefix{ownedRelatedElement+=referencedFeature} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowEndSubsetting(SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.ReferencedFeature) && poco.ReferencedFeature is SysML2.NET.Core.POCO.Core.Features.IFeature chainedReferencedFeatureAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureChainPrefix(chainedReferencedFeatureAsFeature, cursorCache, stringBuilder); + } + else if (poco.ReferencedFeature != null) + { + stringBuilder.Append(poco.ReferencedFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReferenceUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReferenceUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..3efecd68 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReferenceUsageTextualNotationBuilder.cs @@ -0,0 +1,406 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ReferenceUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedCrossFeature + /// OwnedCrossFeature:ReferenceUsage=BasicUsagePrefixUsageDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedCrossFeature(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildBasicUsagePrefix(poco, cursorCache, stringBuilder); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule DefaultReferenceUsage + /// DefaultReferenceUsage:ReferenceUsage=RefPrefixUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefaultReferenceUsage(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildRefPrefix(poco, cursorCache, stringBuilder); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule VariantReference + /// VariantReference:ReferenceUsage=ownedRelationship+=OwnedReferenceSubsettingFeatureSpecialization*UsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildVariantReference(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting elementAsReferenceSubsetting) + { + ReferenceSubsettingTextualNotationBuilder.BuildOwnedReferenceSubsetting(elementAsReferenceSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + while (ownedRelationshipCursor.Current is not null and not SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage) + { + FeatureTextualNotationBuilder.BuildFeatureSpecialization(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + UsageTextualNotationBuilder.BuildUsageBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule SourceEnd + /// SourceEnd:ReferenceUsage=(ownedRelationship+=OwnedMultiplicity)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSourceEnd(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildOwnedMultiplicity(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + } + + + } + + /// + /// Builds the Textual Notation string for the rule ConnectorEnd + /// ConnectorEnd:ReferenceUsage=(ownedRelationship+=OwnedCrossMultiplicityMember)?(declaredName=NAMEREFERENCES)?ownedRelationship+=OwnedReferenceSubsetting + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConnectorEnd(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildOwnedCrossMultiplicityMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + + if (!string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append(poco.DeclaredName); + stringBuilder.Append(" ::> "); + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IReferenceSubsetting elementAsReferenceSubsetting) + { + ReferenceSubsettingTextualNotationBuilder.BuildOwnedReferenceSubsetting(elementAsReferenceSubsetting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule FlowFeature + /// FlowFeature:ReferenceUsage=ownedRelationship+=FlowFeatureRedefinition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFlowFeature(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IRedefinition elementAsRedefinition) + { + RedefinitionTextualNotationBuilder.BuildFlowFeatureRedefinition(elementAsRedefinition, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule PayloadParameter + /// PayloadParameter:ReferenceUsage=PayloadFeature|IdentificationPayloadFeatureSpecializationPart?TriggerValuePart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildPayloadParameter(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildPayloadParameterHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule NodeParameter + /// NodeParameter:ReferenceUsage=ownedRelationship+=FeatureBinding + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNodeParameter(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildFeatureBinding(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EmptyUsage + /// EmptyUsage:ReferenceUsage={} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyUsage(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + + /// + /// Builds the Textual Notation string for the rule AssignmentTargetParameter + /// AssignmentTargetParameter:ReferenceUsage=(ownedRelationship+=AssignmentTargetBinding'.')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildAssignmentTargetParameter(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildAssignmentTargetBinding(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + stringBuilder.Append("."); + } + + + } + + /// + /// Builds the Textual Notation string for the rule ForVariableDeclaration + /// ForVariableDeclaration:ReferenceUsage=UsageDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildForVariableDeclaration(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule EmptyFeature + /// EmptyFeature:ReferenceUsage={} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyFeature(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + + /// + /// Builds the Textual Notation string for the rule SubjectUsage + /// SubjectUsage:ReferenceUsage='subject'UsageExtensionKeyword*Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSubjectUsage(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("subject "); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule SatisfactionParameter + /// SatisfactionParameter:ReferenceUsage=ownedRelationship+=SatisfactionFeatureValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSatisfactionParameter(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.FeatureValues.IFeatureValue elementAsFeatureValue) + { + FeatureValueTextualNotationBuilder.BuildSatisfactionFeatureValue(elementAsFeatureValue, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule MetadataBodyUsage + /// MetadataBodyUsage:ReferenceUsage='ref'?(':>>'|'redefines')?ownedRelationship+=OwnedRedefinitionFeatureSpecializationPart?ValuePart?MetadataBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataBodyUsage(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("ref "); + stringBuilder.Append(" :>> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IRedefinition elementAsRedefinition) + { + RedefinitionTextualNotationBuilder.BuildOwnedRedefinition(elementAsRedefinition, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + FeatureTextualNotationBuilder.BuildFeatureSpecializationPart(poco, cursorCache, stringBuilder); + } + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildMetadataBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule ReferenceUsage + /// ReferenceUsage=(EndUsagePrefix|RefPrefix)'ref'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildReferenceUsage(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage pocoUsageRefPrefix when pocoUsageRefPrefix.IsDerived: + UsageTextualNotationBuilder.BuildRefPrefix(pocoUsageRefPrefix, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage pocoUsage: + UsageTextualNotationBuilder.BuildEndUsagePrefix(pocoUsage, cursorCache, stringBuilder); + break; + } + + stringBuilder.Append(' '); + stringBuilder.Append("ref "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RelationshipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RelationshipTextualNotationBuilder.cs new file mode 100644 index 00000000..5f2b2d62 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RelationshipTextualNotationBuilder.cs @@ -0,0 +1,90 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RelationshipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RelationshipBody + /// RelationshipBody:Relationship=';'|'{'(ownedRelationship+=OwnedAnnotation)*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRelationshipBody(SysML2.NET.Core.POCO.Root.Elements.IRelationship poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.AppendLine("{"); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Annotations.IAnnotation elementAsAnnotation) + { + AnnotationTextualNotationBuilder.BuildOwnedAnnotation(elementAsAnnotation, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule RelationshipOwnedElement + /// RelationshipOwnedElement:Relationship=ownedRelatedElement+=OwnedRelatedElement|ownedRelationship+=OwnedAnnotation + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRelationshipOwnedElement(SysML2.NET.Core.POCO.Root.Elements.IRelationship poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildRelationshipOwnedElementHandCoded(poco, cursorCache, stringBuilder); + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RenderingDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RenderingDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..adc81b9d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RenderingDefinitionTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RenderingDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RenderingDefinition + /// RenderingDefinition=OccurrenceDefinitionPrefix'rendering''def'Definition + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRenderingDefinition(SysML2.NET.Core.POCO.Systems.Views.IRenderingDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("rendering "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinition(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RenderingUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RenderingUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..518f1e91 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RenderingUsageTextualNotationBuilder.cs @@ -0,0 +1,68 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RenderingUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ViewRenderingUsage + /// ViewRenderingUsage:RenderingUsage=ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?UsageBody|(UsageExtensionKeyword*'rendering'|UsageExtensionKeyword+)Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewRenderingUsage(SysML2.NET.Core.POCO.Systems.Views.IRenderingUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildViewRenderingUsageHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule RenderingUsage + /// RenderingUsage=OccurrenceUsagePrefix'rendering'Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRenderingUsage(SysML2.NET.Core.POCO.Systems.Views.IRenderingUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("rendering "); + UsageTextualNotationBuilder.BuildUsage(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementConstraintMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementConstraintMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..7248623e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementConstraintMembershipTextualNotationBuilder.cs @@ -0,0 +1,92 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RequirementConstraintMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RequirementConstraintMember + /// RequirementConstraintMember:RequirementConstraintMembership=MemberPrefix?RequirementKindownedRelatedElement+=RequirementConstraintUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementConstraintMember(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementConstraintMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (poco.Visibility != SysML2.NET.Core.Root.Namespaces.VisibilityKind.Public) + { + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + } + BuildRequirementKind(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Constraints.IConstraintUsage elementAsConstraintUsage) + { + ConstraintUsageTextualNotationBuilder.BuildRequirementConstraintUsage(elementAsConstraintUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule RequirementKind + /// RequirementKind:RequirementConstraintMembership='assume'{kind='assumption'}|'require'{kind='requirement'} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementKind(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementConstraintMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco.Kind) + { + case SysML2.NET.Core.Systems.Requirements.RequirementConstraintKind.Assumption: + stringBuilder.Append("assume "); + break; + case SysML2.NET.Core.Systems.Requirements.RequirementConstraintKind.Requirement: + stringBuilder.Append("require "); + break; + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..39e22bcd --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RequirementDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RequirementDefinition + /// RequirementDefinition=OccurrenceDefinitionPrefix'requirement''def'DefinitionDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementDefinition(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("requirement "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..ea6dfefd --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementUsageTextualNotationBuilder.cs @@ -0,0 +1,90 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RequirementUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ObjectiveRequirementUsage + /// ObjectiveRequirementUsage:RequirementUsage=UsageExtensionKeyword*ConstraintUsageDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildObjectiveRequirementUsage(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + UsageTextualNotationBuilder.BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + ConstraintUsageTextualNotationBuilder.BuildConstraintUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule RequirementVerificationUsage + /// RequirementVerificationUsage:RequirementUsage=ownedRelationship+=OwnedReferenceSubsettingFeatureSpecialization*RequirementBody|(UsageExtensionKeyword*'requirement'|UsageExtensionKeyword+)ConstraintUsageDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementVerificationUsage(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildRequirementVerificationUsageHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule RequirementUsage + /// RequirementUsage=OccurrenceUsagePrefix'requirement'ConstraintUsageDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementUsage(SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("requirement "); + ConstraintUsageTextualNotationBuilder.BuildConstraintUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementVerificationMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementVerificationMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..24b94a20 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/RequirementVerificationMembershipTextualNotationBuilder.cs @@ -0,0 +1,68 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class RequirementVerificationMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RequirementVerificationMember + /// RequirementVerificationMember:RequirementVerificationMembership=MemberPrefix'verify'{kind='requirement'}ownedRelatedElement+=RequirementVerificationUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementVerificationMember(SysML2.NET.Core.POCO.Systems.VerificationCases.IRequirementVerificationMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("verify "); + // NonParsing Assignment Element : kind = 'requirement' => Does not have to be process + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage elementAsRequirementUsage) + { + RequirementUsageTextualNotationBuilder.BuildRequirementVerificationUsage(elementAsRequirementUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ResultExpressionMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ResultExpressionMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..6538bc01 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ResultExpressionMembershipTextualNotationBuilder.cs @@ -0,0 +1,70 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ResultExpressionMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ResultExpressionMember + /// ResultExpressionMember:ResultExpressionMembership=MemberPrefix?ownedRelatedElement+=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildResultExpressionMember(SysML2.NET.Core.POCO.Kernel.Functions.IResultExpressionMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (poco.Visibility != SysML2.NET.Core.Root.Namespaces.VisibilityKind.Public) + { + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + } + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReturnParameterMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReturnParameterMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..7d5ae9db --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ReturnParameterMembershipTextualNotationBuilder.cs @@ -0,0 +1,145 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ReturnParameterMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ReturnParameterMember + /// ReturnParameterMember:ReturnParameterMembership=MemberPrefix?'return'ownedRelatedElement+=UsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildReturnParameterMember(SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (poco.Visibility != SysML2.NET.Core.Root.Namespaces.VisibilityKind.Public) + { + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + } + stringBuilder.Append("return "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage elementAsUsage) + { + UsageTextualNotationBuilder.BuildUsageElement(elementAsUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ReturnFeatureMember + /// ReturnFeatureMember:ReturnParameterMembership=MemberPrefix'return'ownedRelatedElement+=FeatureElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildReturnFeatureMember(SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("return "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildFeatureElement(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EmptyResultMember + /// EmptyResultMember:ReturnParameterMembership=ownedRelatedElement+=EmptyFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEmptyResultMember(SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildEmptyFeature(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ConstructorResultMember + /// ConstructorResultMember:ReturnParameterMembership=ownedRelatedElement+=ConstructorResult + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConstructorResultMember(SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildConstructorResult(elementAsFeature, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SatisfyRequirementUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SatisfyRequirementUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..81bffbeb --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SatisfyRequirementUsageTextualNotationBuilder.cs @@ -0,0 +1,84 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SatisfyRequirementUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SatisfyRequirementUsage + /// SatisfyRequirementUsage=OccurrenceUsagePrefix'assert'(isNegated?='not')'satisfy'(ownedRelationship+=OwnedReferenceSubsettingFeatureSpecializationPart?|'requirement'UsageDeclaration)ValuePart?('by'ownedRelationship+=SatisfactionSubjectMember)?RequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSatisfyRequirementUsage(SysML2.NET.Core.POCO.Systems.Requirements.ISatisfyRequirementUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("assert "); + stringBuilder.Append(" not "); + + stringBuilder.Append(' '); + stringBuilder.Append("satisfy "); + BuildSatisfyRequirementUsageHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + if (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("by "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.ISubjectMembership elementAsSubjectMembership) + { + SubjectMembershipTextualNotationBuilder.BuildSatisfactionSubjectMember(elementAsSubjectMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SelectExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SelectExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..fa9232d8 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SelectExpressionTextualNotationBuilder.cs @@ -0,0 +1,77 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SelectExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SelectExpression + /// SelectExpression=ownedRelationship+=PrimaryArgumentMember'.?'ownedRelationship+=BodyArgumentMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSelectExpression(SysML2.NET.Core.POCO.Kernel.Expressions.ISelectExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildPrimaryArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append(".? "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildBodyArgumentMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SendActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SendActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..2e91c5af --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SendActionUsageTextualNotationBuilder.cs @@ -0,0 +1,151 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SendActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SendNode + /// SendNode:SendActionUsage=OccurrenceUsagePrefixActionUsageDeclaration?'send'(ownedRelationship+=NodeParameterMemberSenderReceiverPart?|ownedRelationship+=EmptyParameterMemberSenderReceiverPart)?ActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSendNode(SysML2.NET.Core.POCO.Systems.Actions.ISendActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsVariation || poco.IsConstant || poco.IsEnd || poco.isReference || poco.IsIndividual || poco.PortionKind.HasValue || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + ActionUsageTextualNotationBuilder.BuildActionUsageDeclaration(poco, cursorCache, stringBuilder); + } + stringBuilder.Append("send "); + BuildSendNodeHandCoded(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule SendNodeDeclaration + /// SendNodeDeclaration:SendActionUsage=ActionNodeUsageDeclaration?'send'ownedRelationship+=NodeParameterMemberSenderReceiverPart? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSendNodeDeclaration(SysML2.NET.Core.POCO.Systems.Actions.ISendActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + ActionUsageTextualNotationBuilder.BuildActionNodeUsageDeclaration(poco, cursorCache, stringBuilder); + } + stringBuilder.Append("send "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildNodeParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsVariation || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.isReference || poco.IsIndividual || poco.PortionKind.HasValue || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + BuildSenderReceiverPart(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule SenderReceiverPart + /// SenderReceiverPart:SendActionUsage='via'ownedRelationship+=NodeParameterMember('to'ownedRelationship+=NodeParameterMember)?|ownedRelationship+=EmptyParameterMember'to'ownedRelationship+=NodeParameterMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSenderReceiverPart(SysML2.NET.Core.POCO.Systems.Actions.ISendActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildSenderReceiverPartHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule StateSendActionUsage + /// StateSendActionUsage:SendActionUsage=SendNodeDeclarationActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateSendActionUsage(SysML2.NET.Core.POCO.Systems.Actions.ISendActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildSendNodeDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule TransitionSendActionUsage + /// TransitionSendActionUsage:SendActionUsage=SendNodeDeclaration('{'ActionBodyItem*'}')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionSendActionUsage(SysML2.NET.Core.POCO.Systems.Actions.ISendActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildSendNodeDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.importedMembership.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsVariation || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.isReference || poco.IsIndividual || poco.PortionKind.HasValue || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildActionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + stringBuilder.AppendLine("}"); + } + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SpecializationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SpecializationTextualNotationBuilder.cs new file mode 100644 index 00000000..d4b269fc --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SpecializationTextualNotationBuilder.cs @@ -0,0 +1,121 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SpecializationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedSpecialization + /// OwnedSpecialization:Specialization=GeneralType + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedSpecialization(SysML2.NET.Core.POCO.Core.Types.ISpecialization poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildGeneralType(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule SpecificType + /// SpecificType:Specialization=specific=[QualifiedName]|specific+=OwnedFeatureChain{ownedRelatedElement+=specific} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSpecificType(SysML2.NET.Core.POCO.Core.Types.ISpecialization poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.Specific) && poco.Specific is SysML2.NET.Core.POCO.Core.Features.IFeature chainedSpecificAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedSpecificAsFeature, cursorCache, stringBuilder); + } + else if (poco.Specific != null) + { + stringBuilder.Append(poco.Specific.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule GeneralType + /// GeneralType:Specialization=general=[QualifiedName]|general+=OwnedFeatureChain{ownedRelatedElement+=general} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildGeneralType(SysML2.NET.Core.POCO.Core.Types.ISpecialization poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.General) && poco.General is SysML2.NET.Core.POCO.Core.Features.IFeature chainedGeneralAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedGeneralAsFeature, cursorCache, stringBuilder); + } + else if (poco.General != null) + { + stringBuilder.Append(poco.General.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule Specialization + /// Specialization=('specialization'Identification)?'subtype'SpecificTypeSPECIALIZESGeneralTypeRelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSpecialization(SysML2.NET.Core.POCO.Core.Types.ISpecialization poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("specialization "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("subtype "); + BuildSpecificType(poco, cursorCache, stringBuilder); + stringBuilder.Append(" :> "); + BuildGeneralType(poco, cursorCache, stringBuilder); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StakeholderMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StakeholderMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..60bc3e9c --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StakeholderMembershipTextualNotationBuilder.cs @@ -0,0 +1,66 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class StakeholderMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule StakeholderMember + /// StakeholderMember:StakeholderMembership=MemberPrefixownedRelatedElement+=StakeholderUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStakeholderMember(SysML2.NET.Core.POCO.Systems.Requirements.IStakeholderMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Parts.IPartUsage elementAsPartUsage) + { + PartUsageTextualNotationBuilder.BuildStakeholderUsage(elementAsPartUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..23505e72 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateDefinitionTextualNotationBuilder.cs @@ -0,0 +1,92 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class StateDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule StateDefBody + /// StateDefBody:StateDefinition=';'|(isParallel?='parallel')?'{'StateBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateDefBody(SysML2.NET.Core.POCO.Systems.States.IStateDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + + if (poco.IsParallel) + { + stringBuilder.Append(" parallel "); + stringBuilder.Append(' '); + } + + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildStateBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule StateDefinition + /// StateDefinition=OccurrenceDefinitionPrefix'state''def'DefinitionDeclarationStateDefBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateDefinition(SysML2.NET.Core.POCO.Systems.States.IStateDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("state "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + BuildStateDefBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateSubactionMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateSubactionMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..9a556d49 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateSubactionMembershipTextualNotationBuilder.cs @@ -0,0 +1,119 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class StateSubactionMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule EntryActionMember + /// EntryActionMember:StateSubactionMembership=MemberPrefixkind='entry'ownedRelatedElement+=StateActionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEntryActionMember(SysML2.NET.Core.POCO.Systems.States.IStateSubactionMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append(poco.Kind.ToString().ToLower()); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IActionUsage elementAsActionUsage) + { + ActionUsageTextualNotationBuilder.BuildStateActionUsage(elementAsActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule DoActionMember + /// DoActionMember:StateSubactionMembership=MemberPrefixkind='do'ownedRelatedElement+=StateActionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDoActionMember(SysML2.NET.Core.POCO.Systems.States.IStateSubactionMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append(poco.Kind.ToString().ToLower()); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IActionUsage elementAsActionUsage) + { + ActionUsageTextualNotationBuilder.BuildStateActionUsage(elementAsActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule ExitActionMember + /// ExitActionMember:StateSubactionMembership=MemberPrefixkind='exit'ownedRelatedElement+=StateActionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExitActionMember(SysML2.NET.Core.POCO.Systems.States.IStateSubactionMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append(poco.Kind.ToString().ToLower()); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IActionUsage elementAsActionUsage) + { + ActionUsageTextualNotationBuilder.BuildStateActionUsage(elementAsActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..487ab23f --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StateUsageTextualNotationBuilder.cs @@ -0,0 +1,91 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class StateUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule StateUsageBody + /// StateUsageBody:StateUsage=';'|(isParallel?='parallel')?'{'StateBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateUsageBody(SysML2.NET.Core.POCO.Systems.States.IStateUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + + if (poco.IsParallel) + { + stringBuilder.Append(" parallel "); + stringBuilder.Append(' '); + } + + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + TypeTextualNotationBuilder.BuildStateBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule StateUsage + /// StateUsage=OccurrenceUsagePrefix'state'ActionUsageDeclarationStateUsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateUsage(SysML2.NET.Core.POCO.Systems.States.IStateUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("state "); + ActionUsageTextualNotationBuilder.BuildActionUsageDeclaration(poco, cursorCache, stringBuilder); + BuildStateUsageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StepTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StepTextualNotationBuilder.cs new file mode 100644 index 00000000..747963d4 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StepTextualNotationBuilder.cs @@ -0,0 +1,80 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class StepTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Step + /// Step=FeaturePrefix'step'FeatureDeclarationValuePart?TypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStep(SysML2.NET.Core.POCO.Kernel.Behaviors.IStep poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("step "); + FeatureTextualNotationBuilder.BuildFeatureDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StructureTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StructureTextualNotationBuilder.cs new file mode 100644 index 00000000..97caa43e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/StructureTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class StructureTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Structure + /// Structure=TypePrefix'struct'ClassifierDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStructure(SysML2.NET.Core.POCO.Kernel.Structures.IStructure poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("struct "); + ClassifierTextualNotationBuilder.BuildClassifierDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubclassificationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubclassificationTextualNotationBuilder.cs new file mode 100644 index 00000000..3f740536 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubclassificationTextualNotationBuilder.cs @@ -0,0 +1,94 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SubclassificationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedSubclassification + /// OwnedSubclassification:Subclassification=superClassifier=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedSubclassification(SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.Superclassifier != null) + { + stringBuilder.Append(poco.Superclassifier.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule Subclassification + /// Subclassification=('specialization'Identification)?'subclassifier'subclassifier=[QualifiedName]SPECIALIZESsuperclassifier=[QualifiedName]RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSubclassification(SysML2.NET.Core.POCO.Core.Classifiers.ISubclassification poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("specialization "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("subclassifier "); + + if (poco.Subclassifier != null) + { + stringBuilder.Append(poco.Subclassifier.qualifiedName); + stringBuilder.Append(' '); + } + stringBuilder.Append(" :> "); + + if (poco.Superclassifier != null) + { + stringBuilder.Append(poco.Superclassifier.qualifiedName); + stringBuilder.Append(' '); + } + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubjectMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubjectMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..4a14fc5d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubjectMembershipTextualNotationBuilder.cs @@ -0,0 +1,90 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SubjectMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SubjectMember + /// SubjectMember:SubjectMembership=MemberPrefixownedRelatedElement+=SubjectUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSubjectMember(SysML2.NET.Core.POCO.Systems.Requirements.ISubjectMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildSubjectUsage(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule SatisfactionSubjectMember + /// SatisfactionSubjectMember:SubjectMembership=ownedRelatedElement+=SatisfactionParameter + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSatisfactionSubjectMember(SysML2.NET.Core.POCO.Systems.Requirements.ISubjectMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage elementAsReferenceUsage) + { + ReferenceUsageTextualNotationBuilder.BuildSatisfactionParameter(elementAsReferenceUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubsettingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubsettingTextualNotationBuilder.cs new file mode 100644 index 00000000..31358fa0 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SubsettingTextualNotationBuilder.cs @@ -0,0 +1,87 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SubsettingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedSubsetting + /// OwnedSubsetting:Subsetting=subsettedFeature=[QualifiedName]|subsettedFeature=OwnedFeatureChain{ownedRelatedElement+=subsettedFeature} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedSubsetting(SysML2.NET.Core.POCO.Core.Features.ISubsetting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.SubsettedFeature) && poco.SubsettedFeature is SysML2.NET.Core.POCO.Core.Features.IFeature chainedSubsettedFeatureAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(chainedSubsettedFeatureAsFeature, cursorCache, stringBuilder); + } + else if (poco.SubsettedFeature != null) + { + stringBuilder.Append(poco.SubsettedFeature.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule Subsetting + /// Subsetting=('specialization'Identification)?'subset'SpecificTypeSUBSETSGeneralTypeRelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSubsetting(SysML2.NET.Core.POCO.Core.Features.ISubsetting poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("specialization "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("subset "); + SpecializationTextualNotationBuilder.BuildSpecificType(poco, cursorCache, stringBuilder); + stringBuilder.Append(" :> "); + SpecializationTextualNotationBuilder.BuildGeneralType(poco, cursorCache, stringBuilder); + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionAsUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionAsUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..fe2c42c5 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionAsUsageTextualNotationBuilder.cs @@ -0,0 +1,148 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SuccessionAsUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SourceSuccession + /// SourceSuccession:SuccessionAsUsage=ownedRelationship+=SourceEndMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSourceSuccession(SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildSourceEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule TargetSuccession + /// TargetSuccession:SuccessionAsUsage=ownedRelationship+=SourceEndMember'then'ownedRelationship+=ConnectorEndMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTargetSuccession(SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildSourceEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("then "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule SuccessionAsUsage + /// SuccessionAsUsage=UsagePrefix('succession'UsageDeclaration)?'first's.ownedRelationship+=ConnectorEndMember'then's.ownedRelationship+=ConnectorEndMemberUsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSuccessionAsUsage(SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + UsageTextualNotationBuilder.BuildUsagePrefix(poco, cursorCache, stringBuilder); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.OwnedRelatedElement.Count != 0 || poco.IsOrdered) + { + stringBuilder.Append("succession "); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("first "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("then "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + UsageTextualNotationBuilder.BuildUsageBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionFlowTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionFlowTextualNotationBuilder.cs new file mode 100644 index 00000000..e4ea55f9 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionFlowTextualNotationBuilder.cs @@ -0,0 +1,76 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SuccessionFlowTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SuccessionFlow + /// SuccessionFlow=FeaturePrefix'succession''flow'FlowDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSuccessionFlow(SysML2.NET.Core.POCO.Kernel.Interactions.ISuccessionFlow poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("succession "); + stringBuilder.Append("flow "); + BuildFlowDeclarationHandCoded(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionFlowUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionFlowUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..1a7036f2 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionFlowUsageTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SuccessionFlowUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SuccessionFlowUsage + /// SuccessionFlowUsage=OccurrenceUsagePrefix'succession''flow'FlowDeclarationDefinitionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSuccessionFlowUsage(SysML2.NET.Core.POCO.Systems.Flows.ISuccessionFlowUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("succession "); + stringBuilder.Append("flow "); + FlowUsageTextualNotationBuilder.BuildFlowDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildDefinitionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionTextualNotationBuilder.cs new file mode 100644 index 00000000..8db6bad4 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/SuccessionTextualNotationBuilder.cs @@ -0,0 +1,122 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class SuccessionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TransitionSuccession + /// TransitionSuccession:Succession=ownedRelationship+=EmptyEndMemberownedRelationship+=ConnectorEndMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionSuccession(SysML2.NET.Core.POCO.Kernel.Connectors.ISuccession poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildEmptyEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Features.IEndFeatureMembership elementAsEndFeatureMembership) + { + EndFeatureMembershipTextualNotationBuilder.BuildConnectorEndMember(elementAsEndFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule SuccessionDeclaration + /// SuccessionDeclaration:Succession=FeatureDeclaration('first'ownedRelationship+=ConnectorEndMember'then'ownedRelationship+=ConnectorEndMember)?|(s.isSufficient?='all')?('first'?ownedRelationship+=ConnectorEndMember'then'ownedRelationship+=ConnectorEndMember)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSuccessionDeclaration(SysML2.NET.Core.POCO.Kernel.Connectors.ISuccession poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildSuccessionDeclarationHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule Succession + /// Succession=FeaturePrefix'succession'SuccessionDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSuccession(SysML2.NET.Core.POCO.Kernel.Connectors.ISuccession poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + BuildFeaturePrefixHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + stringBuilder.Append("succession "); + BuildSuccessionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TerminateActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TerminateActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..a0419286 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TerminateActionUsageTextualNotationBuilder.cs @@ -0,0 +1,77 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class TerminateActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TerminateNode + /// TerminateNode:TerminateActionUsage=OccurrenceUsagePrefixActionNodeUsageDeclaration?'terminate'(ownedRelationship+=NodeParameterMember)?ActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTerminateNode(SysML2.NET.Core.POCO.Systems.Actions.ITerminateActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + ActionUsageTextualNotationBuilder.BuildActionNodeUsageDeclaration(poco, cursorCache, stringBuilder); + } + stringBuilder.Append("terminate "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildNodeParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TextualRepresentationTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TextualRepresentationTextualNotationBuilder.cs new file mode 100644 index 00000000..84fa8bbf --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TextualRepresentationTextualNotationBuilder.cs @@ -0,0 +1,64 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class TextualRepresentationTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TextualRepresentation + /// TextualRepresentation=('rep'Identification)?'language'language=STRING_VALUEbody=REGULAR_COMMENT + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTextualRepresentation(SysML2.NET.Core.POCO.Root.Annotations.ITextualRepresentation poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append("rep "); + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("language "); + stringBuilder.Append(poco.Language); + stringBuilder.Append(poco.Body); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TransitionFeatureMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TransitionFeatureMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..3541786a --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TransitionFeatureMembershipTextualNotationBuilder.cs @@ -0,0 +1,119 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class TransitionFeatureMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TriggerActionMember + /// TriggerActionMember:TransitionFeatureMembership='accept'{kind='trigger'}ownedRelatedElement+=TriggerAction + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTriggerActionMember(SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + stringBuilder.Append("accept "); + // NonParsing Assignment Element : kind = 'trigger' => Does not have to be process + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IAcceptActionUsage elementAsAcceptActionUsage) + { + AcceptActionUsageTextualNotationBuilder.BuildTriggerAction(elementAsAcceptActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule GuardExpressionMember + /// GuardExpressionMember:TransitionFeatureMembership='if'{kind='guard'}ownedRelatedElement+=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildGuardExpressionMember(SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + stringBuilder.Append("if "); + // NonParsing Assignment Element : kind = 'guard' => Does not have to be process + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IExpression elementAsExpression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(elementAsExpression, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule EffectBehaviorMember + /// EffectBehaviorMember:TransitionFeatureMembership='do'{kind='effect'}ownedRelatedElement+=EffectBehaviorUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEffectBehaviorMember(SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + stringBuilder.Append("do "); + // NonParsing Assignment Element : kind = 'effect' => Does not have to be process + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Actions.IActionUsage elementAsActionUsage) + { + ActionUsageTextualNotationBuilder.BuildEffectBehaviorUsage(elementAsActionUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TransitionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TransitionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..8ad1bf44 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TransitionUsageTextualNotationBuilder.cs @@ -0,0 +1,308 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class TransitionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule GuardedTargetSuccession + /// GuardedTargetSuccession:TransitionUsage=ownedRelationship+=GuardExpressionMember'then'ownedRelationship+=TransitionSuccessionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildGuardedTargetSuccession(SysML2.NET.Core.POCO.Systems.States.ITransitionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership elementAsTransitionFeatureMembership) + { + TransitionFeatureMembershipTextualNotationBuilder.BuildGuardExpressionMember(elementAsTransitionFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("then "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildTransitionSuccessionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule DefaultTargetSuccession + /// DefaultTargetSuccession:TransitionUsage='else'ownedRelationship+=TransitionSuccessionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefaultTargetSuccession(SysML2.NET.Core.POCO.Systems.States.ITransitionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("else "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildTransitionSuccessionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule GuardedSuccession + /// GuardedSuccession:TransitionUsage=('succession'UsageDeclaration)?'first'ownedRelationship+=FeatureChainMemberownedRelationship+=GuardExpressionMember'then'ownedRelationship+=TransitionSuccessionMemberUsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildGuardedSuccession(SysML2.NET.Core.POCO.Systems.States.ITransitionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + stringBuilder.Append("succession "); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + } + + stringBuilder.Append("first "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildFeatureChainMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership elementAsTransitionFeatureMembership) + { + TransitionFeatureMembershipTextualNotationBuilder.BuildGuardExpressionMember(elementAsTransitionFeatureMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + stringBuilder.Append("then "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildTransitionSuccessionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + UsageTextualNotationBuilder.BuildUsageBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule TargetTransitionUsage + /// TargetTransitionUsage:TransitionUsage=ownedRelationship+=EmptyParameterMember('transition'(ownedRelationship+=EmptyParameterMemberownedRelationship+=TriggerActionMember)?(ownedRelationship+=GuardExpressionMember)?(ownedRelationship+=EffectBehaviorMember)?|ownedRelationship+=EmptyParameterMemberownedRelationship+=TriggerActionMember(ownedRelationship+=GuardExpressionMember)?(ownedRelationship+=EffectBehaviorMember)?|ownedRelationship+=GuardExpressionMember(ownedRelationship+=EffectBehaviorMember)?)?'then'ownedRelationship+=TransitionSuccessionMemberActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTargetTransitionUsage(SysML2.NET.Core.POCO.Systems.States.ITransitionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildEmptyParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + BuildTargetTransitionUsageHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append("then "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildTransitionSuccessionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule TransitionUsage + /// TransitionUsage='transition'(UsageDeclaration'first')?ownedRelationship+=FeatureChainMemberownedRelationship+=EmptyParameterMember(ownedRelationship+=EmptyParameterMemberownedRelationship+=TriggerActionMember)?(ownedRelationship+=GuardExpressionMember)?(ownedRelationship+=EffectBehaviorMember)?'then'ownedRelationship+=TransitionSuccessionMemberActionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTransitionUsage(SysML2.NET.Core.POCO.Systems.States.ITransitionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("transition "); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + stringBuilder.Append("first "); + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IMembership elementAsMembership) + { + MembershipTextualNotationBuilder.BuildFeatureChainMember(elementAsMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildEmptyParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildEmptyParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership elementAsTransitionFeatureMembership) + { + TransitionFeatureMembershipTextualNotationBuilder.BuildTriggerActionMember(elementAsTransitionFeatureMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership elementAsTransitionFeatureMembership) + { + TransitionFeatureMembershipTextualNotationBuilder.BuildGuardExpressionMember(elementAsTransitionFeatureMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.States.ITransitionFeatureMembership elementAsTransitionFeatureMembership) + { + TransitionFeatureMembershipTextualNotationBuilder.BuildEffectBehaviorMember(elementAsTransitionFeatureMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + stringBuilder.Append("then "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildTransitionSuccessionMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + TypeTextualNotationBuilder.BuildActionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TriggerInvocationExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TriggerInvocationExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..e565a275 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TriggerInvocationExpressionTextualNotationBuilder.cs @@ -0,0 +1,53 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class TriggerInvocationExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TriggerExpression + /// TriggerExpression:TriggerInvocationExpression=kind=('at'|'after')ownedRelationship+=ArgumentMember|kind='when'ownedRelationship+=ArgumentExpressionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTriggerExpression(SysML2.NET.Core.POCO.Systems.Actions.ITriggerInvocationExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildTriggerExpressionHandCoded(poco, cursorCache, stringBuilder); + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TypeFeaturingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TypeFeaturingTextualNotationBuilder.cs new file mode 100644 index 00000000..9c7bc427 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TypeFeaturingTextualNotationBuilder.cs @@ -0,0 +1,94 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class TypeFeaturingTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule OwnedTypeFeaturing + /// OwnedTypeFeaturing:TypeFeaturing=featuringType=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOwnedTypeFeaturing(SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.FeaturingType != null) + { + stringBuilder.Append(poco.FeaturingType.qualifiedName); + stringBuilder.Append(' '); + } + + } + + /// + /// Builds the Textual Notation string for the rule TypeFeaturing + /// TypeFeaturing='featuring'(Identification'of')?featureOfType=[QualifiedName]'by'featuringType=[QualifiedName]RelationshipBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeFeaturing(SysML2.NET.Core.POCO.Core.Features.ITypeFeaturing poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append("featuring "); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + stringBuilder.Append("of "); + stringBuilder.Append(' '); + } + + + if (poco.FeatureOfType != null) + { + stringBuilder.Append(poco.FeatureOfType.qualifiedName); + stringBuilder.Append(' '); + } + stringBuilder.Append("by "); + + if (poco.FeaturingType != null) + { + stringBuilder.Append(poco.FeaturingType.qualifiedName); + stringBuilder.Append(' '); + } + RelationshipTextualNotationBuilder.BuildRelationshipBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TypeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TypeTextualNotationBuilder.cs new file mode 100644 index 00000000..7da25a33 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/TypeTextualNotationBuilder.cs @@ -0,0 +1,932 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class TypeTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule DefinitionBody + /// DefinitionBody:Type=';'|'{'DefinitionBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinitionBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildDefinitionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule DefinitionBodyItem + /// DefinitionBodyItem:Type=ownedRelationship+=DefinitionMember|ownedRelationship+=VariantUsageMember|ownedRelationship+=NonOccurrenceUsageMember|(ownedRelationship+=SourceSuccessionMember)?ownedRelationship+=OccurrenceUsageMember|ownedRelationship+=AliasMember|ownedRelationship+=Import + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDefinitionBodyItem(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildDefinitionBodyItemHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule InterfaceBody + /// InterfaceBody:Type=';'|'{'InterfaceBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildInterfaceBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceBodyItem + /// InterfaceBodyItem:Type=ownedRelationship+=DefinitionMember|ownedRelationship+=VariantUsageMember|ownedRelationship+=InterfaceNonOccurrenceUsageMember|(ownedRelationship+=SourceSuccessionMember)?ownedRelationship+=InterfaceOccurrenceUsageMember|ownedRelationship+=AliasMember|ownedRelationship+=Import + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceBodyItem(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildInterfaceBodyItemHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule ActionBody + /// ActionBody:Type=';'|'{'ActionBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildActionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule ActionBodyItem + /// ActionBodyItem:Type=NonBehaviorBodyItem|ownedRelationship+=InitialNodeMember(ownedRelationship+=ActionTargetSuccessionMember)*|(ownedRelationship+=SourceSuccessionMember)?ownedRelationship+=ActionBehaviorMember(ownedRelationship+=ActionTargetSuccessionMember)*|ownedRelationship+=GuardedSuccessionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionBodyItem(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildActionBodyItemHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule StateBodyItem + /// StateBodyItem:Type=NonBehaviorBodyItem|(ownedRelationship+=SourceSuccessionMember)?ownedRelationship+=BehaviorUsageMember(ownedRelationship+=TargetTransitionUsageMember)*|ownedRelationship+=TransitionUsageMember|ownedRelationship+=EntryActionMember(ownedRelationship+=EntryTransitionMember)*|ownedRelationship+=DoActionMember|ownedRelationship+=ExitActionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStateBodyItem(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildStateBodyItemHandCoded(poco, cursorCache, stringBuilder); + } + + /// + /// Builds the Textual Notation string for the rule CalculationBody + /// CalculationBody:Type=';'|'{'CalculationBodyPart'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCalculationBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (ownedRelationshipCursor.Current != null) + { + BuildCalculationBodyPart(poco, cursorCache, stringBuilder); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule CalculationBodyPart + /// CalculationBodyPart:Type=CalculationBodyItem*(ownedRelationship+=ResultExpressionMember)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCalculationBodyPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is not null and not SysML2.NET.Core.POCO.Kernel.Functions.IResultExpressionMembership) + { + BuildCalculationBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IResultExpressionMembership elementAsResultExpressionMembership) + { + ResultExpressionMembershipTextualNotationBuilder.BuildResultExpressionMember(elementAsResultExpressionMembership, cursorCache, stringBuilder); + } + } + } + + + } + + /// + /// Builds the Textual Notation string for the rule CalculationBodyItem + /// CalculationBodyItem:Type=ActionBodyItem|ownedRelationship+=ReturnParameterMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCalculationBodyItem(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership returnParameterMembership) + { + ReturnParameterMembershipTextualNotationBuilder.BuildReturnParameterMember(returnParameterMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else + { + BuildActionBodyItem(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule RequirementBody + /// RequirementBody:Type=';'|'{'RequirementBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildRequirementBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule RequirementBodyItem + /// RequirementBodyItem:Type=DefinitionBodyItem|ownedRelationship+=SubjectMember|ownedRelationship+=RequirementConstraintMember|ownedRelationship+=FramedConcernMember|ownedRelationship+=RequirementVerificationMember|ownedRelationship+=ActorMember|ownedRelationship+=StakeholderMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRequirementBodyItem(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.ISubjectMembership subjectMembership) + { + SubjectMembershipTextualNotationBuilder.BuildSubjectMember(subjectMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IFramedConcernMembership framedConcernMembership) + { + FramedConcernMembershipTextualNotationBuilder.BuildFramedConcernMember(framedConcernMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.VerificationCases.IRequirementVerificationMembership requirementVerificationMembership) + { + RequirementVerificationMembershipTextualNotationBuilder.BuildRequirementVerificationMember(requirementVerificationMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IActorMembership actorMembership) + { + ActorMembershipTextualNotationBuilder.BuildActorMember(actorMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IStakeholderMembership stakeholderMembership) + { + StakeholderMembershipTextualNotationBuilder.BuildStakeholderMember(stakeholderMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IRequirementConstraintMembership requirementConstraintMembership) + { + RequirementConstraintMembershipTextualNotationBuilder.BuildRequirementConstraintMember(requirementConstraintMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else + { + BuildDefinitionBodyItem(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule CaseBody + /// CaseBody:Type=';'|'{'CaseBodyItem*(ownedRelationship+=ResultExpressionMember)?'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCaseBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.AppendLine("{"); + while (ownedRelationshipCursor.Current != null) + { + BuildCaseBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IResultExpressionMembership elementAsResultExpressionMembership) + { + ResultExpressionMembershipTextualNotationBuilder.BuildResultExpressionMember(elementAsResultExpressionMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule CaseBodyItem + /// CaseBodyItem:Type=ActionBodyItem|ownedRelationship+=SubjectMember|ownedRelationship+=ActorMember|ownedRelationship+=ObjectiveMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildCaseBodyItem(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.ISubjectMembership subjectMembership) + { + SubjectMembershipTextualNotationBuilder.BuildSubjectMember(subjectMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Requirements.IActorMembership actorMembership) + { + ActorMembershipTextualNotationBuilder.BuildActorMember(actorMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Cases.IObjectiveMembership objectiveMembership) + { + ObjectiveMembershipTextualNotationBuilder.BuildObjectiveMember(objectiveMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else + { + BuildActionBodyItem(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule MetadataBody + /// MetadataBody:Type=';'|'{'(ownedRelationship+=DefinitionMember|ownedRelationship+=MetadataBodyUsageMember|ownedRelationship+=AliasMember|ownedRelationship+=Import)*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildMetadataBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.AppendLine("{"); + while (ownedRelationshipCursor.Current != null) + { + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Core.Types.IFeatureMembership featureMembership: + FeatureMembershipTextualNotationBuilder.BuildMetadataBodyUsageMember(featureMembership, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership owningMembership: + OwningMembershipTextualNotationBuilder.BuildDefinitionMember(owningMembership, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IMembership membership: + MembershipTextualNotationBuilder.BuildAliasMember(membership, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IImport import: + ImportTextualNotationBuilder.BuildImport(import, cursorCache, stringBuilder); + break; + } + ownedRelationshipCursor.Move(); + } + + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule TypePrefix + /// TypePrefix:Type=(isAbstract?='abstract')?(ownedRelationship+=PrefixMetadataMember)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypePrefix(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + stringBuilder.Append(' '); + } + + + while (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule TypeDeclaration + /// TypeDeclaration:Type=(isSufficient?='all')?Identification(ownedRelationship+=OwnedMultiplicity)?(SpecializationPart|ConjugationPart)+TypeRelationshipPart* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeDeclaration(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (poco.IsSufficient) + { + stringBuilder.Append(" all "); + stringBuilder.Append(' '); + } + + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildOwnedMultiplicity(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + stringBuilder.Append(' '); + } + + BuildTypeDeclarationHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + while (ownedRelationshipCursor.Current != null) + { + BuildTypeRelationshipPart(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule SpecializationPart + /// SpecializationPart:Type=SPECIALIZESownedRelationship+=OwnedSpecialization(','ownedRelationship+=OwnedSpecialization)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildSpecializationPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" :> "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.ISpecialization elementAsSpecialization) + { + SpecializationTextualNotationBuilder.BuildOwnedSpecialization(elementAsSpecialization, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.ISpecialization elementAsSpecialization) + { + SpecializationTextualNotationBuilder.BuildOwnedSpecialization(elementAsSpecialization, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule ConjugationPart + /// ConjugationPart:Type=CONJUGATESownedRelationship+=OwnedConjugation + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildConjugationPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append(" ~"); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IConjugation elementAsConjugation) + { + ConjugationTextualNotationBuilder.BuildOwnedConjugation(elementAsConjugation, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule TypeRelationshipPart + /// TypeRelationshipPart:Type=DisjoiningPart|UnioningPart|IntersectingPart|DifferencingPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeRelationshipPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Core.Types.IType pocoTypeDisjoiningPart when pocoTypeDisjoiningPart.IsValidForDisjoiningPart(): + BuildDisjoiningPart(pocoTypeDisjoiningPart, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.IType pocoTypeUnioningPart when pocoTypeUnioningPart.IsValidForUnioningPart(): + BuildUnioningPart(pocoTypeUnioningPart, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Core.Types.IType pocoTypeIntersectingPart when pocoTypeIntersectingPart.IsValidForIntersectingPart(): + BuildIntersectingPart(pocoTypeIntersectingPart, cursorCache, stringBuilder); + break; + default: + BuildDifferencingPart(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule DisjoiningPart + /// DisjoiningPart:Type='disjoint''from'ownedRelationship+=OwnedDisjoining(','ownedRelationship+=OwnedDisjoining)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDisjoiningPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("disjoint "); + stringBuilder.Append("from "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IDisjoining elementAsDisjoining) + { + DisjoiningTextualNotationBuilder.BuildOwnedDisjoining(elementAsDisjoining, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IDisjoining elementAsDisjoining) + { + DisjoiningTextualNotationBuilder.BuildOwnedDisjoining(elementAsDisjoining, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule UnioningPart + /// UnioningPart:Type='unions'ownedRelationship+=Unioning(','ownedRelationship+=Unioning)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUnioningPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("unions "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IUnioning elementAsUnioning) + { + UnioningTextualNotationBuilder.BuildUnioning(elementAsUnioning, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IUnioning elementAsUnioning) + { + UnioningTextualNotationBuilder.BuildUnioning(elementAsUnioning, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule IntersectingPart + /// IntersectingPart:Type='intersects'ownedRelationship+=Intersecting(','ownedRelationship+=Intersecting)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildIntersectingPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("intersects "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IIntersecting elementAsIntersecting) + { + IntersectingTextualNotationBuilder.BuildIntersecting(elementAsIntersecting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IIntersecting elementAsIntersecting) + { + IntersectingTextualNotationBuilder.BuildIntersecting(elementAsIntersecting, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule DifferencingPart + /// DifferencingPart:Type='differences'ownedRelationship+=Differencing(','ownedRelationship+=Differencing)* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildDifferencingPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + stringBuilder.Append("differences "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IDifferencing elementAsDifferencing) + { + DifferencingTextualNotationBuilder.BuildDifferencing(elementAsDifferencing, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + while (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append(", "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Core.Types.IDifferencing elementAsDifferencing) + { + DifferencingTextualNotationBuilder.BuildDifferencing(elementAsDifferencing, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + } + + } + + /// + /// Builds the Textual Notation string for the rule TypeBody + /// TypeBody:Type=';'|'{'TypeBodyElement*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildTypeBodyElement(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule TypeBodyElement + /// TypeBodyElement:Type=ownedRelationship+=NonFeatureMember|ownedRelationship+=FeatureMember|ownedRelationship+=AliasMember|ownedRelationship+=Import + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildTypeBodyElement(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership owningMembership when owningMembership.IsValidForNonFeatureMember(): + OwningMembershipTextualNotationBuilder.BuildNonFeatureMember(owningMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership owningMembership when owningMembership.IsValidForFeatureMember(): + OwningMembershipTextualNotationBuilder.BuildFeatureMember(owningMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IMembership membership: + MembershipTextualNotationBuilder.BuildAliasMember(membership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + case SysML2.NET.Core.POCO.Root.Namespaces.IImport import: + ImportTextualNotationBuilder.BuildImport(import, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule FunctionBody + /// FunctionBody:Type=';'|'{'FunctionBodyPart'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionBody(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (ownedRelationshipCursor.Current != null) + { + BuildFunctionBodyPart(poco, cursorCache, stringBuilder); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule FunctionBodyPart + /// FunctionBodyPart:Type=(TypeBodyElement|ownedRelationship+=ReturnFeatureMember)*(ownedRelationship+=ResultExpressionMember)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildFunctionBodyPart(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + switch (ownedRelationshipCursor.Current) + { + case SysML2.NET.Core.POCO.Kernel.Functions.IReturnParameterMembership returnParameterMembership: + ReturnParameterMembershipTextualNotationBuilder.BuildReturnFeatureMember(returnParameterMembership, cursorCache, stringBuilder); + break; + } + ownedRelationshipCursor.Move(); + } + + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Functions.IResultExpressionMembership elementAsResultExpressionMembership) + { + ResultExpressionMembershipTextualNotationBuilder.BuildResultExpressionMember(elementAsResultExpressionMembership, cursorCache, stringBuilder); + } + } + } + + + } + + /// + /// Builds the Textual Notation string for the rule InstantiatedTypeReference + /// InstantiatedTypeReference:Type=[QualifiedName] + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInstantiatedTypeReference(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + stringBuilder.Append(poco.qualifiedName); + stringBuilder.Append(' '); + + } + + /// + /// Builds the Textual Notation string for the rule Type + /// Type=TypePrefix'type'TypeDeclarationTypeBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildType(SysML2.NET.Core.POCO.Core.Types.IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildTypePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("type "); + BuildTypeDeclaration(poco, cursorCache, stringBuilder); + BuildTypeBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UnioningTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UnioningTextualNotationBuilder.cs new file mode 100644 index 00000000..4a6476c8 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UnioningTextualNotationBuilder.cs @@ -0,0 +1,71 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class UnioningTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule Unioning + /// Unioning=unioningType=[QualifiedName]|ownedRelatedElement+=OwnedFeatureChain + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUnioning(SysML2.NET.Core.POCO.Core.Types.IUnioning poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + if (poco.UnioningType != null) + { + stringBuilder.Append(poco.UnioningType.qualifiedName); + stringBuilder.Append(' '); + } + else + { + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Core.Features.IFeature elementAsFeature) + { + FeatureTextualNotationBuilder.BuildOwnedFeatureChain(elementAsFeature, cursorCache, stringBuilder); + } + } + } + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UsageTextualNotationBuilder.cs new file mode 100644 index 00000000..927af733 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UsageTextualNotationBuilder.cs @@ -0,0 +1,641 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class UsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule UsageElement + /// UsageElement:Usage=NonOccurrenceUsageElement|OccurrenceUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage pocoUsageNonOccurrenceUsageElement when pocoUsageNonOccurrenceUsageElement.IsEnd: + BuildNonOccurrenceUsageElement(pocoUsageNonOccurrenceUsageElement, cursorCache, stringBuilder); + break; + default: + BuildOccurrenceUsageElement(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule RefPrefix + /// RefPrefix:Usage=(direction=FeatureDirection)?(isDerived?='derived')?(isAbstract?='abstract'|isVariation?='variation')?(isConstant?='constant')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildRefPrefix(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.Direction.HasValue) + { + stringBuilder.Append(poco.Direction.ToString().ToLower()); + stringBuilder.Append(' '); + } + + + if (poco.IsDerived) + { + stringBuilder.Append(" derived "); + stringBuilder.Append(' '); + } + + if (poco.IsAbstract) + { + stringBuilder.Append(" abstract "); + } + else if (poco.IsVariation) + { + stringBuilder.Append(" variation "); + } + + + if (poco.IsConstant) + { + stringBuilder.Append(" constant "); + } + + + } + + /// + /// Builds the Textual Notation string for the rule BasicUsagePrefix + /// BasicUsagePrefix:Usage=RefPrefix(isReference?='ref')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBasicUsagePrefix(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildRefPrefix(poco, cursorCache, stringBuilder); + + if (poco.isReference) + { + stringBuilder.Append(" ref "); + } + + + } + + /// + /// Builds the Textual Notation string for the rule EndUsagePrefix + /// EndUsagePrefix:Usage=isEnd?='end'(ownedRelationship+=OwnedCrossFeatureMember)? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEndUsagePrefix(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (poco.IsEnd) + { + stringBuilder.Append(" end "); + } + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildOwnedCrossFeatureMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + } + + + } + + /// + /// Builds the Textual Notation string for the rule UsageExtensionKeyword + /// UsageExtensionKeyword:Usage=ownedRelationship+=PrefixMetadataMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUsageExtensionKeyword(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership elementAsOwningMembership) + { + OwningMembershipTextualNotationBuilder.BuildPrefixMetadataMember(elementAsOwningMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + } + + /// + /// Builds the Textual Notation string for the rule UnextendedUsagePrefix + /// UnextendedUsagePrefix:Usage=EndUsagePrefix|BasicUsagePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUnextendedUsagePrefix(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage pocoUsageBasicUsagePrefix when pocoUsageBasicUsagePrefix.IsDerived: + BuildBasicUsagePrefix(pocoUsageBasicUsagePrefix, cursorCache, stringBuilder); + break; + default: + BuildEndUsagePrefix(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule UsagePrefix + /// UsagePrefix:Usage=UnextendedUsagePrefixUsageExtensionKeyword* + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUsagePrefix(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildUnextendedUsagePrefix(poco, cursorCache, stringBuilder); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + + } + + /// + /// Builds the Textual Notation string for the rule UsageDeclaration + /// UsageDeclaration:Usage=IdentificationFeatureSpecializationPart? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUsageDeclaration(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + ElementTextualNotationBuilder.BuildIdentification(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + FeatureTextualNotationBuilder.BuildFeatureSpecializationPart(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule UsageCompletion + /// UsageCompletion:Usage=ValuePart?UsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUsageCompletion(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + BuildUsageBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule UsageBody + /// UsageBody:Usage=DefinitionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUsageBody(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + TypeTextualNotationBuilder.BuildDefinitionBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule NonOccurrenceUsageElement + /// NonOccurrenceUsageElement:Usage=DefaultReferenceUsage|ReferenceUsage|AttributeUsage|EnumerationUsage|BindingConnectorAsUsage|SuccessionAsUsage|ExtendedUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildNonOccurrenceUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Connections.IBindingConnectorAsUsage pocoBindingConnectorAsUsage: + BindingConnectorAsUsageTextualNotationBuilder.BuildBindingConnectorAsUsage(pocoBindingConnectorAsUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage pocoSuccessionAsUsage: + SuccessionAsUsageTextualNotationBuilder.BuildSuccessionAsUsage(pocoSuccessionAsUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationUsage pocoEnumerationUsage: + EnumerationUsageTextualNotationBuilder.BuildEnumerationUsage(pocoEnumerationUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage pocoReferenceUsageReferenceUsage when pocoReferenceUsageReferenceUsage.IsEnd: + ReferenceUsageTextualNotationBuilder.BuildReferenceUsage(pocoReferenceUsageReferenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage pocoReferenceUsage: + ReferenceUsageTextualNotationBuilder.BuildDefaultReferenceUsage(pocoReferenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Attributes.IAttributeUsage pocoAttributeUsage: + AttributeUsageTextualNotationBuilder.BuildAttributeUsage(pocoAttributeUsage, cursorCache, stringBuilder); + break; + default: + BuildExtendedUsage(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule OccurrenceUsageElement + /// OccurrenceUsageElement:Usage=StructureUsageElement|BehaviorUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildOccurrenceUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage pocoUsageStructureUsageElement when pocoUsageStructureUsageElement.IsValidForStructureUsageElement(): + BuildStructureUsageElement(pocoUsageStructureUsageElement, cursorCache, stringBuilder); + break; + default: + BuildBehaviorUsageElement(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule StructureUsageElement + /// StructureUsageElement:Usage=OccurrenceUsage|IndividualUsage|PortionUsage|EventOccurrenceUsage|ItemUsage|PartUsage|ViewUsage|RenderingUsage|PortUsage|ConnectionUsage|InterfaceUsage|AllocationUsage|Message|FlowUsage|SuccessionFlowUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildStructureUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Flows.ISuccessionFlowUsage pocoSuccessionFlowUsage: + SuccessionFlowUsageTextualNotationBuilder.BuildSuccessionFlowUsage(pocoSuccessionFlowUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage pocoInterfaceUsage: + InterfaceUsageTextualNotationBuilder.BuildInterfaceUsage(pocoInterfaceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Allocations.IAllocationUsage pocoAllocationUsage: + AllocationUsageTextualNotationBuilder.BuildAllocationUsage(pocoAllocationUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage pocoFlowUsageMessage when pocoFlowUsageMessage.IsValidForMessage(): + FlowUsageTextualNotationBuilder.BuildMessage(pocoFlowUsageMessage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage pocoFlowUsage: + FlowUsageTextualNotationBuilder.BuildFlowUsage(pocoFlowUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Connections.IConnectionUsage pocoConnectionUsage: + ConnectionUsageTextualNotationBuilder.BuildConnectionUsage(pocoConnectionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IViewUsage pocoViewUsage: + ViewUsageTextualNotationBuilder.BuildViewUsage(pocoViewUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IRenderingUsage pocoRenderingUsage: + RenderingUsageTextualNotationBuilder.BuildRenderingUsage(pocoRenderingUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Parts.IPartUsage pocoPartUsage: + PartUsageTextualNotationBuilder.BuildPartUsage(pocoPartUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IEventOccurrenceUsage pocoEventOccurrenceUsage: + EventOccurrenceUsageTextualNotationBuilder.BuildEventOccurrenceUsage(pocoEventOccurrenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Items.IItemUsage pocoItemUsage: + ItemUsageTextualNotationBuilder.BuildItemUsage(pocoItemUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Ports.IPortUsage pocoPortUsage: + PortUsageTextualNotationBuilder.BuildPortUsage(pocoPortUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage pocoOccurrenceUsageOccurrenceUsage when pocoOccurrenceUsageOccurrenceUsage.IsValidForOccurrenceUsage(): + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsage(pocoOccurrenceUsageOccurrenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage pocoOccurrenceUsageIndividualUsage when pocoOccurrenceUsageIndividualUsage.IsValidForIndividualUsage(): + OccurrenceUsageTextualNotationBuilder.BuildIndividualUsage(pocoOccurrenceUsageIndividualUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage pocoOccurrenceUsage: + OccurrenceUsageTextualNotationBuilder.BuildPortionUsage(pocoOccurrenceUsage, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule BehaviorUsageElement + /// BehaviorUsageElement:Usage=ActionUsage|CalculationUsage|StateUsage|ConstraintUsage|RequirementUsage|ConcernUsage|CaseUsage|AnalysisCaseUsage|VerificationCaseUsage|UseCaseUsage|ViewpointUsage|PerformActionUsage|ExhibitStateUsage|IncludeUseCaseUsage|AssertConstraintUsage|SatisfyRequirementUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildBehaviorUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.UseCases.IIncludeUseCaseUsage pocoIncludeUseCaseUsage: + IncludeUseCaseUsageTextualNotationBuilder.BuildIncludeUseCaseUsage(pocoIncludeUseCaseUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Requirements.ISatisfyRequirementUsage pocoSatisfyRequirementUsage: + SatisfyRequirementUsageTextualNotationBuilder.BuildSatisfyRequirementUsage(pocoSatisfyRequirementUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Requirements.IConcernUsage pocoConcernUsage: + ConcernUsageTextualNotationBuilder.BuildConcernUsage(pocoConcernUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.AnalysisCases.IAnalysisCaseUsage pocoAnalysisCaseUsage: + AnalysisCaseUsageTextualNotationBuilder.BuildAnalysisCaseUsage(pocoAnalysisCaseUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.VerificationCases.IVerificationCaseUsage pocoVerificationCaseUsage: + VerificationCaseUsageTextualNotationBuilder.BuildVerificationCaseUsage(pocoVerificationCaseUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.UseCases.IUseCaseUsage pocoUseCaseUsage: + UseCaseUsageTextualNotationBuilder.BuildUseCaseUsage(pocoUseCaseUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IViewpointUsage pocoViewpointUsage: + ViewpointUsageTextualNotationBuilder.BuildViewpointUsage(pocoViewpointUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.States.IExhibitStateUsage pocoExhibitStateUsage: + ExhibitStateUsageTextualNotationBuilder.BuildExhibitStateUsage(pocoExhibitStateUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Constraints.IAssertConstraintUsage pocoAssertConstraintUsage: + AssertConstraintUsageTextualNotationBuilder.BuildAssertConstraintUsage(pocoAssertConstraintUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Requirements.IRequirementUsage pocoRequirementUsage: + RequirementUsageTextualNotationBuilder.BuildRequirementUsage(pocoRequirementUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Cases.ICaseUsage pocoCaseUsage: + CaseUsageTextualNotationBuilder.BuildCaseUsage(pocoCaseUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Calculations.ICalculationUsage pocoCalculationUsage: + CalculationUsageTextualNotationBuilder.BuildCalculationUsage(pocoCalculationUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Constraints.IConstraintUsage pocoConstraintUsage: + ConstraintUsageTextualNotationBuilder.BuildConstraintUsage(pocoConstraintUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IPerformActionUsage pocoPerformActionUsage: + PerformActionUsageTextualNotationBuilder.BuildPerformActionUsage(pocoPerformActionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.States.IStateUsage pocoStateUsage: + StateUsageTextualNotationBuilder.BuildStateUsage(pocoStateUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Actions.IActionUsage pocoActionUsage: + ActionUsageTextualNotationBuilder.BuildActionUsage(pocoActionUsage, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule VariantUsageElement + /// VariantUsageElement:Usage=VariantReference|ReferenceUsage|AttributeUsage|BindingConnectorAsUsage|SuccessionAsUsage|OccurrenceUsage|IndividualUsage|PortionUsage|EventOccurrenceUsage|ItemUsage|PartUsage|ViewUsage|RenderingUsage|PortUsage|ConnectionUsage|InterfaceUsage|AllocationUsage|Message|FlowUsage|SuccessionFlowUsage|BehaviorUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildVariantUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Flows.ISuccessionFlowUsage pocoSuccessionFlowUsage: + SuccessionFlowUsageTextualNotationBuilder.BuildSuccessionFlowUsage(pocoSuccessionFlowUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Interfaces.IInterfaceUsage pocoInterfaceUsage: + InterfaceUsageTextualNotationBuilder.BuildInterfaceUsage(pocoInterfaceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Allocations.IAllocationUsage pocoAllocationUsage: + AllocationUsageTextualNotationBuilder.BuildAllocationUsage(pocoAllocationUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage pocoFlowUsageFlowUsage when pocoFlowUsageFlowUsage.IsValidForFlowUsage(): + FlowUsageTextualNotationBuilder.BuildFlowUsage(pocoFlowUsageFlowUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Flows.IFlowUsage pocoFlowUsage: + FlowUsageTextualNotationBuilder.BuildMessage(pocoFlowUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Connections.IConnectionUsage pocoConnectionUsage: + ConnectionUsageTextualNotationBuilder.BuildConnectionUsage(pocoConnectionUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Connections.IBindingConnectorAsUsage pocoBindingConnectorAsUsage: + BindingConnectorAsUsageTextualNotationBuilder.BuildBindingConnectorAsUsage(pocoBindingConnectorAsUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage pocoSuccessionAsUsage: + SuccessionAsUsageTextualNotationBuilder.BuildSuccessionAsUsage(pocoSuccessionAsUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IViewUsage pocoViewUsage: + ViewUsageTextualNotationBuilder.BuildViewUsage(pocoViewUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Views.IRenderingUsage pocoRenderingUsage: + RenderingUsageTextualNotationBuilder.BuildRenderingUsage(pocoRenderingUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Parts.IPartUsage pocoPartUsage: + PartUsageTextualNotationBuilder.BuildPartUsage(pocoPartUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IEventOccurrenceUsage pocoEventOccurrenceUsage: + EventOccurrenceUsageTextualNotationBuilder.BuildEventOccurrenceUsage(pocoEventOccurrenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Items.IItemUsage pocoItemUsage: + ItemUsageTextualNotationBuilder.BuildItemUsage(pocoItemUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Ports.IPortUsage pocoPortUsage: + PortUsageTextualNotationBuilder.BuildPortUsage(pocoPortUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage pocoReferenceUsageReferenceUsage when pocoReferenceUsageReferenceUsage.IsEnd: + ReferenceUsageTextualNotationBuilder.BuildReferenceUsage(pocoReferenceUsageReferenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage pocoReferenceUsage: + ReferenceUsageTextualNotationBuilder.BuildVariantReference(pocoReferenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Attributes.IAttributeUsage pocoAttributeUsage: + AttributeUsageTextualNotationBuilder.BuildAttributeUsage(pocoAttributeUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage pocoOccurrenceUsageIndividualUsage when pocoOccurrenceUsageIndividualUsage.IsValidForIndividualUsage(): + OccurrenceUsageTextualNotationBuilder.BuildIndividualUsage(pocoOccurrenceUsageIndividualUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage pocoOccurrenceUsageOccurrenceUsage when pocoOccurrenceUsageOccurrenceUsage.IsValidForOccurrenceUsage(): + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsage(pocoOccurrenceUsageOccurrenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Occurrences.IOccurrenceUsage pocoOccurrenceUsage: + OccurrenceUsageTextualNotationBuilder.BuildPortionUsage(pocoOccurrenceUsage, cursorCache, stringBuilder); + break; + default: + BuildBehaviorUsageElement(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceNonOccurrenceUsageElement + /// InterfaceNonOccurrenceUsageElement:Usage=ReferenceUsage|AttributeUsage|EnumerationUsage|BindingConnectorAsUsage|SuccessionAsUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceNonOccurrenceUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Connections.IBindingConnectorAsUsage pocoBindingConnectorAsUsage: + BindingConnectorAsUsageTextualNotationBuilder.BuildBindingConnectorAsUsage(pocoBindingConnectorAsUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage pocoSuccessionAsUsage: + SuccessionAsUsageTextualNotationBuilder.BuildSuccessionAsUsage(pocoSuccessionAsUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationUsage pocoEnumerationUsage: + EnumerationUsageTextualNotationBuilder.BuildEnumerationUsage(pocoEnumerationUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IReferenceUsage pocoReferenceUsage: + ReferenceUsageTextualNotationBuilder.BuildReferenceUsage(pocoReferenceUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.Attributes.IAttributeUsage pocoAttributeUsage: + AttributeUsageTextualNotationBuilder.BuildAttributeUsage(pocoAttributeUsage, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule InterfaceOccurrenceUsageElement + /// InterfaceOccurrenceUsageElement:Usage=DefaultInterfaceEnd|StructureUsageElement|BehaviorUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildInterfaceOccurrenceUsageElement(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Ports.IPortUsage pocoPortUsage: + PortUsageTextualNotationBuilder.BuildDefaultInterfaceEnd(pocoPortUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage pocoUsageStructureUsageElement when pocoUsageStructureUsageElement.IsValidForStructureUsageElement(): + BuildStructureUsageElement(pocoUsageStructureUsageElement, cursorCache, stringBuilder); + break; + default: + BuildBehaviorUsageElement(poco, cursorCache, stringBuilder); + break; + } + + } + + /// + /// Builds the Textual Notation string for the rule ActionTargetSuccession + /// ActionTargetSuccession:Usage=(TargetSuccession|GuardedTargetSuccession|DefaultTargetSuccession)UsageBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildActionTargetSuccession(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + switch (poco) + { + case SysML2.NET.Core.POCO.Systems.Connections.ISuccessionAsUsage pocoSuccessionAsUsage: + SuccessionAsUsageTextualNotationBuilder.BuildTargetSuccession(pocoSuccessionAsUsage, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.States.ITransitionUsage pocoTransitionUsageGuardedTargetSuccession when pocoTransitionUsageGuardedTargetSuccession.IsValidForGuardedTargetSuccession(): + TransitionUsageTextualNotationBuilder.BuildGuardedTargetSuccession(pocoTransitionUsageGuardedTargetSuccession, cursorCache, stringBuilder); + break; + case SysML2.NET.Core.POCO.Systems.States.ITransitionUsage pocoTransitionUsage: + TransitionUsageTextualNotationBuilder.BuildDefaultTargetSuccession(pocoTransitionUsage, cursorCache, stringBuilder); + break; + } + + stringBuilder.Append(' '); + BuildUsageBody(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule ExtendedUsage + /// ExtendedUsage:Usage=UnextendedUsagePrefixUsageExtensionKeyword+Usage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildExtendedUsage(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildUnextendedUsagePrefix(poco, cursorCache, stringBuilder); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Root.Namespaces.IOwningMembership) + { + BuildUsageExtensionKeyword(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + BuildUsage(poco, cursorCache, stringBuilder); + + } + + /// + /// Builds the Textual Notation string for the rule Usage + /// Usage=UsageDeclarationUsageCompletion + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUsage(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + BuildUsageDeclaration(poco, cursorCache, stringBuilder); + BuildUsageCompletion(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UseCaseDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UseCaseDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..d9ff0d45 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UseCaseDefinitionTextualNotationBuilder.cs @@ -0,0 +1,59 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class UseCaseDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule UseCaseDefinition + /// UseCaseDefinition=OccurrenceDefinitionPrefix'use''case''def'DefinitionDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUseCaseDefinition(SysML2.NET.Core.POCO.Systems.UseCases.IUseCaseDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("use "); + stringBuilder.Append("case "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UseCaseUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UseCaseUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..03d329b5 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/UseCaseUsageTextualNotationBuilder.cs @@ -0,0 +1,64 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class UseCaseUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule UseCaseUsage + /// UseCaseUsage=OccurrenceUsagePrefix'use''case'ConstraintUsageDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildUseCaseUsage(SysML2.NET.Core.POCO.Systems.UseCases.IUseCaseUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("use "); + stringBuilder.Append("case "); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VariantMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VariantMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..7394daf1 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VariantMembershipTextualNotationBuilder.cs @@ -0,0 +1,85 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class VariantMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule VariantUsageMember + /// VariantUsageMember:VariantMembership=MemberPrefix'variant'ownedVariantUsage=VariantUsageElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildVariantUsageMember(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IVariantMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("variant "); + + if (poco.ownedVariantUsage != null) + { + UsageTextualNotationBuilder.BuildVariantUsageElement(poco.ownedVariantUsage, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule EnumerationUsageMember + /// EnumerationUsageMember:VariantMembership=MemberPrefixownedRelatedElement+=EnumeratedValue + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildEnumerationUsageMember(SysML2.NET.Core.POCO.Systems.DefinitionAndUsage.IVariantMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Enumerations.IEnumerationUsage elementAsEnumerationUsage) + { + EnumerationUsageTextualNotationBuilder.BuildEnumeratedValue(elementAsEnumerationUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VerificationCaseDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VerificationCaseDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..55dd3b6e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VerificationCaseDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class VerificationCaseDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule VerificationCaseDefinition + /// VerificationCaseDefinition=OccurrenceDefinitionPrefix'verification''def'DefinitionDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildVerificationCaseDefinition(SysML2.NET.Core.POCO.Systems.VerificationCases.IVerificationCaseDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("verification "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VerificationCaseUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VerificationCaseUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..c163bc20 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VerificationCaseUsageTextualNotationBuilder.cs @@ -0,0 +1,63 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class VerificationCaseUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule VerificationCaseUsage + /// VerificationCaseUsage=OccurrenceUsagePrefix'verification'ConstraintUsageDeclarationCaseBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildVerificationCaseUsage(SysML2.NET.Core.POCO.Systems.VerificationCases.IVerificationCaseUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("verification "); + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + + TypeTextualNotationBuilder.BuildCaseBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..8d7ab60a --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewDefinitionTextualNotationBuilder.cs @@ -0,0 +1,112 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ViewDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ViewDefinitionBody + /// ViewDefinitionBody:ViewDefinition=';'|'{'ViewDefinitionBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewDefinitionBody(SysML2.NET.Core.POCO.Systems.Views.IViewDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildViewDefinitionBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule ViewDefinitionBodyItem + /// ViewDefinitionBodyItem:ViewDefinition=DefinitionBodyItem|ownedRelationship+=ElementFilterMember|ownedRelationship+=ViewRenderingMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewDefinitionBodyItem(SysML2.NET.Core.POCO.Systems.Views.IViewDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Views.IViewRenderingMembership viewRenderingMembership) + { + ViewRenderingMembershipTextualNotationBuilder.BuildViewRenderingMember(viewRenderingMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership elementFilterMembership) + { + ElementFilterMembershipTextualNotationBuilder.BuildElementFilterMember(elementFilterMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else + { + TypeTextualNotationBuilder.BuildDefinitionBodyItem(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ViewDefinition + /// ViewDefinition=OccurrenceDefinitionPrefix'view''def'DefinitionDeclarationViewDefinitionBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewDefinition(SysML2.NET.Core.POCO.Systems.Views.IViewDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("view "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + BuildViewDefinitionBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewRenderingMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewRenderingMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..ccbcd43e --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewRenderingMembershipTextualNotationBuilder.cs @@ -0,0 +1,67 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ViewRenderingMembershipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ViewRenderingMember + /// ViewRenderingMember:ViewRenderingMembership=MemberPrefix'render'ownedRelatedElement+=ViewRenderingUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewRenderingMember(SysML2.NET.Core.POCO.Systems.Views.IViewRenderingMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + MembershipTextualNotationBuilder.BuildMemberPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("render "); + + if (ownedRelatedElementCursor.Current != null) + { + + if (ownedRelatedElementCursor.Current is SysML2.NET.Core.POCO.Systems.Views.IRenderingUsage elementAsRenderingUsage) + { + RenderingUsageTextualNotationBuilder.BuildViewRenderingUsage(elementAsRenderingUsage, cursorCache, stringBuilder); + } + } + ownedRelatedElementCursor.Move(); + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..92a29825 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewUsageTextualNotationBuilder.cs @@ -0,0 +1,125 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ViewUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ViewBody + /// ViewBody:ViewUsage=';'|'{'ViewBodyItem*'}' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewBody(SysML2.NET.Core.POCO.Systems.Views.IViewUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelationship.Count == 0) + { + stringBuilder.AppendLine(";"); + } + else + { + stringBuilder.AppendLine("{"); + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + while (ownedRelationshipCursor.Current != null) + { + BuildViewBodyItem(poco, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + stringBuilder.AppendLine("}"); + } + + } + + /// + /// Builds the Textual Notation string for the rule ViewBodyItem + /// ViewBodyItem:ViewUsage=DefinitionBodyItem|ownedRelationship+=ElementFilterMember|ownedRelationship+=ViewRenderingMember|ownedRelationship+=Expose + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewBodyItem(SysML2.NET.Core.POCO.Systems.Views.IViewUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Views.IViewRenderingMembership viewRenderingMembership) + { + ViewRenderingMembershipTextualNotationBuilder.BuildViewRenderingMember(viewRenderingMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Packages.IElementFilterMembership elementFilterMembership) + { + ElementFilterMembershipTextualNotationBuilder.BuildElementFilterMember(elementFilterMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Systems.Views.IExpose expose) + { + ExposeTextualNotationBuilder.BuildExpose(expose, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else + { + TypeTextualNotationBuilder.BuildDefinitionBodyItem(poco, cursorCache, stringBuilder); + } + + } + + /// + /// Builds the Textual Notation string for the rule ViewUsage + /// ViewUsage=OccurrenceUsagePrefix'view'UsageDeclaration?ValuePart?ViewBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewUsage(SysML2.NET.Core.POCO.Systems.Views.IViewUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("view "); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || poco.IsOrdered) + { + UsageTextualNotationBuilder.BuildUsageDeclaration(poco, cursorCache, stringBuilder); + } + + if (poco.OwnedRelationship.Count != 0 || poco.type.Count != 0 || poco.chainingFeature.Count != 0 || !string.IsNullOrWhiteSpace(poco.DeclaredShortName) || !string.IsNullOrWhiteSpace(poco.DeclaredName) || poco.Direction.HasValue || poco.IsDerived || poco.IsAbstract || poco.IsConstant || poco.IsOrdered || poco.IsEnd || poco.importedMembership.Count != 0 || poco.IsComposite || poco.IsPortion || poco.IsVariable || poco.IsSufficient || poco.unioningType.Count != 0 || poco.intersectingType.Count != 0 || poco.differencingType.Count != 0 || poco.featuringType.Count != 0 || poco.ownedTypeFeaturing.Count != 0) + { + FeatureTextualNotationBuilder.BuildValuePart(poco, cursorCache, stringBuilder); + } + BuildViewBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewpointDefinitionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewpointDefinitionTextualNotationBuilder.cs new file mode 100644 index 00000000..729b6641 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewpointDefinitionTextualNotationBuilder.cs @@ -0,0 +1,58 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ViewpointDefinitionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ViewpointDefinition + /// ViewpointDefinition=OccurrenceDefinitionPrefix'viewpoint''def'DefinitionDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewpointDefinition(SysML2.NET.Core.POCO.Systems.Views.IViewpointDefinition poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceDefinitionTextualNotationBuilder.BuildOccurrenceDefinitionPrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("viewpoint "); + stringBuilder.Append("def "); + DefinitionTextualNotationBuilder.BuildDefinitionDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewpointUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewpointUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..560d8ee2 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/ViewpointUsageTextualNotationBuilder.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class ViewpointUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ViewpointUsage + /// ViewpointUsage=OccurrenceUsagePrefix'viewpoint'ConstraintUsageDeclarationRequirementBody + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildViewpointUsage(SysML2.NET.Core.POCO.Systems.Views.IViewpointUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + OccurrenceUsageTextualNotationBuilder.BuildOccurrenceUsagePrefix(poco, cursorCache, stringBuilder); + stringBuilder.Append("viewpoint "); + ConstraintUsageTextualNotationBuilder.BuildConstraintUsageDeclaration(poco, cursorCache, stringBuilder); + TypeTextualNotationBuilder.BuildRequirementBody(poco, cursorCache, stringBuilder); + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VisibilityKindTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VisibilityKindTextualNotationBuilder.cs new file mode 100644 index 00000000..26ddc2d4 --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/VisibilityKindTextualNotationBuilder.cs @@ -0,0 +1,53 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class VisibilityKindTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule VisibilityIndicator + /// VisibilityIndicator:VisibilityKind='public'|'private'|'protected' + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildVisibilityIndicator(SysML2.NET.Core.Root.Namespaces.VisibilityKind poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/WhileLoopActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/WhileLoopActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..63cfd79d --- /dev/null +++ b/SysML2.NET/TextualNotation/AutoGenTextualNotationBuilder/WhileLoopActionUsageTextualNotationBuilder.cs @@ -0,0 +1,84 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides Textual Notation Builder for the element + /// + public static partial class WhileLoopActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule WhileLoopNode + /// WhileLoopNode:WhileLoopActionUsage=ActionNodePrefix('while'ownedRelationship+=ExpressionParameterMember|'loop'ownedRelationship+=EmptyParameterMember)ownedRelationship+=ActionBodyParameterMember('until'ownedRelationship+=ExpressionParameterMember';')? + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + public static void BuildWhileLoopNode(SysML2.NET.Core.POCO.Systems.Actions.IWhileLoopActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + ActionUsageTextualNotationBuilder.BuildActionNodePrefix(poco, cursorCache, stringBuilder); + BuildWhileLoopNodeHandCoded(poco, cursorCache, stringBuilder); + stringBuilder.Append(' '); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildActionBodyParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + ownedRelationshipCursor.Move(); + + + if (ownedRelationshipCursor.Current != null) + { + stringBuilder.Append("until "); + + if (ownedRelationshipCursor.Current != null) + { + + if (ownedRelationshipCursor.Current is SysML2.NET.Core.POCO.Kernel.Behaviors.IParameterMembership elementAsParameterMembership) + { + ParameterMembershipTextualNotationBuilder.BuildExpressionParameterMember(elementAsParameterMembership, cursorCache, stringBuilder); + } + } + stringBuilder.AppendLine(";"); + } + + + } + } +} + +// ------------------------------------------------------------------------------------------------ +// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- +// ------------------------------------------------------------------------------------------------ diff --git a/SysML2.NET/TextualNotation/BindingConnectorTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/BindingConnectorTextualNotationBuilder.cs new file mode 100644 index 00000000..85087067 --- /dev/null +++ b/SysML2.NET/TextualNotation/BindingConnectorTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Connectors; + + /// + /// Hand-coded part of the + /// + public static partial class BindingConnectorTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule BindingConnectorDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildBindingConnectorDeclarationHandCoded(IBindingConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildBindingConnectorDeclarationHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(IBindingConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/BooleanExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/BooleanExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..db335954 --- /dev/null +++ b/SysML2.NET/TextualNotation/BooleanExpressionTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Functions; + + /// + /// Hand-coded part of the + /// + public static partial class BooleanExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(IBooleanExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/CollectionCursor.cs b/SysML2.NET/TextualNotation/CollectionCursor.cs new file mode 100644 index 00000000..098c44e4 --- /dev/null +++ b/SysML2.NET/TextualNotation/CollectionCursor.cs @@ -0,0 +1,121 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System; + using System.Collections.Generic; + + /// + /// Represents a cursor over a read-only collection that allows sequential, + /// forward-only traversal of elements. This class is primarily used to + /// simulate grammar-driven consumption of elements. + /// + /// The type of elements in the collection. + public class CollectionCursor where T : class + { + /// + /// Gets the collection that is currently traversed. + /// + private readonly IReadOnlyList elements; + + /// + /// Gets the value of the current index. + /// + private int index; + + /// + /// Initializes a new instance of the class. + /// + /// The collection to iterate over. + public CollectionCursor(IReadOnlyList elements) + { + this.elements = elements ?? throw new ArgumentNullException(nameof(elements)); + } + + /// + /// Gets the current element at the cursor position. + /// Returns default if the cursor is out of range. + /// + public T Current => this.GetCurrent(this.index); + + /// + /// Gets the element at a specific index without modifying the cursor position. + /// + /// The index to read from. + /// + /// The element at the given index, or default if the index is out of bounds. + /// + private T GetCurrent(int indexToUse) + { + return indexToUse >= this.elements.Count || indexToUse < 0 ? default : this.elements[indexToUse]; + } + + /// + /// Peeks ahead in the collection without advancing the cursor. + /// + /// + /// The number of positions to look ahead. Must be greater than or equal to zero. + /// + /// + /// The element located at the current index plus the specified offset, + /// or default if the resulting index is out of bounds. + /// + /// + /// Thrown when is negative. + /// + public T GetNext(int amount) + { + return amount < 0 ? throw new ArgumentException("Not able to get previous element in the collection") : this.GetCurrent(this.index + amount); + } + + /// + /// Advances the cursor to the next element in the collection. + /// + /// The amount to move-on the cursor position. + /// + /// true if the cursor successfully moved to the next element; + /// false if the end of the collection has been reached. + /// + public void Move(int amount = 1) + { + if (amount < 0) + { + throw new ArgumentOutOfRangeException(nameof(amount)); + } + + this.index = Math.Min(this.index + amount, this.elements.Count); + } + + /// + /// Tries to get the current element as . + /// + /// The retrieved element, if applicable + /// Any class inheriting from + /// + /// true if the could be assigned to + /// false otherwise + public bool TryGetCurrent(out TDerived value) where TDerived : class, T + { + value = this.Current as TDerived; + return value != null; + } + } +} diff --git a/SysML2.NET/TextualNotation/ConcernUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ConcernUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..143191f6 --- /dev/null +++ b/SysML2.NET/TextualNotation/ConcernUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Requirements; + + /// + /// Hand-coded part of the + /// + public static partial class ConcernUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FramedConcernUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFramedConcernUsageHandCoded(IConcernUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFramedConcernUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/ConjugatedPortTypingTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ConjugatedPortTypingTextualNotationBuilder.cs new file mode 100644 index 00000000..79217c93 --- /dev/null +++ b/SysML2.NET/TextualNotation/ConjugatedPortTypingTextualNotationBuilder.cs @@ -0,0 +1,42 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Ports; + + /// + /// Hand-coded part of the + /// + public static partial class ConjugatedPortTypingTextualNotationBuilder + { + /// + /// Build the originalPortDefinition=~[QualifiedName] rule part + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildOriginalPortDefinition(IConjugatedPortTyping poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + } + } +} diff --git a/SysML2.NET/TextualNotation/ConnectionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ConnectionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..40764493 --- /dev/null +++ b/SysML2.NET/TextualNotation/ConnectionUsageTextualNotationBuilder.cs @@ -0,0 +1,44 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Connections; + + /// + /// Hand-coded part of the + /// + public static partial class ConnectionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ConnectionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildConnectionUsageHandCoded(IConnectionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildConnectionUsageHandCoded requires manual implementation"); + } + + } +} diff --git a/SysML2.NET/TextualNotation/ConnectorTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ConnectorTextualNotationBuilder.cs new file mode 100644 index 00000000..557bd132 --- /dev/null +++ b/SysML2.NET/TextualNotation/ConnectorTextualNotationBuilder.cs @@ -0,0 +1,65 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Connectors; + + /// + /// Hand-coded part of the + /// + public static partial class ConnectorTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule BinaryConnectorDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildBinaryConnectorDeclarationHandCoded(IConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildBinaryConnectorDeclarationHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule Connector + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildConnectorHandCoded(IConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildConnectorHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(IConnector poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/ConstraintUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ConstraintUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..3ee988a1 --- /dev/null +++ b/SysML2.NET/TextualNotation/ConstraintUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Constraints; + + /// + /// Hand-coded part of the + /// + public static partial class ConstraintUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RequirementConstraintUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildRequirementConstraintUsageHandCoded(IConstraintUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildRequirementConstraintUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/CursorCache.cs b/SysML2.NET/TextualNotation/CursorCache.cs new file mode 100644 index 00000000..e775ab1e --- /dev/null +++ b/SysML2.NET/TextualNotation/CursorCache.cs @@ -0,0 +1,71 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides caching and new cursor creation feature + /// + public class CursorCache: ICursorCache + { + /// + /// Gets the caching that keeps track of all initialized CollectionCursor per + /// + private readonly ConcurrentDictionary>> cache = new(); + + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + public void Dispose() + { + this.cache.Clear(); + } + + /// + /// Gets or create a new cursor an identified by its based on collection identified by the given . + /// + /// The of the + /// The name the related collection + /// The collection of that is used if the is not yet created + /// The + public CollectionCursor GetOrCreateCursor(Guid elementId, string collectionName, IReadOnlyList elements) + { + if (this.cache.TryGetValue(elementId, out var cursorsPerCollection)) + { + if (cursorsPerCollection.TryGetValue(collectionName, out var cursor)) + { + return cursor; + } + + cursor = new CollectionCursor(elements); + cursorsPerCollection[collectionName] = cursor; + return cursor; + } + + var newCursor = new CollectionCursor(elements); + this.cache[elementId] = new Dictionary>() { { collectionName, newCursor } }; + return newCursor; + } + } +} diff --git a/SysML2.NET/TextualNotation/ElementTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ElementTextualNotationBuilder.cs new file mode 100644 index 00000000..b2fa8f22 --- /dev/null +++ b/SysML2.NET/TextualNotation/ElementTextualNotationBuilder.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// Hand-coded part of the + /// + public static partial class ElementTextualNotationBuilder + { + } +} diff --git a/SysML2.NET/TextualNotation/EventOccurrenceUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/EventOccurrenceUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..70051e45 --- /dev/null +++ b/SysML2.NET/TextualNotation/EventOccurrenceUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Occurrences; + + /// + /// Hand-coded part of the + /// + public static partial class EventOccurrenceUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule EventOccurrenceUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildEventOccurrenceUsageHandCoded(IEventOccurrenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildEventOccurrenceUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/ExhibitStateUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ExhibitStateUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..82998363 --- /dev/null +++ b/SysML2.NET/TextualNotation/ExhibitStateUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.States; + + /// + /// Hand-coded part of the + /// + public static partial class ExhibitStateUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ExhibitStateUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildExhibitStateUsageHandCoded(IExhibitStateUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildExhibitStateUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/ExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..ee98855f --- /dev/null +++ b/SysML2.NET/TextualNotation/ExpressionTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Functions; + + /// + /// Hand-coded part of the + /// + public static partial class ExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule SequenceExpressionList + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildSequenceExpressionListHandCoded(IExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildSequenceExpressionListHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/FeatureMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/FeatureMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..751f2a48 --- /dev/null +++ b/SysML2.NET/TextualNotation/FeatureMembershipTextualNotationBuilder.cs @@ -0,0 +1,65 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Core.Features; + using SysML2.NET.Core.POCO.Core.Types; + + /// + /// Hand-coded part of the + /// + public static partial class FeatureMembershipTextualNotationBuilder + { + /// + /// Build the memberFeature=[QualifiedName] of the rule + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildMemberFeature(IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + } + + /// + /// Builds the Textual Notation string for the rule EntryTransitionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildEntryTransitionMemberHandCoded(IFeatureMembership poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildEntryTransitionMemberHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule SequenceExpressionList + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildSequenceExpressionListHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildSequenceExpressionListHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/FeatureTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/FeatureTextualNotationBuilder.cs new file mode 100644 index 00000000..574603a3 --- /dev/null +++ b/SysML2.NET/TextualNotation/FeatureTextualNotationBuilder.cs @@ -0,0 +1,139 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Core.Features; + + /// + /// Hand-coded part of the + /// + public static partial class FeatureTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule BasicFeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildBasicFeaturePrefixHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildBasicFeaturePrefixHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule FeatureDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeatureDeclarationHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeatureDeclarationHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule Feature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeatureHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeatureHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule FeatureIdentification + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + /// FeatureIdentification:Feature='<'declaredShortName=NAME'>'(declaredName=NAME)?|declaredName=NAME + private static void BuildFeatureIdentificationHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (!string.IsNullOrWhiteSpace(poco.DeclaredShortName)) + { + stringBuilder.Append('<'); + stringBuilder.Append(poco.DeclaredShortName); + stringBuilder.Append('>'); + + if (!string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append(' '); + stringBuilder.Append(poco.DeclaredName); + } + + stringBuilder.Append(' '); + } + else if (!string.IsNullOrWhiteSpace(poco.DeclaredName)) + { + stringBuilder.Append(poco.DeclaredName); + stringBuilder.Append(' '); + } + } + + /// + /// Builds the Textual Notation string for the rule FeatureSpecializationPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeatureSpecializationPartHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeatureSpecializationPartHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule MultiplicityPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildMultiplicityPartHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildMultiplicityPartHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule PayloadFeature + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildPayloadFeatureHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildPayloadFeatureHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule PayloadFeatureSpecializationPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildPayloadFeatureSpecializationPartHandCoded(IFeature poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildPayloadFeatureSpecializationPartHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/FeatureValueTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/FeatureValueTextualNotationBuilder.cs new file mode 100644 index 00000000..2dad78cb --- /dev/null +++ b/SysML2.NET/TextualNotation/FeatureValueTextualNotationBuilder.cs @@ -0,0 +1,73 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.FeatureValues; + using SysML2.NET.Core.POCO.Kernel.Functions; + + /// + /// Hand-coded part of the + /// + public static partial class FeatureValueTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeatureValue + /// FeatureValue=('='|isInitial?=':='|isDefault?='default'('='|isInitial?=':=')?)ownedRelatedElement+=OwnedExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeatureValueHandCoded(IFeatureValue poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.IsDefault) + { + stringBuilder.Append("default "); + + if (poco.IsInitial) + { + stringBuilder.Append(":= "); + } + else + { + stringBuilder.Append("= "); + } + } + else if (poco.IsInitial) + { + stringBuilder.Append(":= "); + } + else + { + stringBuilder.Append("= "); + } + + var ownedRelatedElementCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelatedElement", poco.OwnedRelatedElement); + + if (ownedRelatedElementCursor.Current is IExpression expression) + { + ExpressionTextualNotationBuilder.BuildOwnedExpression(expression, cursorCache, stringBuilder); + ownedRelatedElementCursor.Move(); + } + } + } +} diff --git a/SysML2.NET/TextualNotation/FlowTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/FlowTextualNotationBuilder.cs new file mode 100644 index 00000000..b944faf7 --- /dev/null +++ b/SysML2.NET/TextualNotation/FlowTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Interactions; + + /// + /// Hand-coded part of the + /// + public static partial class FlowTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(IFlow poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule FlowDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFlowDeclarationHandCoded(IFlow poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFlowDeclarationHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/FlowUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/FlowUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..3e835536 --- /dev/null +++ b/SysML2.NET/TextualNotation/FlowUsageTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Flows; + + /// + /// Hand-coded part of the + /// + public static partial class FlowUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FlowDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFlowDeclarationHandCoded(IFlowUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFlowDeclarationHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule MessageDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildMessageDeclarationHandCoded(IFlowUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildMessageDeclarationHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/ICursorCache.cs b/SysML2.NET/TextualNotation/ICursorCache.cs new file mode 100644 index 00000000..2d9d021d --- /dev/null +++ b/SysML2.NET/TextualNotation/ICursorCache.cs @@ -0,0 +1,42 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System; + using System.Collections.Generic; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// The provides caching and new cursor creation feature + /// + public interface ICursorCache: IDisposable + { + /// + /// Gets or create a new cursor an identified by its based on collection identified by the given . + /// + /// The of the + /// The name the related collection + /// The collection of that is used if the is not yet created + /// The + CollectionCursor GetOrCreateCursor(Guid elementId, string collectionName, IReadOnlyList elements); + } +} diff --git a/SysML2.NET/TextualNotation/IfActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/IfActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..702dd6fc --- /dev/null +++ b/SysML2.NET/TextualNotation/IfActionUsageTextualNotationBuilder.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Actions; + + /// + /// Hand-coded part of the + /// + public static partial class IfActionUsageTextualNotationBuilder + { + } +} diff --git a/SysML2.NET/TextualNotation/IncludeUseCaseUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/IncludeUseCaseUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..2e73a8c4 --- /dev/null +++ b/SysML2.NET/TextualNotation/IncludeUseCaseUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.UseCases; + + /// + /// Hand-coded part of the + /// + public static partial class IncludeUseCaseUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule IncludeUseCaseUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildIncludeUseCaseUsageHandCoded(IIncludeUseCaseUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildIncludeUseCaseUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/InterfaceUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/InterfaceUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..931684dd --- /dev/null +++ b/SysML2.NET/TextualNotation/InterfaceUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Interfaces; + + /// + /// Hand-coded part of the + /// + public static partial class InterfaceUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule InterfaceUsageDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildInterfaceUsageDeclarationHandCoded(IInterfaceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildInterfaceUsageDeclarationHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/InvariantTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/InvariantTextualNotationBuilder.cs new file mode 100644 index 00000000..3564fe43 --- /dev/null +++ b/SysML2.NET/TextualNotation/InvariantTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Functions; + + /// + /// Hand-coded part of the + /// + public static partial class InvariantTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(IInvariant poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/InvocationExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/InvocationExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..5fca3771 --- /dev/null +++ b/SysML2.NET/TextualNotation/InvocationExpressionTextualNotationBuilder.cs @@ -0,0 +1,42 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Expressions; + + /// + /// Hand-coded part of the + /// + public static partial class InvocationExpressionTextualNotationBuilder + { + /// + /// Build the non-existing InvocationTypeMember rule + /// + /// The from which the rule should be built + /// The + /// The + private static void BuildInvocationTypeMember(IInvocationExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + } + } +} diff --git a/SysML2.NET/TextualNotation/LiteralExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/LiteralExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..80c4e9df --- /dev/null +++ b/SysML2.NET/TextualNotation/LiteralExpressionTextualNotationBuilder.cs @@ -0,0 +1,42 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Expressions; + + /// + /// Hand-Coded part of the + /// + public static partial class LiteralExpressionTextualNotationBuilder + { + /// + /// Build the Value rule for real + /// + /// The + /// The used to get access to CursorCollection for the current + /// The + private static void BuildValue(ILiteralExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + } + } +} diff --git a/SysML2.NET/TextualNotation/MembershipValidationExtensions.cs b/SysML2.NET/TextualNotation/MembershipValidationExtensions.cs new file mode 100644 index 00000000..2b480bd7 --- /dev/null +++ b/SysML2.NET/TextualNotation/MembershipValidationExtensions.cs @@ -0,0 +1,123 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + + using SysML2.NET.Core.POCO.Core.Features; + using SysML2.NET.Core.POCO.Core.Types; + using SysML2.NET.Core.POCO.Root.Elements; + using SysML2.NET.Core.POCO.Root.Namespaces; + using SysML2.NET.Core.POCO.Systems.Allocations; + using SysML2.NET.Core.POCO.Systems.Connections; + using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; + using SysML2.NET.Core.POCO.Systems.Flows; + using SysML2.NET.Core.POCO.Systems.Interfaces; + using SysML2.NET.Core.POCO.Systems.Items; + using SysML2.NET.Core.POCO.Systems.Occurrences; + using SysML2.NET.Core.POCO.Systems.Parts; + using SysML2.NET.Core.POCO.Systems.Ports; + using SysML2.NET.Core.POCO.Systems.Views; + + /// + /// Extension methods for membership interfaces used in textual notation switch guards. + /// These provide the same validation logic as the concrete class methods but operate on interfaces. + /// + public static class MembershipValidationExtensions + { + /// + /// Asserts that the contains at least one + /// inside the collection + /// + /// The + /// True if one is contained in the + public static bool IsValidForNonFeatureMember(this IOwningMembership owningMembership) + { + return owningMembership.OwnedRelatedElement.OfType().Any(); + } + + /// + /// Asserts that the does not contain any + /// inside the collection + /// + /// The + /// True if no is contained in the + public static bool IsValidForFeatureMember(this IOwningMembership owningMembership) + { + return !owningMembership.IsValidForNonFeatureMember(); + } + + /// + /// Asserts that the contains at least one + /// inside the collection + /// + /// The + /// True if it contains one + public static bool IsValidForSourceSuccessionMember(this IFeatureMembership featureMembership) + { + return featureMembership.OwnedRelatedElement.OfType().Any(); + } + + /// + /// Asserts that the contains at least one + /// inside the collection + /// + /// The + /// True if it contains one + public static bool IsValidForOccurrenceUsageMember(this IFeatureMembership featureMembership) + { + return featureMembership.OwnedRelatedElement.OfType().Any(); + } + + /// + /// Asserts that the contains at least one + /// but no inside the collection + /// + /// The + /// True if it contains one but no + public static bool IsValidForNonOccurrenceUsageMember(this IFeatureMembership featureMembership) + { + return !featureMembership.IsValidForOccurrenceUsageMember() && featureMembership.OwnedRelatedElement.OfType().Any(); + } + + /// + /// Asserts that the has valid element types for StructureUsageMember + /// inside the collection + /// + /// The + /// True if contains any of the required element types + public static bool IsValidForStructureUsageMember(this IFeatureMembership featureMembership) + { + return featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any() + || featureMembership.OwnedRelatedElement.OfType().Any(); + } + } +} diff --git a/SysML2.NET/TextualNotation/NamespaceImportTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/NamespaceImportTextualNotationBuilder.cs new file mode 100644 index 00000000..929ab724 --- /dev/null +++ b/SysML2.NET/TextualNotation/NamespaceImportTextualNotationBuilder.cs @@ -0,0 +1,59 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Linq; + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Packages; + using SysML2.NET.Core.POCO.Root.Namespaces; + + /// + /// Hand-coded part of the + /// + public static partial class NamespaceImportTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule NamespaceImport + /// NamespaceImport=importedNamespace=[QualifiedName]'::''*'('::'isRecursive?='**')?|importedNamespace=FilterPackage{ownedRelatedElement+=importedNamespace} + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildNamespaceImportHandCoded(INamespaceImport poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + if (poco.OwnedRelatedElement.Contains(poco.ImportedNamespace) && poco.ImportedNamespace is IPackage filterPackage) + { + PackageTextualNotationBuilder.BuildFilterPackage(filterPackage, cursorCache, stringBuilder); + } + else if (poco.ImportedNamespace != null) + { + stringBuilder.Append(poco.ImportedNamespace.qualifiedName); + stringBuilder.Append("::* "); + + if (poco.IsRecursive) + { + stringBuilder.Append("::*** "); + } + } + } + } +} diff --git a/SysML2.NET/TextualNotation/OperatorExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/OperatorExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..de4a43ca --- /dev/null +++ b/SysML2.NET/TextualNotation/OperatorExpressionTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Expressions; + + /// + /// Hand-coded part of the + /// + public static partial class OperatorExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ClassificationExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildClassificationExpressionHandCoded(IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildClassificationExpressionHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule MetaclassificationExpression + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildMetaclassificationExpressionHandCoded(IOperatorExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildMetaclassificationExpressionHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/OwningMembershipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/OwningMembershipTextualNotationBuilder.cs new file mode 100644 index 00000000..212fd0b6 --- /dev/null +++ b/SysML2.NET/TextualNotation/OwningMembershipTextualNotationBuilder.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Root.Namespaces; + + /// + /// Hand-coded part of the + /// + public static partial class OwningMembershipTextualNotationBuilder + { + } +} diff --git a/SysML2.NET/TextualNotation/PackageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/PackageTextualNotationBuilder.cs new file mode 100644 index 00000000..3689d3bd --- /dev/null +++ b/SysML2.NET/TextualNotation/PackageTextualNotationBuilder.cs @@ -0,0 +1,42 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Packages; + + /// + /// Hand-coded part of the + /// + public static partial class PackageTextualNotationBuilder + { + /// + /// Build the non-existing Filter Package import rule + /// + /// The from which the rule should be built + /// The + /// The + private static void BuildFilterPackageImport(IPackage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + } + } +} diff --git a/SysML2.NET/TextualNotation/PerformActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/PerformActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..b887c9ab --- /dev/null +++ b/SysML2.NET/TextualNotation/PerformActionUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Actions; + + /// + /// Hand-coded part of the + /// + public static partial class PerformActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PerformActionUsageDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildPerformActionUsageDeclarationHandCoded(IPerformActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildPerformActionUsageDeclarationHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/ReferenceUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/ReferenceUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..40ae79bd --- /dev/null +++ b/SysML2.NET/TextualNotation/ReferenceUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; + + /// + /// Hand-coded part of the + /// + public static partial class ReferenceUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule PayloadParameter + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildPayloadParameterHandCoded(IReferenceUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildPayloadParameterHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/RelationshipTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/RelationshipTextualNotationBuilder.cs new file mode 100644 index 00000000..090ba963 --- /dev/null +++ b/SysML2.NET/TextualNotation/RelationshipTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Root.Elements; + + /// + /// Hand-coded part of the + /// + public static partial class RelationshipTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RelationshipOwnedElement + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildRelationshipOwnedElementHandCoded(IRelationship poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildRelationshipOwnedElementHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/RenderingUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/RenderingUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..22962d6e --- /dev/null +++ b/SysML2.NET/TextualNotation/RenderingUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Views; + + /// + /// Hand-coded part of the + /// + public static partial class RenderingUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule ViewRenderingUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildViewRenderingUsageHandCoded(IRenderingUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildViewRenderingUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/RequirementUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/RequirementUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..40061316 --- /dev/null +++ b/SysML2.NET/TextualNotation/RequirementUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Requirements; + + /// + /// Hand-coded part of the + /// + public static partial class RequirementUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule RequirementVerificationUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildRequirementVerificationUsageHandCoded(IRequirementUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildRequirementVerificationUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/SatisfyRequirementUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/SatisfyRequirementUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..160c34f8 --- /dev/null +++ b/SysML2.NET/TextualNotation/SatisfyRequirementUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Requirements; + + /// + /// Hand-coded part of the + /// + public static partial class SatisfyRequirementUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SatisfyRequirementUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildSatisfyRequirementUsageHandCoded(ISatisfyRequirementUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildSatisfyRequirementUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/SendActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/SendActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..fd52eb66 --- /dev/null +++ b/SysML2.NET/TextualNotation/SendActionUsageTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Actions; + + /// + /// Hand-coded part of the + /// + public static partial class SendActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule SendNode + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildSendNodeHandCoded(ISendActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildSendNodeHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule SenderReceiverPart + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildSenderReceiverPartHandCoded(ISendActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildSenderReceiverPartHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/StepTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/StepTextualNotationBuilder.cs new file mode 100644 index 00000000..851a4efe --- /dev/null +++ b/SysML2.NET/TextualNotation/StepTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Behaviors; + + /// + /// Hand-coded part of the + /// + public static partial class StepTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(IStep poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/SuccessionFlowTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/SuccessionFlowTextualNotationBuilder.cs new file mode 100644 index 00000000..ab1bcae7 --- /dev/null +++ b/SysML2.NET/TextualNotation/SuccessionFlowTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Interactions; + + /// + /// Hand-coded part of the + /// + public static partial class SuccessionFlowTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(ISuccessionFlow poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule FlowDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFlowDeclarationHandCoded(ISuccessionFlow poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFlowDeclarationHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/SuccessionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/SuccessionTextualNotationBuilder.cs new file mode 100644 index 00000000..b50bc54d --- /dev/null +++ b/SysML2.NET/TextualNotation/SuccessionTextualNotationBuilder.cs @@ -0,0 +1,54 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Kernel.Connectors; + + /// + /// Hand-coded part of the + /// + public static partial class SuccessionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule FeaturePrefix + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildFeaturePrefixHandCoded(ISuccession poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildFeaturePrefixHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule SuccessionDeclaration + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildSuccessionDeclarationHandCoded(ISuccession poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildSuccessionDeclarationHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/TextualNotationValidationExtensions.cs b/SysML2.NET/TextualNotation/TextualNotationValidationExtensions.cs new file mode 100644 index 00000000..1de987c5 --- /dev/null +++ b/SysML2.NET/TextualNotation/TextualNotationValidationExtensions.cs @@ -0,0 +1,342 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using SysML2.NET.Core.POCO.Core.Features; + using SysML2.NET.Core.POCO.Core.Types; + using SysML2.NET.Core.POCO.Kernel.Behaviors; + using SysML2.NET.Core.POCO.Kernel.Connectors; + using SysML2.NET.Core.POCO.Kernel.Expressions; + using SysML2.NET.Core.POCO.Kernel.Functions; + using SysML2.NET.Core.POCO.Systems.Connections; + using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; + using SysML2.NET.Core.POCO.Systems.Flows; + using SysML2.NET.Core.POCO.Systems.Interfaces; + using SysML2.NET.Core.POCO.Systems.Occurrences; + using SysML2.NET.Core.POCO.Systems.States; + + /// + /// Extension methods providing IsValidFor guards used in textual notation switch dispatchers. + /// These allow disambiguation when multiple grammar rule alternatives map to the same UML class. + /// + public static class TextualNotationValidationExtensions + { + /// + /// Asserts that the is valid for the Typings rule + /// + /// The + /// True if the feature matches the Typings rule + public static bool IsValidForTypings(this IFeature feature) + { + throw new System.NotSupportedException("IsValidForTypings requires manual implementation"); + } + + /// + /// Asserts that the is valid for the Subsettings rule + /// + /// The + /// True if the feature matches the Subsettings rule + public static bool IsValidForSubsettings(this IFeature feature) + { + throw new System.NotSupportedException("IsValidForSubsettings requires manual implementation"); + } + + /// + /// Asserts that the is valid for the References rule + /// + /// The + /// True if the feature matches the References rule + public static bool IsValidForReferences(this IFeature feature) + { + throw new System.NotSupportedException("IsValidForReferences requires manual implementation"); + } + + /// + /// Asserts that the is valid for the Crosses rule + /// + /// The + /// True if the feature matches the Crosses rule + public static bool IsValidForCrosses(this IFeature feature) + { + throw new System.NotSupportedException("IsValidForCrosses requires manual implementation"); + } + + /// + /// Asserts that the is valid for the ChainingPart rule + /// + /// The + /// True if the feature matches the ChainingPart rule + public static bool IsValidForChainingPart(this IFeature feature) + { + throw new System.NotSupportedException("IsValidForChainingPart requires manual implementation"); + } + + /// + /// Asserts that the is valid for the InvertingPart rule + /// + /// The + /// True if the feature matches the InvertingPart rule + public static bool IsValidForInvertingPart(this IFeature feature) + { + throw new System.NotSupportedException("IsValidForInvertingPart requires manual implementation"); + } + + /// + /// Asserts that the is valid for the PositionalArgumentList rule + /// + /// The + /// True if the feature matches the PositionalArgumentList rule + public static bool IsValidForPositionalArgumentList(this IFeature feature) + { + throw new System.NotSupportedException("IsValidForPositionalArgumentList requires manual implementation"); + } + + /// + /// Asserts that the is valid for the DisjoiningPart rule + /// + /// The + /// True if the type matches the DisjoiningPart rule + public static bool IsValidForDisjoiningPart(this IType type) + { + throw new System.NotSupportedException("IsValidForDisjoiningPart requires manual implementation"); + } + + /// + /// Asserts that the is valid for the UnioningPart rule + /// + /// The + /// True if the type matches the UnioningPart rule + public static bool IsValidForUnioningPart(this IType type) + { + throw new System.NotSupportedException("IsValidForUnioningPart requires manual implementation"); + } + + /// + /// Asserts that the is valid for the IntersectingPart rule + /// + /// The + /// True if the type matches the IntersectingPart rule + public static bool IsValidForIntersectingPart(this IType type) + { + throw new System.NotSupportedException("IsValidForIntersectingPart requires manual implementation"); + } + + /// + /// Asserts that the is valid for the BehaviorUsageMember rule + /// + /// The + /// True if the membership matches the BehaviorUsageMember rule + public static bool IsValidForBehaviorUsageMember(this IFeatureMembership featureMembership) + { + throw new System.NotSupportedException("IsValidForBehaviorUsageMember requires manual implementation"); + } + + /// + /// Asserts that the is valid for the BinaryConnectorDeclaration rule + /// + /// The + /// True if the connector matches the BinaryConnectorDeclaration rule + public static bool IsValidForBinaryConnectorDeclaration(this IConnector connector) + { + throw new System.NotSupportedException("IsValidForBinaryConnectorDeclaration requires manual implementation"); + } + + /// + /// Asserts that the is valid for the BinaryConnectorPart rule + /// + /// The + /// True if the connection usage matches the BinaryConnectorPart rule + public static bool IsValidForBinaryConnectorPart(this IConnectionUsage connectionUsage) + { + throw new System.NotSupportedException("IsValidForBinaryConnectorPart requires manual implementation"); + } + + /// + /// Asserts that the is valid for the BinaryInterfacePart rule + /// + /// The + /// True if the interface usage matches the BinaryInterfacePart rule + public static bool IsValidForBinaryInterfacePart(this IInterfaceUsage interfaceUsage) + { + throw new System.NotSupportedException("IsValidForBinaryInterfacePart requires manual implementation"); + } + + /// + /// Asserts that the is valid for the StructureUsageElement rule + /// + /// The + /// True if the usage matches the StructureUsageElement rule + public static bool IsValidForStructureUsageElement(this IUsage usage) + { + throw new System.NotSupportedException("IsValidForStructureUsageElement requires manual implementation"); + } + + /// + /// Asserts that the is valid for the OccurrenceUsage rule + /// + /// The + /// True if the occurrence usage matches the OccurrenceUsage rule + public static bool IsValidForOccurrenceUsage(this IOccurrenceUsage occurrenceUsage) + { + throw new System.NotSupportedException("IsValidForOccurrenceUsage requires manual implementation"); + } + + /// + /// Asserts that the is valid for the IndividualUsage rule + /// + /// The + /// True if the occurrence usage matches the IndividualUsage rule + public static bool IsValidForIndividualUsage(this IOccurrenceUsage occurrenceUsage) + { + throw new System.NotSupportedException("IsValidForIndividualUsage requires manual implementation"); + } + + /// + /// Asserts that the is valid for the OccurrenceDefinition rule + /// + /// The + /// True if the occurrence definition matches the OccurrenceDefinition rule + public static bool IsValidForOccurrenceDefinition(this IOccurrenceDefinition occurrenceDefinition) + { + throw new System.NotSupportedException("IsValidForOccurrenceDefinition requires manual implementation"); + } + + /// + /// Asserts that the is valid for the FlowUsage rule + /// + /// The + /// True if the flow usage matches the FlowUsage rule + public static bool IsValidForFlowUsage(this IFlowUsage flowUsage) + { + throw new System.NotSupportedException("IsValidForFlowUsage requires manual implementation"); + } + + /// + /// Asserts that the is valid for the Message rule + /// + /// The + /// True if the flow usage matches the Message rule + public static bool IsValidForMessage(this IFlowUsage flowUsage) + { + throw new System.NotSupportedException("IsValidForMessage requires manual implementation"); + } + + /// + /// Asserts that the is valid for the GuardedTargetSuccession rule + /// + /// The + /// True if the transition usage matches the GuardedTargetSuccession rule + public static bool IsValidForGuardedTargetSuccession(this ITransitionUsage transitionUsage) + { + throw new System.NotSupportedException("IsValidForGuardedTargetSuccession requires manual implementation"); + } + + /// + /// Asserts that the is valid for the ActionBodyParameterMember rule + /// + /// The + /// True if the parameter membership matches the ActionBodyParameterMember rule + public static bool IsValidForActionBodyParameterMember(this IParameterMembership parameterMembership) + { + throw new System.NotSupportedException("IsValidForActionBodyParameterMember requires manual implementation"); + } + + /// + /// Asserts that the is valid for the ConditionalExpression rule + /// + /// The + /// True if the expression matches the ConditionalExpression rule + public static bool IsValidForConditionalExpression(this IOperatorExpression operatorExpression) + { + throw new System.NotSupportedException("IsValidForConditionalExpression requires manual implementation"); + } + + /// + /// Asserts that the is valid for the ConditionalBinaryOperatorExpression rule + /// + /// The + /// True if the expression matches the ConditionalBinaryOperatorExpression rule + public static bool IsValidForConditionalBinaryOperatorExpression(this IOperatorExpression operatorExpression) + { + throw new System.NotSupportedException("IsValidForConditionalBinaryOperatorExpression requires manual implementation"); + } + + /// + /// Asserts that the is valid for the BinaryOperatorExpression rule + /// + /// The + /// True if the expression matches the BinaryOperatorExpression rule + public static bool IsValidForBinaryOperatorExpression(this IOperatorExpression operatorExpression) + { + throw new System.NotSupportedException("IsValidForBinaryOperatorExpression requires manual implementation"); + } + + /// + /// Asserts that the is valid for the UnaryOperatorExpression rule + /// + /// The + /// True if the expression matches the UnaryOperatorExpression rule + public static bool IsValidForUnaryOperatorExpression(this IOperatorExpression operatorExpression) + { + throw new System.NotSupportedException("IsValidForUnaryOperatorExpression requires manual implementation"); + } + + /// + /// Asserts that the is valid for the ClassificationExpression rule + /// + /// The + /// True if the expression matches the ClassificationExpression rule + public static bool IsValidForClassificationExpression(this IOperatorExpression operatorExpression) + { + throw new System.NotSupportedException("IsValidForClassificationExpression requires manual implementation"); + } + + /// + /// Asserts that the is valid for the MetaclassificationExpression rule + /// + /// The + /// True if the expression matches the MetaclassificationExpression rule + public static bool IsValidForMetaclassificationExpression(this IOperatorExpression operatorExpression) + { + throw new System.NotSupportedException("IsValidForMetaclassificationExpression requires manual implementation"); + } + + /// + /// Asserts that the is valid for the SequenceExpression rule + /// + /// The + /// True if the expression matches the SequenceExpression rule + public static bool IsValidForSequenceExpression(this IExpression expression) + { + throw new System.NotSupportedException("IsValidForSequenceExpression requires manual implementation"); + } + + /// + /// Asserts that the is valid for the FeatureReferenceExpression rule + /// + /// The + /// True if the expression matches the FeatureReferenceExpression rule + public static bool IsValidForFeatureReferenceExpression(this IFeatureReferenceExpression featureReferenceExpression) + { + throw new System.NotSupportedException("IsValidForFeatureReferenceExpression requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/TransitionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/TransitionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..f3de2797 --- /dev/null +++ b/SysML2.NET/TextualNotation/TransitionUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.States; + + /// + /// Hand-coded part of the + /// + public static partial class TransitionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TargetTransitionUsage + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildTargetTransitionUsageHandCoded(ITransitionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildTargetTransitionUsageHandCoded requires manual implementation"); + } + } +} diff --git a/SysML2.NET/TextualNotation/TriggerInvocationExpressionTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/TriggerInvocationExpressionTextualNotationBuilder.cs new file mode 100644 index 00000000..3c880a9a --- /dev/null +++ b/SysML2.NET/TextualNotation/TriggerInvocationExpressionTextualNotationBuilder.cs @@ -0,0 +1,72 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.Systems.Actions; + using SysML2.NET.Core.POCO.Kernel.Behaviors; + using SysML2.NET.Core.POCO.Systems.Actions; + + /// + /// Hand-coded part of the + /// + public static partial class TriggerInvocationExpressionTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule TriggerExpression + /// TriggerExpression:TriggerInvocationExpression=kind=('at'|'after')ownedRelationship+=ArgumentMember|kind='when'ownedRelationship+=ArgumentExpressionMember + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildTriggerExpressionHandCoded(ITriggerInvocationExpression poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + switch (poco.Kind) + { + case TriggerKind.At: + case TriggerKind.After: + stringBuilder.Append(poco.Kind.ToString().ToLower()); + stringBuilder.Append(' '); + + if (ownedRelationshipCursor.Current is IParameterMembership argumentMember) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentMember(argumentMember, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + break; + case TriggerKind.When: + stringBuilder.Append("when "); + + if (ownedRelationshipCursor.Current is IParameterMembership argumentExpressionMember) + { + ParameterMembershipTextualNotationBuilder.BuildArgumentExpressionMember(argumentExpressionMember, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + + break; + } + } + } +} diff --git a/SysML2.NET/TextualNotation/TypeTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/TypeTextualNotationBuilder.cs new file mode 100644 index 00000000..9a4edd9f --- /dev/null +++ b/SysML2.NET/TextualNotation/TypeTextualNotationBuilder.cs @@ -0,0 +1,232 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Core.Types; + using SysML2.NET.Core.POCO.Root.Elements; + using SysML2.NET.Core.POCO.Root.Namespaces; + using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; + + /// + /// Hand-coded part of the + /// + public static partial class TypeTextualNotationBuilder + { + /// + /// Build the complex DefinitionBodyItem:Type=ownedRelationship+=DefinitionMember|ownedRelationship+=VariantUsageMember|ownedRelationship+=NonOccurrenceUsageMember|(ownedRelationship+=SourceSuccessionMember)?ownedRelationship+=OccurrenceUsageMember|ownedRelationship+=AliasMember|ownedRelationship+=Import rule + /// + /// The + /// The used to get access to CursorCollection for the current + /// The + internal static void BuildDefinitionBodyItemInternal(IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + while (ownedRelationshipCursor.Current != null) + { + switch (ownedRelationshipCursor.Current) + { + case IVariantMembership variantMembership: + VariantMembershipTextualNotationBuilder.BuildVariantUsageMember(variantMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case FeatureMembership featureMembershipForSuccession when featureMembershipForSuccession.IsValidForSourceSuccessionMember(): + { + var nextElement = ownedRelationshipCursor.GetNext(1); + + if (nextElement is FeatureMembership nextFeatureMembership && nextFeatureMembership.IsValidForOccurrenceUsageMember()) + { + FeatureMembershipTextualNotationBuilder.BuildSourceSuccessionMember(featureMembershipForSuccession, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + FeatureMembershipTextualNotationBuilder.BuildOccurrenceUsageMember((IFeatureMembership)ownedRelationshipCursor.Current, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else + { + ownedRelationshipCursor.Move(); + } + + break; + } + + case FeatureMembership featureMembershipForOccurrence when featureMembershipForOccurrence.IsValidForOccurrenceUsageMember(): + FeatureMembershipTextualNotationBuilder.BuildOccurrenceUsageMember(featureMembershipForOccurrence, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case FeatureMembership featureMembershipForNonOccurrence when featureMembershipForNonOccurrence.IsValidForNonOccurrenceUsageMember(): + FeatureMembershipTextualNotationBuilder.BuildNonOccurrenceUsageMember(featureMembershipForNonOccurrence, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case IOwningMembership owningMembership: + OwningMembershipTextualNotationBuilder.BuildDefinitionMember(owningMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case IMembership membership: + MembershipTextualNotationBuilder.BuildAliasMember(membership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case IImport import: + ImportTextualNotationBuilder.BuildImport(import, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + default: + ownedRelationshipCursor.Move(); + break; + } + } + } + + /// + /// Build the logic for the NonBehaviorBodyItem =ownedRelationship+=Import|ownedRelationship+=AliasMember|ownedRelationship+=DefinitionMember|ownedRelationship+=VariantUsageMember|ownedRelationship+=NonOccurrenceUsageMember|(ownedRelationship+=SourceSuccessionMember)?ownedRelationship+=StructureUsageMember rule + /// + /// The + /// The used to get access to CursorCollection for the current + /// The + internal static void BuildNonBehaviorBodyItemInternal(IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + var ownedRelationshipCursor = cursorCache.GetOrCreateCursor(poco.Id, "ownedRelationship", poco.OwnedRelationship); + + while (ownedRelationshipCursor.Current != null) + { + switch (ownedRelationshipCursor.Current) + { + case IImport import: + ImportTextualNotationBuilder.BuildImport(import, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case IVariantMembership variantMembership: + VariantMembershipTextualNotationBuilder.BuildVariantUsageMember(variantMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case FeatureMembership featureMembershipForSuccession when featureMembershipForSuccession.IsValidForSourceSuccessionMember(): + { + var nextElement = ownedRelationshipCursor.GetNext(1); + + if (nextElement is FeatureMembership nextFeatureMembership && nextFeatureMembership.IsValidForStructureUsageMember()) + { + FeatureMembershipTextualNotationBuilder.BuildSourceSuccessionMember(featureMembershipForSuccession, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + FeatureMembershipTextualNotationBuilder.BuildStructureUsageMember((IFeatureMembership)ownedRelationshipCursor.Current, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + } + else + { + ownedRelationshipCursor.Move(); + } + + break; + } + + case FeatureMembership featureMembershipForStructure when featureMembershipForStructure.IsValidForStructureUsageMember(): + FeatureMembershipTextualNotationBuilder.BuildStructureUsageMember(featureMembershipForStructure, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case FeatureMembership featureMembershipForNonOccurrence when featureMembershipForNonOccurrence.IsValidForNonOccurrenceUsageMember(): + FeatureMembershipTextualNotationBuilder.BuildNonOccurrenceUsageMember(featureMembershipForNonOccurrence, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case IOwningMembership owningMembership: + OwningMembershipTextualNotationBuilder.BuildDefinitionMember(owningMembership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + case IMembership membership: + MembershipTextualNotationBuilder.BuildAliasMember(membership, cursorCache, stringBuilder); + ownedRelationshipCursor.Move(); + break; + + default: + ownedRelationshipCursor.Move(); + break; + } + } + } + + /// + /// Builds the Textual Notation string for the rule ActionBodyItem + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildActionBodyItemHandCoded(IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildActionBodyItemHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule DefinitionBodyItem + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildDefinitionBodyItemHandCoded(IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildDefinitionBodyItemHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule TypeDeclaration + /// TypeDeclaration:Type=Identification?ownedRelationship+=OwnedSubclassification + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildTypeDeclarationHandCoded(IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildTypeDeclarationHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule InterfaceBodyItem + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildInterfaceBodyItemHandCoded(IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildInterfaceBodyItemHandCoded requires manual implementation"); + } + + /// + /// Builds the Textual Notation string for the rule StateBodyItem + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildStateBodyItemHandCoded(IType poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildStateBodyItemHandCoded requires manual implementation"); + } + + } +} diff --git a/SysML2.NET/TextualNotation/UsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/UsageTextualNotationBuilder.cs new file mode 100644 index 00000000..7c376a98 --- /dev/null +++ b/SysML2.NET/TextualNotation/UsageTextualNotationBuilder.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; + + /// + /// Hand-coded part of the + /// + public static partial class UsageTextualNotationBuilder + { + } +} diff --git a/SysML2.NET/TextualNotation/WhileLoopActionUsageTextualNotationBuilder.cs b/SysML2.NET/TextualNotation/WhileLoopActionUsageTextualNotationBuilder.cs new file mode 100644 index 00000000..fa801ee5 --- /dev/null +++ b/SysML2.NET/TextualNotation/WhileLoopActionUsageTextualNotationBuilder.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------- +// +// +// Copyright 2022-2026 Starion Group S.A. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// ------------------------------------------------------------------------------------------------ + +namespace SysML2.NET.TextualNotation +{ + using System.Text; + + using SysML2.NET.Core.POCO.Systems.Actions; + + /// + /// Hand-coded part of the + /// + public static partial class WhileLoopActionUsageTextualNotationBuilder + { + /// + /// Builds the Textual Notation string for the rule WhileLoopNode + /// + /// The from which the rule should be build + /// The used to get access to CursorCollection for the current + /// The that contains the entire textual notation + private static void BuildWhileLoopNodeHandCoded(IWhileLoopActionUsage poco, ICursorCache cursorCache, StringBuilder stringBuilder) + { + throw new System.NotSupportedException("BuildWhileLoopNodeHandCoded requires manual implementation"); + } + } +}