Brunet.Symphony.NodeRankInformation.Equals C# (CSharp) Метод

Equals() публичный Метод

public Equals ( Object other ) : bool
other Object
Результат bool
    override public bool Equals(Object other ) {
      if( Object.ReferenceEquals(other, this) ) {
        return true;
      }

      NodeRankInformation other1 =  other as NodeRankInformation;
      if( Object.ReferenceEquals(other1, null)) {
        return false;
      } else if (_addr.Equals(other1.Addr)) {
	      return true;
      }
      return false;
    }

Usage Example

Пример #1
0
        public int Compare(object x, object y)
        {
            if (x == y)
            {
                //This is trivial, but we need to deal with it:
                return(0);
            }
            NodeRankInformation x1 = (NodeRankInformation)x;
            NodeRankInformation y1 = (NodeRankInformation)y;

            if (x1.Equals(y1) && x1.Count == y1.Count)
            {
                /*
                 * Since each Address is in our list at most once,
                 * this is an Error, so lets print it out and hope
                 * someone sees it.
                 */
                return(0);
            }
            else if (x1.Count <= y1.Count)
            {
                return(1);
            }
            else if (x1.Count > y1.Count)
            {
                return(-1);
            }
            return(-1);
        }