aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/IML/NodeAddress.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-11-11 11:15:57 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-11-11 11:15:57 +0100
commitadbb4fd07a7c7ed236553d928be25c41c7106c27 (patch)
treedbd02c0cd8aa67330666deabc16d0c3336526f75 /src/IML/NodeAddress.cs
parent7308ca2173ccb4049d986bb08e8d3d08fca58b4e (diff)
NodeAddress hashcode
Diffstat (limited to 'src/IML/NodeAddress.cs')
-rw-r--r--src/IML/NodeAddress.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/IML/NodeAddress.cs b/src/IML/NodeAddress.cs
index 4b906975..95341ac7 100644
--- a/src/IML/NodeAddress.cs
+++ b/src/IML/NodeAddress.cs
@@ -30,6 +30,15 @@ namespace Crow.IML
{
return obj is NodeAddress && this == obj as NodeAddress;
}
+ public override int GetHashCode ()
+ {
+ unchecked {
+ int hash = 19;
+ foreach (Node n in this)
+ hash = hash * 31 + (n == null ? 0 : n.GetHashCode ());
+ return hash;
+ }
+ }
public static bool operator == (NodeAddress x, NodeAddress y)
{
return x.SequenceEqual (y);
@@ -38,5 +47,13 @@ namespace Crow.IML
{
return !(x == y);
}
+
+ public override string ToString ()
+ {
+ string tmp = "";
+ foreach (Node n in this)
+ tmp += string.Format ("{0}[{1}];", n.CrowType.Name, n.Index);
+ return tmp;
+ }
}
}