コード例 #1
0
        private IQuery ProcessNode(AstNode root, IQuery qyInput) {
            IQuery result = null;

            if (root == null)
                return null;

            switch (root.TypeOfAst) {

                case AstNode.QueryType.Axis:
                    Axis axis = (Axis)root;
                    result = ProcessAxis(axis, ProcessNode(axis.Input, qyInput));
                    break;

                case AstNode.QueryType.Operator:
                    result = ProcessOperator((Operator)root, null);
                    break;

                case AstNode.QueryType.Filter:
                    result = ProcessFilter((Filter)root);
                    break;

                case AstNode.QueryType.ConstantOperand:
                    result = ProcessOperand((Operand)root);
                    break;

                case AstNode.QueryType.Function:
                    result = ProcessFunction((Function)root, qyInput);
                    break;

                case AstNode.QueryType.Root:
                    result = new AbsoluteQuery();
                    break;

                case AstNode.QueryType.Group:
                    result = new GroupQuery(ProcessNode(((Group)root).GroupNode, qyInput));
                    break;
                default:
                    Debug.Assert(false, "Unknown QueryType encountered!!");
                    break;
            }
            return result;
        }