using HeuristicLab.Problems.RoutePlanning.Interfaces; namespace HeuristicLab.Problems.RoutePlanning.RoutingGraph { public class Edge : IEdge { private readonly Vertex source; public Vertex Source { get { return this.source; } } private readonly Vertex target; public Vertex Target { get { return this.target; } } //private short category; //public short Category { // get { return category; } // set { category = value; } //} private float weight; public float Weight { get { return weight; } set { weight = value; } } public Edge(Vertex source, Vertex target) : this(source, target, 0) { } public Edge(Vertex source, Vertex target, float weight) { this.source = source; this.target = target; this.weight = weight; } public override string ToString() { return string.Format("{0}->{1}", this.Source, this.Target); } public override bool Equals(object obj) { if (obj is Edge) { Edge e = (obj as Edge); return (this.source.Equals(e.source)) && (this.target.Equals(e.target)); } return false; } public override int GetHashCode() { return source.GetHashCode() ^ target.GetHashCode(); } } }