This commit is contained in:
2026-05-30 01:05:14 +02:00
parent 9c7c414bc9
commit f2b3989910
19 changed files with 266 additions and 144 deletions

View File

@@ -7,13 +7,36 @@ public class NoduleConnection
public Nodule A { get; set; }
public Nodule B { get; set; }
protected bool Equals(NoduleConnection other)
public override bool Equals(object obj)
{
return Equals(A, other.A) && Equals(B, other.B);
if (ReferenceEquals(null, obj))
return false;
if (ReferenceEquals(this, obj))
return true;
return obj.GetType() == GetType() && Equals((NoduleConnection)obj);
}
private bool Equals(NoduleConnection other)
{
return (Equals(A, other.A) && Equals(B, other.B))
|| (Equals(A, other.B) && Equals(B, other.A));
}
public override int GetHashCode()
{
return HashCode.Combine(A, B);
var h1 = A?.GetHashCode() ?? 0;
var h2 = B?.GetHashCode() ?? 0;
return h1 ^ h2;
}
}
public static bool operator ==(NoduleConnection left, NoduleConnection right)
{
return Equals(left, right);
}
public static bool operator !=(NoduleConnection left, NoduleConnection right)
{
return !Equals(left, right);
}
}