/// <summary> /// Compares this range to the specified range. The results is true /// if and only if the argument has the same values as this object. /// </summary> /// <param name="that"> a positive range to compare with.</param> /// <returns> True if the given range has the same bounds as /// this object; false otherwise. </returns> public bool Equals(PositiveRange that) { if (null == (object)that) { return(false); } // Return true if the fields match: return((this.Min == that.Min) && (this.Max == that.Max)); }
/// <summary> /// Checks if the given range is a subrange, /// bo.exp. this.Min <= range.Min and range.Max <= this.Max. /// If the range ist not contained an ArgumentOutOfRangeException /// will be raised. </summary> /// <param name="range">The range to be checked.</param> /// <returns>True, if the given range lies within the bounds /// of this range, false otherwise.</returns> public bool ContainsOrFail(PositiveRange range) { if (!((this.Min <= range.Min) && (range.Max <= this.Max))) { throw new System.ArgumentOutOfRangeException( new System.Text.StringBuilder(64).Append(this.ToString()). Append(" does not contain ").Append(range.ToString()).ToString()); } return(true); }
/// <summary> /// Compares this range to the specified range. The results is true /// if and only if the argument has the same values as this object. /// </summary> /// <param name="that"> a positive range to compare with.</param> /// <returns> True if the given range has the same bounds as /// this object; false otherwise. </returns> public bool Equals(PositiveRange that) { if (null == (object)that) { return false; } // Return true if the fields match: return (this.Min == that.Min) && (this.Max == that.Max); }
/// <summary> /// Checks if the given range is a subrange, /// bo.exp. this.Min <= range.Min and range.Max <= this.Max. /// If the range ist not contained an ArgumentOutOfRangeException /// will be raised. </summary> /// <param name="range">The range to be checked.</param> /// <returns>True, if the given range lies within the bounds /// of this range, false otherwise.</returns> public bool ContainsOrFail(PositiveRange range) { if (!((this.Min <= range.Min) && (range.Max <= this.Max))) { throw new System.ArgumentOutOfRangeException( new System.Text.StringBuilder(64).Append(this.ToString()). Append(" does not contain ").Append(range.ToString()).ToString()); } return true; }
/// <summary> /// Checks if the given range is a subrange, /// bo.exp. this.Min <= range.Min and range.Max <= this.Max. /// </summary> /// <param name="range">The range to be checked.</param> /// <returns>True, if the given range lies within the bounds /// of this range, false otherwise.</returns> public bool Contains(PositiveRange range) { return (this.Min <= range.Min) && (range.Max <= this.Max); }
/// <summary> /// Checks if the given range is a subrange, /// bo.exp. this.Min <= range.Min and range.Max <= this.Max. /// </summary> /// <param name="range">The range to be checked.</param> /// <returns>True, if the given range lies within the bounds /// of this range, false otherwise.</returns> public bool Contains(PositiveRange range) { return((this.Min <= range.Min) && (range.Max <= this.Max)); }