示例#1
0
        //
        // Operator: Or, and, |
        //           +, -, *, div,
        //           >, >=, <, <=, =, !=
        //
        private IQuery ProcessOperator(Operator root, IQuery qyInput)
        {
            IQuery ret = null;

            switch (root.OperatorType)
            {
            case Operator.Op.OR:
                ret = new OrExpr(ProcessNode(root.Operand1, null),
                                 ProcessNode(root.Operand2, null));
                return(ret);

            case Operator.Op.AND:
                ret = new AndExpr(ProcessNode(root.Operand1, null),
                                  ProcessNode(root.Operand2, null));
                return(ret);
            }

            switch (root.ReturnType)
            {
            case XPathResultType.Number:
                ret = new NumericExpr(root.OperatorType,
                                      ProcessNode(root.Operand1, null),
                                      ProcessNode(root.Operand2, null));
                return(ret);

            case XPathResultType.Boolean:
                ret = new LogicalExpr(root.OperatorType,
                                      ProcessNode(root.Operand1, null),
                                      ProcessNode(root.Operand2, null));
                return(ret);
            }

            return(ret);
        }
        //
        // Operator: Or, and, |
        //           +, -, *, div,
        //           >, >=, <, <=, =, !=
        //
        private IQuery ProcessOperator(Operator root, IQuery qyInput) {

            IQuery ret = null;

            switch (root.OperatorType) {

                case Operator.Op.OR:
                    ret = new OrExpr(ProcessNode(root.Operand1, null),
                                      ProcessNode(root.Operand2, null));
                    return ret;

                case Operator.Op.AND :
                    ret = new AndExpr(ProcessNode(root.Operand1, null),
                                       ProcessNode(root.Operand2, null));
                    return ret;
            }

            switch (root.ReturnType) {

                case XPathResultType.Number:
                    ret = new NumericExpr(root.OperatorType,
                                           ProcessNode(root.Operand1, null),
                                           ProcessNode(root.Operand2, null));
                    return ret;

                case XPathResultType.Boolean:
                    ret = new LogicalExpr(root.OperatorType,
                                           ProcessNode(root.Operand1, null),
                                           ProcessNode(root.Operand2, null));
                    return ret;
            }

            return ret;
        }