Beispiel #1
0
 public int GetHashCode(WeightedEdge <T> obj)
 {
     unchecked
     {
         var hashCode = _comparer.GetHashCode(obj.Source) + _comparer.GetHashCode(obj.Destination);
         hashCode = (hashCode * 397) ^ obj.Weight;
         return(hashCode);
     }
 }
Beispiel #2
0
 public bool Equals(WeightedEdge <T> left, WeightedEdge <T> right)
 {
     if (ReferenceEquals(left, right))
     {
         return(true);
     }
     if (ReferenceEquals(left, null))
     {
         return(false);
     }
     if (ReferenceEquals(right, null))
     {
         return(false);
     }
     if (left.GetType() != right.GetType())
     {
         return(false);
     }
     return(_comparer.Equals(left.Source, right.Source) &&
            _comparer.Equals(left.Destination, right.Destination) && left.Weight == right.Weight);
 }