예제 #1
0
        /// <summary>
        /// Tests whether both ranges are equal (have same boundaries).
        /// </summary>
        public override bool Equals(object obj)
        {
            AbstractRange <T> range = (obj as AbstractRange <T>);

            if (range == null)
            {
                return(false);
            }
            return((this.CompareTo(this.LowerBound, range.LowerBound) == 0) &&
                   (this.CompareTo(this.UpperBound, range.UpperBound) == 0));
        }
예제 #2
0
 /// <summary>
 /// Checks whether this range partially or totally overlaps the given range.
 /// </summary>
 public virtual bool Overlaps(AbstractRange <T> range)
 {
     return((this.CompareTo(this.LowerBound, range.UpperBound) <= 0) &&
            (this.CompareTo(this.UpperBound, range.LowerBound) >= 0));
 }
예제 #3
0
 /// <summary>
 /// Checks whether this range includes the given range.
 /// </summary>
 public virtual bool Includes(AbstractRange <T> range)
 {
     return((this.Includes(range.LowerBound)) && (this.Includes(range.UpperBound)));
 }