using System; namespace Microsoft.Msagl.Layout.Layered { /// /// This is an edge going down only one layer. /// It points to the original edge that can pass several layers /// /// #if TEST_MSAGL public #else internal #endif class LayerEdge { internal int Weight = 1; internal LayerEdge(int source, int target, int crossingWeight, int weight) { this.Source = source; this.Target = target; this.crossingWeight = crossingWeight; Weight = weight; } internal LayerEdge(int source, int target, int crossingWeight):this(source,target,crossingWeight,1) { } int source; /// /// the source /// public int Source { get { return source; } set { source = value; } } int target; /// /// the target /// public int Target { get { return target; } set { target = value; } } /// /// overrides the equlity /// /// /// public override bool Equals(object obj) { LayerEdge ie = obj as LayerEdge; return ie.source == this.source && ie.target == this.target; } /// /// overrides GetHashCode /// /// public override int GetHashCode() { uint hc = (uint)source.GetHashCode(); return (int)((hc << 5 | hc >> 27) + (uint)target); } int crossingWeight=1; /// /// it is equalt to the number of edges this edge represents /// public int CrossingWeight { get { return crossingWeight; } // set { crossingWeight = value; } } /// /// /// /// public override string ToString() { return String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}->{1}", this.source, this.target); } } }