Exemplo n.º 1
0
 public RangeComparison2(IComparable firstBound, RangeComparisonOp firstOp, IComparable value)
     : this()
 {
     FirstBound = firstBound;
     FirstOp = firstOp;
     Value = value;
 }
Exemplo n.º 2
0
        public static bool Compare(IComparable x, RangeComparisonOp op, IComparable y)
        {
            var z = x.CompareTo(y);

            switch (op)
            {
                case RangeComparisonOp.Lt:   return z < 0;
                case RangeComparisonOp.LtEq: return z <= 0;
                case RangeComparisonOp.Gt:   return z > 0;
                case RangeComparisonOp.GtEq: return z >= 0;
            }

            throw new ArgumentException("Invalid comparison operator");
        }
Exemplo n.º 3
0
 public static bool Compare(
     IComparable firstBound,
     RangeComparisonOp firstOp,
     IComparable value,
     RangeComparisonOp secondOp,
     IComparable secondBound)
 {
     return Compare(firstBound, firstOp, value) && Compare(value, secondOp, secondBound);
 }