Skip to content

Commit

Permalink
Refactor: Remove properties, add collection methods
Browse files Browse the repository at this point in the history
Updated `TestCollectionOrderer` attribute namespace in `DisplayNameOrderer.cs`. Removed various `Onliner` type properties and `Parent` and `Interpreter` properties across multiple classes and namespaces. Added methods `GetChildren`, `GetKids`, and `GetValueTags` to return collections of children, elements, and value tags. Updated `units.csproj` to target `net9.0` and updated package references.
  • Loading branch information
PTKu committed Nov 28, 2024
1 parent ff91831 commit 94d2916
Show file tree
Hide file tree
Showing 70 changed files with 292 additions and 526 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using Xunit.Abstractions;

[assembly: TestCollectionOrderer("AXSharp.CompilerTests.DisplayNameOrderer", "AXSharp.CompilerTests")]
[assembly: TestCollectionOrderer("AXSharp.Compiler.CsTests.DisplayNameOrderer", "AXSharp.Compiler.CsTests")]
[assembly: CollectionBehavior(DisableTestParallelization = true)]

namespace AXSharp.Compiler.CsTests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
public partial class AbstractMotor : AXSharp.Connector.ITwinObject
{
public OnlinerBool Run { get; }

public OnlinerBool ReverseDirection { get; }

partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
Expand Down Expand Up @@ -158,18 +157,21 @@ public void Poll()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -226,8 +228,6 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace ArrayDeclarationSimpleNamespace
public partial class array_declaration_class : AXSharp.Connector.ITwinObject
{
public OnlinerInt[] primitive { get; }

public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; }

partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
Expand Down Expand Up @@ -182,18 +181,21 @@ public ArrayDeclarationSimpleNamespace.Pocos.array_declaration_class CreateEmpty
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -250,9 +252,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

Expand Down Expand Up @@ -375,18 +375,21 @@ public ArrayDeclarationSimpleNamespace.Pocos.some_complex_type CreateEmptyPoco()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -443,9 +446,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,26 @@
public partial class class_all_primitives : AXSharp.Connector.ITwinObject
{
public OnlinerBool myBOOL { get; }

public OnlinerByte myBYTE { get; }

public OnlinerWord myWORD { get; }

public OnlinerDWord myDWORD { get; }

public OnlinerLWord myLWORD { get; }

public OnlinerSInt mySINT { get; }

public OnlinerInt myINT { get; }

public OnlinerDInt myDINT { get; }

public OnlinerLInt myLINT { get; }

public OnlinerUSInt myUSINT { get; }

public OnlinerUInt myUINT { get; }

public OnlinerUDInt myUDINT { get; }

public OnlinerULInt myULINT { get; }

public OnlinerReal myREAL { get; }

public OnlinerLReal myLREAL { get; }

public OnlinerTime myTIME { get; }

public OnlinerLTime myLTIME { get; }

public OnlinerDate myDATE { get; }

public OnlinerTimeOfDay myTIME_OF_DAY { get; }

public OnlinerDateTime myDATE_AND_TIME { get; }

public OnlinerString mySTRING { get; }

public OnlinerWString myWSTRING { get; }

partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
Expand Down Expand Up @@ -498,18 +477,21 @@ public void Poll()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -566,8 +548,6 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ namespace Simatic.Ax.StateFramework
public partial class AbstractState : AXSharp.Connector.ITwinObject, IState, IStateMuteable
{
public OnlinerInt StateID { get; }

public OnlinerString StateName { get; }

partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
Expand Down Expand Up @@ -292,18 +291,21 @@ public Simatic.Ax.StateFramework.Pocos.AbstractState CreateEmptyPoco()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -360,9 +362,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,21 @@ public void Poll()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -321,8 +324,6 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,21 @@ public void Poll()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -321,9 +324,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,21 @@ public Generics.Pocos.Extender CreateEmptyPoco()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -194,16 +197,13 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Extendee : Generics.Extender<Generics.SomeType, Pocos.Generics.SomeType>
{
public Generics.SomeType SomeType { get; }

public Generics.SomeType SomeTypeAsPoco { get; }

partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
Expand Down Expand Up @@ -646,18 +646,21 @@ public Generics.Pocos.SomeType CreateEmptyPoco()
}

private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();

public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
{
return Children;
}

private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();

public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
{
return Kids;
}

private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();

public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
{
return ValueTags;
Expand Down Expand Up @@ -714,9 +717,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
}

protected System.String @SymbolTail { get; set; }

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Loading

0 comments on commit 94d2916

Please sign in to comment.