Ejemplo n.º 1
0
 public static bool IsBetween(this Range <int> range, int value)
 {
     return(range.Min <= value && value <= range.Max);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Determines whether specified range contains the specified value.
 /// </summary>
 /// <param name="range">The range.</param>
 /// <param name="value">The value.</param>
 /// <returns>
 ///     <c>true</c> if [contains] [the specified range]; otherwise, <c>false</c>.
 /// </returns>
 public static bool Contains(this Range <double> range, double value)
 {
     return(range.Min < value && value < range.Max);
 }
Ejemplo n.º 3
0
 public static bool IntersectsWith(this Range <int> range, Range <int> other)
 {
     return(range.IsBetween(other.Min) ||
            range.IsBetween(other.Max));
 }
Ejemplo n.º 4
0
 public static bool FromTheRight(this Range <int> range, Range <int> other)
 {
     return(other.Min > range.Max &&
            other.Max > range.Max);
 }
Ejemplo n.º 5
0
 public static bool FromTheLeft(this Range <int> range, Range <int> other)
 {
     return(other.Min < range.Min &&
            other.Max < range.Min);
 }
Ejemplo n.º 6
0
 public static int GetLength(this Range <int> range)
 {
     return(range.Max - range.Min);
 }
Ejemplo n.º 7
0
 public static double GetLength(this Range <double> range)
 {
     return(range.Max - range.Min);
 }