Esempio n. 1
0
 public override int CompareTo(Cut <C> o)
 {
     return((o is BelowAll) ? 0 : -1);
 }
Esempio n. 2
0
 public override int CompareTo(Cut <C> o)
 {
     return((o is AboveAll) ? 0 : 1);
 }
Esempio n. 3
0
 /// <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)));
 }
Esempio n. 4
0
 /// <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)));
 }
Esempio n. 5
0
        /// <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));
        }
Esempio n. 6
0
 /// <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)));
 }
Esempio n. 7
0
 /// <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)));
 }
Esempio n. 8
0
 /// <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>()));
 }
Esempio n. 9
0
 /// <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>()));
 }