Added Override for Equals() GetHashCode() ToString()

This commit is contained in:
C9Glax 2023-02-08 18:08:01 +01:00
parent 31b2810178
commit 5f4e2bb5f0

View File

@ -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);
}
}