Ejemplo n.º 1
0
 /// <summary>
 /// Compares the current object with another object of the same type.
 /// </summary>
 /// <returns>
 /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings:
 ///                     Value
 ///                     Meaning
 ///                     Less than zero
 ///                     This object is less than the <paramref name="other"/> parameter.
 ///                     Zero
 ///                     This object is equal to <paramref name="other"/>.
 ///                     Greater than zero
 ///                     This object is greater than <paramref name="other"/>.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public int CompareTo(IMeasure <Q> other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     return(mAmount.CompareTo(other.GetAmount(mUnit)));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Compares the current object with another object of the same type.
        /// </summary>
        /// <returns>
        /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings:
        ///                     Value
        ///                     Meaning
        ///                     Less than zero
        ///                     This object is less than the <paramref name="other"/> parameter.
        ///                     Zero
        ///                     This object is equal to <paramref name="other"/>.
        ///                     Greater than zero
        ///                     This object is greater than <paramref name="other"/>.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public int CompareTo(IMeasure <Q> other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            return(this.amount.CompareTo(other.GetAmount(this.unit)));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Compares the current object with another object of the same type.
 /// </summary>
 /// <returns>
 /// A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the <paramref name="other"/> parameter.Zero This object is equal to <paramref name="other"/>. Greater than zero This object is greater than <paramref name="other"/>.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 int IComparable <IMeasure> .CompareTo(IMeasure other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     if (!other.Unit.Quantity.Equals(default(Q)))
     {
         throw new ArgumentException("Measures are of different quantities");
     }
     return(mAmount.CompareTo(other.GetAmount(mUnit)));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(IMeasure <Q> other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(mAmount.Equals(other.GetAmount(mUnit)));
 }
Ejemplo n.º 5
0
        public int CompareTo(IMeasure other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            if (!other.Unit.Quantity.Equals(default(Q)))
            {
                throw new ArgumentException("Measures are of different quantities");
            }
            return(Amount.Equals(other.GetAmount(Unit)));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        bool IEquatable <IMeasure> .Equals(IMeasure other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            if (!other.Unit.Quantity.Equals(default(Q)))
            {
                throw new ArgumentException("Measures are of different quantities");
            }

            return(this.amount.Equals(other.GetAmount(this.unit)));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public bool Equals(IMeasure <Q> other)
        {
            if (ReferenceEquals(objA: null, objB: other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(this.amount.Equals(other.GetAmount(this.unit)));
        }