namespace HeuristicLab.Problems.RoutePlanning.Graph { public class Vertex { private static long idCounter = 0; private long id; public long Id { get { return id; } } private T node; public T Node { get { return node; } } public Vertex(T node) { this.node = node; this.id = idCounter++; } public static bool operator ==(Vertex v1, Vertex v2) { if ((object)v1 == null) { if ((object)v2 == null) { return true; } return false; } if ((object)v1 == null && (object)v2 != null) { return false; } return v1.Equals(v2); } public static bool operator !=(Vertex v1, Vertex v2) { return !(v1 == v2); } public override bool Equals(object obj) { if (obj is Vertex) { Vertex graph = (obj as Vertex); return this.Equals(graph); } return false; } public override int GetHashCode() { return typeof(T).GetHashCode() ^ this.Node.GetHashCode(); } public override string ToString() { return string.Format("{0}", this.Node); } } }