Skip to content

Commit

Permalink
Reworked the FBD model. Moved to single Block.cs class. Added factory…
Browse files Browse the repository at this point in the history
… methods for creating different elements and blocks.
  • Loading branch information
tnunnink committed Nov 25, 2023
1 parent d2f8651 commit 82f30e8
Show file tree
Hide file tree
Showing 44 changed files with 1,526 additions and 2,788 deletions.
139 changes: 77 additions & 62 deletions src/.idea/.idea.L5Sharp/.idea/workspace.xml

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/L5Sharp/Common/Argument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,20 @@ public static Argument Parse(string? value)

/// <inheritdoc />
public override string ToString() => _value.ToString();

/// <summary>
/// Determines whether two Argument objects are equal.
/// </summary>
/// <param name="left">The left Argument object.</param>
/// <param name="right">The right Argument object.</param>
/// <returns>Returns true if the two objects are equal, otherwise false.</returns>
public static bool operator ==(Argument left, Argument right) => Equals(left, right);

/// <summary>
/// Defines the inequality operator for the Argument class.
/// </summary>
/// <param name="left">The left Argument object.</param>
/// <param name="right">The right Argument object.</param>
/// <returns>true if the left Argument is not equal to the right Argument; otherwise, false.</returns>
public static bool operator !=(Argument left, Argument right) => Equals(left, right);
}
2 changes: 1 addition & 1 deletion src/L5Sharp/Common/CrossReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public CrossReference(XElement element, string type, string reference, Instructi
/// The <see cref="LogixElement"/> that is contains the reference to the component.
/// </summary>
/// <value>The <see cref="LogixElement"/> object that contains the component reference. This may be another
/// <c>Component</c>, a <c>Code</c> instance, or even a single <c>DiagramBlock</c> object.</value>
/// <c>Component</c>, a <c>Code</c> instance, or even a single <c>DiagramElement</c> object.</value>
public LogixElement Element => _element.Deserialize();

/// <summary>
Expand Down
130 changes: 0 additions & 130 deletions src/L5Sharp/Common/Params.cs

This file was deleted.

38 changes: 38 additions & 0 deletions src/L5Sharp/Common/TagMap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Collections;
using System.Collections.Generic;

namespace L5Sharp.Common;

public class TagMap : IEnumerable<KeyValuePair<TagName, TagName>>
{
private readonly List<KeyValuePair<TagName, TagName>> _map = new();

/// <summary>
/// Represents a mapping class for tags.
/// </summary>
public TagMap()
{
}

/// <summary>
///
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
public void Map(TagName from, TagName to)
{
if (from is null) throw new ArgumentNullException(nameof(from));
if (to is null) throw new ArgumentNullException(nameof(to));
if (from.IsEmpty) throw new ArgumentException("Can not create mapping for empty tag.");
if (to.IsEmpty) throw new ArgumentException("Can not create mapping for empty tag.");
_map.Add(new KeyValuePair<TagName, TagName>(from, to));
}

/// <inheritdoc />
public IEnumerator<KeyValuePair<TagName, TagName>> GetEnumerator() => _map.GetEnumerator();

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
137 changes: 0 additions & 137 deletions src/L5Sharp/Elements/AOI.cs

This file was deleted.

Loading

0 comments on commit 82f30e8

Please sign in to comment.