asd
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user