private static FilterSpecParam HandleRangeNode(
            ExprBetweenNode betweenNode,
            IDictionary<string, Pair<EventType, string>> arrayEventTypes,
            ExprEvaluatorContext exprEvaluatorContext,
            string statementName)
        {
            var left = betweenNode.ChildNodes[0];
            if (left is ExprFilterOptimizableNode)
            {
                var filterOptimizableNode = (ExprFilterOptimizableNode) left;
                var lookupable = filterOptimizableNode.FilterLookupable;
                var op = FilterOperatorExtensions.ParseRangeOperator(
                    betweenNode.IsLowEndpointIncluded, betweenNode.IsHighEndpointIncluded,
                    betweenNode.IsNotBetween);

                var low = HandleRangeNodeEndpoint(
                    betweenNode.ChildNodes[1], arrayEventTypes, exprEvaluatorContext, statementName);
                var high = HandleRangeNodeEndpoint(
                    betweenNode.ChildNodes[2], arrayEventTypes, exprEvaluatorContext, statementName);

                if ((low != null) && (high != null))
                {
                    return new FilterSpecParamRange(lookupable, op, low, high);
                }
            }
            return null;
        }
Exemplo n.º 2
0
 public void TestRanges()
 {
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(false, false, false) == FilterOperator.RANGE_OPEN);
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(true, true, false) == FilterOperator.RANGE_CLOSED);
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(true, false, false) == FilterOperator.RANGE_HALF_OPEN);
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(false, true, false) == FilterOperator.RANGE_HALF_CLOSED);
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(false, false, true) == FilterOperator.NOT_RANGE_OPEN);
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(true, true, true) == FilterOperator.NOT_RANGE_CLOSED);
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(true, false, true) == FilterOperator.NOT_RANGE_HALF_OPEN);
     Assert.IsTrue(FilterOperatorExtensions.ParseRangeOperator(false, true, true) == FilterOperator.NOT_RANGE_HALF_CLOSED);
 }