Skip to content

Commit

Permalink
Added AssociationClass (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbm0115 authored Apr 6, 2023
1 parent ae9cdb3 commit 35b9545
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
8 changes: 8 additions & 0 deletions MtconnectTranspiler/Contracts/XmlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ public class UmlStructure
/// <c>&lt;ownedAttribute xmi:type='uml:Property' /&gt;</c>
/// </summary>
public const string Property = "uml:Property";
/// <summary>
/// <c>&lt;ownedAttribute xmi:type='uml:AssociationClass' /&gt;</c>
/// </summary>
public const string AssociationClass = "uml:AssociationClass";
/// <summary>
/// <c>&lt;ownedAttribute xmi:type='uml:Association' /&gt;</c>
/// </summary>
public const string Association = "uml:Association";
#endregion
}
}
Expand Down
2 changes: 1 addition & 1 deletion MtconnectTranspiler/MtconnectTranspiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>MTConnect Transpiler</Title>
<Version>1.0.6</Version>
<Version>1.0.7</Version>
<Authors>mtconnect, tbm0115</Authors>
<Company>MTConnect Institute; TAMS;</Company>
<Description>A library capable of parsing an XMI for the MTConnect Standard and passing it to an implemented transpiler.</Description>
Expand Down
21 changes: 21 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlAssociation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using MtconnectTranspiler.Contracts;
using System;
using System.Xml.Serialization;

namespace MtconnectTranspiler.Xmi.UML
{
/// <summary>
/// <inheritdoc cref="MtconnectTranspiler.Xmi.PackagedElement"/> where <c>xmi:type='uml:Association'</c>
/// </summary>
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.PACKAGED_ELEMENT, Namespace = "")]
public class UmlAssociation : PackagedElement
{
/// <summary>
/// Collection of <inheritdoc cref="MemberEnd"/>
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.MEMBER_END, Namespace = "")]
public MemberEnd[]? MemberEnds { get; set; }

// TODO: Add <ownedEnd xmi:type='uml:Property' />
}
}
19 changes: 19 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlAssociationClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using MtconnectTranspiler.Contracts;
using System;
using System.Xml.Serialization;

namespace MtconnectTranspiler.Xmi.UML
{
/// <summary>
/// <inheritdoc cref="MtconnectTranspiler.Xmi.PackagedElement"/> where <c>xmi:type='uml:AssociationClass'</c>
/// </summary>
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.PACKAGED_ELEMENT, Namespace = "")]
public class UmlAssociationClass : UmlClass
{
/// <summary>
/// Collection of <inheritdoc cref="MemberEnd"/>
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.MEMBER_END, Namespace = "")]
public MemberEnd[]? MemberEnds { get; set; }
}
}
23 changes: 23 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class UmlPackage : PackagedElement
/// <item><c>&lt;packagedElement xmi:type='uml:Stereotype' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:Extension' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:Package' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:Association' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:AssociationClass' /&gt;</c></item>
/// </list>
/// </summary>
[XmlAnyElement(XmlHelper.XmiStructure.PACKAGED_ELEMENT, Namespace = "")]
Expand Down Expand Up @@ -97,6 +99,27 @@ public class UmlPackage : PackagedElement
[XmlIgnore]
public PackagedElementCollection<UmlDataType> DataTypes => _dataTypes ??= PackagedElementCollection<UmlDataType>.Deserialize(PackagedElements, XmlHelper.UmlStructure.DataType);

/// <summary>
/// Internal switch property for <see cref="Associations"/>.
/// </summary>
[XmlIgnore]
private PackagedElementCollection<UmlAssociation>? _associations;
/// <summary>
/// Collection of <inheritdoc cref="MtconnectTranspiler.Xmi.UML.UmlAssociation"/>
/// </summary>
[XmlIgnore]
public PackagedElementCollection<UmlAssociation> Associations => _associations ??= PackagedElementCollection<UmlAssociation>.Deserialize(PackagedElements, XmlHelper.UmlStructure.Association);

/// <summary>
/// Internal switch property for <see cref="AssociationClasses"/>.
/// </summary>
[XmlIgnore]
private PackagedElementCollection<UmlAssociationClass>? _associationClasses;
/// <summary>
/// Collection of <inheritdoc cref="MtconnectTranspiler.Xmi.UML.UmlAssociationClass"/>
/// </summary>
[XmlIgnore]
public PackagedElementCollection<UmlAssociationClass> AssociationClasses => _associationClasses ??= PackagedElementCollection<UmlAssociationClass>.Deserialize(PackagedElements, XmlHelper.UmlStructure.AssociationClass);
//// TODO: Add xmi:Extension

}
Expand Down

0 comments on commit 35b9545

Please sign in to comment.