/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// /// <param name="other">An object to compare with this object.</param> /// /// <returns> /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false. /// </returns> /// public bool Equals(IntRange other) { return(this == other); }
/// <summary> /// Check if the specified range is inside of the range. /// </summary> /// /// <param name="range">Range to check.</param> /// /// <returns> /// <b>True</b> if the specified range is inside of the range or <b>false</b> otherwise. /// </returns> /// public bool IsInside(IntRange range) { return((IsInside(range.min)) && (IsInside(range.max))); }
/// <summary> /// Check if the specified range overlaps with the range. /// </summary> /// /// <param name="range">Range to check for overlapping.</param> /// /// <returns> /// <b>True</b> if the specified range overlaps with the range or <b>false</b> otherwise. /// </returns> /// public bool IsOverlapping(IntRange range) { return((IsInside(range.min)) || (IsInside(range.max)) || (range.IsInside(min)) || (range.IsInside(max))); }
/// <summary> /// Computes the intersection between two ranges. /// </summary> /// /// <param name="range">The second range for which the intersection should be calculated.</param> /// /// <returns>An new <see cref="IntRange"/> structure containing the intersection /// between this range and the <paramref name="range"/> given as argument.</returns> /// public IntRange Intersection(IntRange range) { return(new IntRange(System.Math.Max(this.Min, range.Min), System.Math.Min(this.Max, range.Max))); }