private IQuery ProcessNode(AstNode root, IQuery qyInput, int parent, Axis.AxisType parentaxis, ref bool cache, ref bool position) { IQuery result = null; if (root == null) { return(null); } switch (root.TypeOfAst) { case AstNode.QueryType.Axis: filterCount = 0; firstInput = null; Axis axis = (Axis)root; if (axis.TypeOfAxis == Axis.AxisType.Descendant || axis.TypeOfAxis == Axis.AxisType.DescendantOrSelf) { if (_smart > 0) { result = ProcessAxis( axis, ProcessNode(axis.Input, qyInput, Smart_D, axis.TypeOfAxis, ref cache, ref position), parent, parentaxis); break; } } _smart++; result = ProcessAxis( axis, ProcessNode(axis.Input, qyInput, Regular_D, axis.TypeOfAxis, ref cache, ref position), parent, parentaxis); _smart--; break; case AstNode.QueryType.Operator: _smart = 2; result = ProcessOperator((Operator)root, null, ref cache, ref position); break; case AstNode.QueryType.Filter: _smart = 2; result = ProcessFilter((Filter)root, ref cache, ref position); break; case AstNode.QueryType.ConstantOperand: result = ProcessOperand((Operand)root); break; case AstNode.QueryType.Variable: result = ProcessVariable((Variable)root); break; case AstNode.QueryType.Function: result = ProcessFunction( (System.Xml.XPath.Function)root, qyInput, ref cache, ref position); break; case AstNode.QueryType.Group: _smart = 2; result = new GroupQuery(ProcessNode( ((System.Xml.XPath.Group)root).GroupNode, qyInput, Regular_D, Axis.AxisType.None, ref cache, ref position)); break; case AstNode.QueryType.Root: result = new AbsoluteQuery(); break; default: Debug.Assert(false, "Unknown QueryType encountered!!"); break; } return(result); }
private IQuery ProcessNode(AstNode root, IQuery qyInput,int parent, Axis.AxisType parentaxis, ref bool cache, ref bool position) { IQuery result = null; if (root == null) return null; switch (root.TypeOfAst) { case AstNode.QueryType.Axis: filterCount = 0; firstInput = null; Axis axis = (Axis)root; if (axis.TypeOfAxis == Axis.AxisType.Descendant || axis.TypeOfAxis == Axis.AxisType.DescendantOrSelf) if (_smart > 0) { result = ProcessAxis( axis, ProcessNode(axis.Input, qyInput,Smart_D, axis.TypeOfAxis, ref cache, ref position), parent, parentaxis); break; } _smart++; result = ProcessAxis( axis, ProcessNode(axis.Input, qyInput,Regular_D, axis.TypeOfAxis, ref cache, ref position), parent, parentaxis); _smart--; break; case AstNode.QueryType.Operator: _smart = 2; result = ProcessOperator((Operator)root, null, ref cache, ref position); break; case AstNode.QueryType.Filter: _smart = 2; result = ProcessFilter((Filter)root, ref cache, ref position); break; case AstNode.QueryType.ConstantOperand: result = ProcessOperand((Operand)root); break; case AstNode.QueryType.Variable: result = ProcessVariable((Variable)root); break; case AstNode.QueryType.Function: result = ProcessFunction( (System.Xml.XPath.Function)root, qyInput, ref cache, ref position); break; case AstNode.QueryType.Group: _smart = 2; result = new GroupQuery(ProcessNode( ((System.Xml.XPath.Group)root).GroupNode, qyInput,Regular_D, Axis.AxisType.None, ref cache, ref position)); break; case AstNode.QueryType.Root: result = new AbsoluteQuery(); break; default: Debug.Assert(false, "Unknown QueryType encountered!!"); break; } return result; }