Exemplo n.º 1
0
        private ExpressionValue ParseComparisonNode(ComparisonExpressionNode comparisonExpressionNode)
        {
            ExpressionValue leftExpressionValue  = ParseExpressionNode(comparisonExpressionNode.Left);
            ExpressionValue rightExpressionValue = ParseExpressionNode(comparisonExpressionNode.Right);

            ExpressionOperator expressionOperator = ExpressionOperator.Undefined;

            switch (comparisonExpressionNode.Operator)
            {
            case ComparisonOperator.Equal:
                expressionOperator = ExpressionOperator.Equals;
                break;

            case ComparisonOperator.GreaterEqual:
                expressionOperator = ExpressionOperator.GreaterEquals;
                break;

            case ComparisonOperator.GreaterThan:
                expressionOperator = ExpressionOperator.GreaterThan;
                break;

            case ComparisonOperator.LessEqual:
                expressionOperator = ExpressionOperator.LessEquals;
                break;

            case ComparisonOperator.LessThan:
                expressionOperator = ExpressionOperator.LessThan;
                break;

            default:
                throw new NotImplementedException();
            }

            return(leftExpressionValue.Compare(rightExpressionValue, expressionOperator));
        }