private static Bound <T> LowerMax <T>(Bound <T> left, Bound <T> right) where T : IComparable { if (left < right && left > right) { return(left.IsOpen() ? left : right); } return(left >= right ? left : right); }
/// <summary> /// Creates an interval given its bounds. /// </summary> /// <param name="lowerBound">The lower bound.</param> /// <param name="upperBound">The upper bound.</param> /// <returns>The newly created interval.</returns> public static Interval <T> FromBounds(Bound <T> lowerBound, Bound <T> upperBound) { return(lowerBound == upperBound && (lowerBound.IsOpen() || upperBound.IsOpen()) ? new EmptyInterval <T>() : new Interval <T>(lowerBound, upperBound)); }