public override int CompareTo(Cut <C> o) { return((o is BelowAll) ? 0 : -1); }
public override int CompareTo(Cut <C> o) { return((o is AboveAll) ? 0 : 1); }
/// <summary> /// Returns a range that contains all values strictly less than <paramref name="endpoint"/>. /// </summary> public static Range <C> LessThan <C>(C endpoint) where C : IComparable <C> { return(new Range <C>(Cut.BelowAll <C>(), Cut.BelowValue(endpoint))); }
/// <summary> /// Returns a range that contains all values less than or equal to <paramref name="endpoint"/>. /// </summary> public static Range <C> AtMost <C>(C endpoint) where C : IComparable <C> { return(new Range <C>(Cut.BelowAll <C>(), Cut.AboveValue(endpoint))); }
/// <summary> /// Returns a range that contains any value from <paramref name="lower"/> to <paramref name="upper"/>, where each /// endpoint may be either inclusive (closed) or exclusive (open). /// </summary> /// <exception cref="ArgumentException"> if <paramref name="lower"/> is greater than <paramref name="upper"/> /// </exception> public static Range <C> Bounded <C>(C lower, BoundType lowerType, C upper, BoundType upperType) where C : IComparable <C> { Cut <C> lowerBound = (lowerType == BoundType.OPEN) ? Cut.AboveValue(lower) : Cut.BelowValue(lower); Cut <C> upperBound = (upperType == BoundType.OPEN) ? Cut.BelowValue(upper) : Cut.AboveValue(upper); return(new Range <C>(lowerBound, upperBound)); }
/// <summary> /// Returns a range that contains all values strictly greater than <paramref name="lower"/> and less than or /// equal to <paramref name="upper"/>. /// </summary> /// <exception cref="ArgumentException"> if <paramref name="lower"/> is greater than <paramref name="upper"/> /// </exception> public static Range <C> OpenClosed <C>(C lower, C upper) where C : IComparable <C> { return(new Range <C>(Cut.AboveValue(lower), Cut.AboveValue(upper))); }
/// <summary> /// Returns a range that contains all values greater than or equal to <paramref name="lower"/> and strictly /// less than <paramref name="upper"/>. /// </summary> /// <exception cref="ArgumentException"> if <paramref name="lower"/> is greater than <paramref name="upper"/> /// </exception> public static Range <C> ClosedOpen <C>(C lower, C upper) where C : IComparable <C> { return(new Range <C>(Cut.BelowValue(lower), Cut.BelowValue(upper))); }
/// <summary> /// Returns a range that contains every value of type <typeparamref name="C"/>. /// </summary> public static Range <C> All <C>() where C : IComparable <C> { return(new Range <C>(Cut.BelowAll <C>(), Cut.AboveAll <C>())); }
/// <summary> /// Returns a range that contains all values strictly greater than <paramref name="endpoint"/>. /// </summary> public static Range <C> GreaterThan <C>(C endpoint) where C : IComparable <C> { return(new Range <C>(Cut.AboveValue(endpoint), Cut.AboveAll <C>())); }