From 5f4e2bb5f0b8ca0f37fc203a73bc955fa5501d0d Mon Sep 17 00:00:00 2001 From: C9Glax <13404778+C9Glax@users.noreply.github.com> Date: Wed, 8 Feb 2023 18:08:01 +0100 Subject: [PATCH] Added Override for Equals() GetHashCode() ToString() --- OSMDatastructure/OsmNode.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/OSMDatastructure/OsmNode.cs b/OSMDatastructure/OsmNode.cs index 73b1a94..e808014 100644 --- a/OSMDatastructure/OsmNode.cs +++ b/OSMDatastructure/OsmNode.cs @@ -28,4 +28,22 @@ public class OsmNode return e; return null; } + + public override bool Equals(object? obj) + { + return obj != null && obj.GetType() == this.GetType() && ((OsmNode)obj).coordinates.Equals(this.coordinates); + } + + public override int GetHashCode() + { + return HashCode.Combine(coordinates); + } + + public override string ToString() + { + return string.Format( + "NODE {0} Edges-Count: {1} previousPathNode: {2} currentPathWeight: {3} directDistanceToGoal: {4}", + this.coordinates.ToString(), this.edges.Count, this.previousPathNode.coordinates.ToString(), + this.currentPathWeight, this.directDistanceToGoal); + } } \ No newline at end of file