Пример #1
0
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to Point return false.
            DvOrdered <T> orderedValue = obj as DvOrdered <T>;

            if ((object)orderedValue == null)
            {
                return(false);
            }

            // Return true if the ordered value match:
            if (this.IsStrictlyComparableTo(orderedValue))
            {
                return(this.CompareTo(orderedValue) == 0);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public override bool IsStrictlyComparableTo(DvOrdered <DvProportion> other)
        {
            DvProportion otherObj = other as DvProportion;

            DesignByContract.Check.Require(other != null && otherObj != null);

            return(otherObj.Type == this.Type);
        }
Пример #3
0
        public override bool IsStrictlyComparableTo(DvOrdered <DvQuantity> other)
        {
            DvQuantity otherObj = other as DvQuantity;

            DesignByContract.Check.Require(otherObj != null);

            if (!otherObj.Units.Equals(this.Units, StringComparison.InvariantCulture))
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
        public bool Equals(DvOrdered <T> orderedValue)
        {
            // If parameter is null return false:
            if ((object)orderedValue == null)
            {
                return(false);
            }

            // Return true if the ordered value match:
            if (this.IsStrictlyComparableTo(orderedValue))
            {
                return(this.CompareTo(orderedValue) == 0);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
 public abstract bool IsStrictlyComparableTo(DvOrdered <T> other);
Пример #6
0
        public override bool IsStrictlyComparableTo(DvOrdered <DvOrdinal> other)
        {
            DesignByContract.Check.Require(other != null && other is DvOrdinal);

            return(true);
        }