Inheritance: ResetableIterator
 public SortQuery(Query qyInput)
 {
     this.results = new List<SortKey>();
     this.comparer = new XPathSortComparer();
     this.qyInput = qyInput;
     base.count = 0;
 }
 public static void AssertQuery(Query query)
 {
     if (!(query is FunctionQuery))
     {
         XPathNavigator navigator2;
         query = Clone(query);
         XPathNavigator l = null;
         int count = query.Clone().Count;
         for (int i = 0; (navigator2 = query.Advance()) != null; i++)
         {
             if (navigator2.GetType().ToString() == "Microsoft.VisualStudio.Modeling.StoreNavigator")
             {
                 return;
             }
             if (navigator2.GetType().ToString() == "System.Xml.DataDocumentXPathNavigator")
             {
                 return;
             }
             if ((l != null) && ((l.NodeType != XPathNodeType.Namespace) || (navigator2.NodeType != XPathNodeType.Namespace)))
             {
                 CompareNodes(l, navigator2);
             }
             l = navigator2.Clone();
         }
     }
 }
 private SortQuery(SortQuery other) : base(other)
 {
     this.results = new List<SortKey>(other.results);
     this.comparer = other.comparer.Clone();
     this.qyInput = Query.Clone(other.qyInput);
     base.count = 0;
 }
Example #4
0
 private LogicalExpr(LogicalExpr other)
     : base(other)
 {
     this.op = other.op;
     this.opnd1 = Clone(other.opnd1);
     this.opnd2 = Clone(other.opnd2);
 }
Example #5
0
 public override void AddSort(object expr, IComparer comparer)
 {
     // sort makes sense only when we are dealing with a query that
     // returns a nodeset.
     Query evalExpr;
     string query = expr as string;
     if (query != null)
     {
         evalExpr = new QueryBuilder().Build(query, out _needContext); // this will throw if expr is invalid
     }
     else
     {
         CompiledXpathExpr xpathExpr = expr as CompiledXpathExpr;
         if (xpathExpr != null)
         {
             evalExpr = xpathExpr.QueryTree;
         }
         else
         {
             throw XPathException.Create(SR.Xp_BadQueryObject);
         }
     }
     SortQuery sortQuery = _query as SortQuery;
     if (sortQuery == null)
     {
         _query = sortQuery = new SortQuery(_query);
     }
     sortQuery.AddSort(evalExpr, comparer);
 }
Example #6
0
 protected BaseAxisQuery(Query qyInput)
 {
     _name = string.Empty;
     _prefix = string.Empty;
     _nsUri = string.Empty;
     this.qyInput = qyInput;
 }
Example #7
0
 public UnionExpr(Query query1, Query query2)
 {
     this.qy1 = query1;
     this.qy2 = query2;
     _advance1 = true;
     _advance2 = true;
 }
Example #8
0
 // ----------------- Helper methods -------------
 public static Query Clone(Query input)
 {
     if (input != null)
     {
         return (Query)input.Clone();
     }
     return null;
 }
 private bool CanBeNumber(Query q)
 {
     if (q.StaticType != XPathResultType.Any)
     {
         return (q.StaticType == XPathResultType.Number);
     }
     return true;
 }
Example #10
0
 private UnionExpr(UnionExpr other) : base(other) {
     this.qy1 = Clone(other.qy1);
     this.qy2 = Clone(other.qy2);
     this.advance1 = other.advance1;
     this.advance2 = other.advance2;
     this.currentNode = Clone(other.currentNode);
     this.nextNode    = Clone(other.nextNode);
 }
 protected BaseAxisQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest)
 {
     this.qyInput = qyInput;
     this.name = name;
     this.prefix = prefix;
     this.typeTest = typeTest;
     this.nameTest = (prefix.Length != 0) || (name.Length != 0);
     this.nsUri = string.Empty;
 }
Example #12
0
 private UnionExpr(UnionExpr other) : base(other)
 {
     this.qy1 = Clone(other.qy1);
     this.qy2 = Clone(other.qy2);
     _advance1 = other._advance1;
     _advance2 = other._advance2;
     _currentNode = Clone(other._currentNode);
     _nextNode = Clone(other._nextNode);
 }
 private StringFunctions(StringFunctions other) : base(other) {
     this.funcType = other.funcType;
     Query[] tmp = new Query[other.argList.Count]; {                
         for (int i = 0; i < tmp.Length; i ++) {
             tmp[i] = Clone(other.argList[i]);
         }
     }
     this.argList = tmp; 
 }
 protected BaseAxisQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest) {
     Debug.Assert(qyInput != null);
     this.qyInput  = qyInput;
     this.name     = name;
     this.prefix   = prefix;
     this.typeTest = typeTest;
     this.nameTest = prefix.Length != 0 || name.Length != 0;
     this.nsUri    = string.Empty;
 }
 private StringFunctions(StringFunctions other) : base(other)
 {
     this.funcType = other.funcType;
     Query[] queryArray = new Query[other.argList.Count];
     for (int i = 0; i < queryArray.Length; i++)
     {
         queryArray[i] = Query.Clone(other.argList[i]);
     }
     this.argList = queryArray;
 }
 private FunctionQuery(FunctionQuery other) : base(other) {
     this.function = other.function;
     Query[] tmp = new Query[other.args.Count]; {                
         for (int i = 0; i < tmp.Length; i ++) {
             tmp[i] = Clone(other.args[i]);
         }
         args = tmp;
     }
     this.args = tmp;
 }
Example #17
0
 public LogicalExpr(Operator.Op op, Query  opnd1, Query  opnd2) {
     Debug.Assert(
         Operator.Op.LT == op || Operator.Op.GT == op ||
         Operator.Op.LE == op || Operator.Op.GE == op ||
         Operator.Op.EQ == op || Operator.Op.NE == op
     );
     this.op    = op;
     this.opnd1 = opnd1;
     this.opnd2 = opnd2;
 }
 protected BaseAxisQuery(BaseAxisQuery other) : base(other) {
     this.qyInput  = Clone(other.qyInput);
     this.name     = other.name;
     this.prefix   = other.prefix;
     this.nsUri    = other.nsUri;
     this.typeTest = other.typeTest;
     this.nameTest = other.nameTest;
     this.position = other.position;
     this.currentNode = other.currentNode;
 }
 private FunctionQuery(FunctionQuery other) : base(other)
 {
     this.function = other.function;
     Query[] queryArray = new Query[other.args.Count];
     for (int i = 0; i < queryArray.Length; i++)
     {
         queryArray[i] = Query.Clone(other.args[i]);
     }
     this.args = queryArray;
     this.args = queryArray;
 }
 public BooleanExpr(Operator.Op op, Query opnd1, Query opnd2) {
     Debug.Assert(op == Operator.Op.AND || op == Operator.Op.OR);
     Debug.Assert(opnd1 != null && opnd2 != null);
     if (opnd1.StaticType != XPathResultType.Boolean) {
         opnd1 = new BooleanFunctions(Function.FunctionType.FuncBoolean, opnd1);
     }
     if (opnd2.StaticType != XPathResultType.Boolean) {
         opnd2 = new BooleanFunctions(Function.FunctionType.FuncBoolean, opnd2);
     }
     this.opnd1 = opnd1;
     this.opnd2 = opnd2;
     isOr = (op == Operator.Op.OR);
 }
 public NumericExpr(Operator.Op op, Query opnd1, Query opnd2)
 {
     if (opnd1.StaticType != XPathResultType.Number)
     {
         opnd1 = new NumberFunctions(Function.FunctionType.FuncNumber, opnd1);
     }
     if (opnd2.StaticType != XPathResultType.Number)
     {
         opnd2 = new NumberFunctions(Function.FunctionType.FuncNumber, opnd2);
     }
     this.op = op;
     this.opnd1 = opnd1;
     this.opnd2 = opnd2;
 }
        public override void AddSort(object expr, IComparer comparer) {
            // sort makes sense only when we are dealing with a query that
            // returns a nodeset.
	        Query evalExpr;
            if (expr is string) {
                evalExpr = new QueryBuilder().Build((string)expr, out needContext); // this will throw if expr is invalid
            } else if (expr is CompiledXpathExpr) {
                evalExpr = ((CompiledXpathExpr)expr).QueryTree;
	        } else {
                throw XPathException.Create(Res.Xp_BadQueryObject);
            }
            SortQuery sortQuery = query as SortQuery;
            if (sortQuery == null) {
                query = sortQuery = new SortQuery(query);
            }
            sortQuery.AddSort(evalExpr, comparer);
        }
 public NumericExpr(Operator.Op op, Query opnd1, Query  opnd2) {
     Debug.Assert(
         op == Operator.Op.PLUS || op == Operator.Op.MINUS || 
         op == Operator.Op.MUL  || op == Operator.Op.DIV ||
         op == Operator.Op.MOD
     );
     Debug.Assert(opnd1 != null && opnd2 != null);
     if (opnd1.StaticType != XPathResultType.Number) {
         opnd1 = new NumberFunctions(Function.FunctionType.FuncNumber, opnd1);
     }
     if (opnd2.StaticType != XPathResultType.Number) {
         opnd2 = new NumberFunctions(Function.FunctionType.FuncNumber, opnd2);
     }
     this.op = op;
     this.opnd1 = opnd1;
     this.opnd2 = opnd2;
 }
 public override void AddSort(object expr, IComparer comparer)
 {
     Query queryTree;
     if (expr is string)
     {
         queryTree = new QueryBuilder().Build((string) expr, out this.needContext);
     }
     else
     {
         if (!(expr is CompiledXpathExpr))
         {
             throw XPathException.Create("Xp_BadQueryObject");
         }
         queryTree = ((CompiledXpathExpr) expr).QueryTree;
     }
     SortQuery query2 = this.query as SortQuery;
     if (query2 == null)
     {
         this.query = query2 = new SortQuery(this.query);
     }
     query2.AddSort(queryTree, comparer);
 }
 private NumberFunctions(NumberFunctions other) : base(other) {
     this.arg = Clone(other.arg);
     this.ftype = other.ftype;
 }
 public NumberFunctions(FT ftype, Query arg) {
     this.arg = arg;
     this.ftype = ftype;
 }
 public FollowingQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest) : base(qyInput, name, prefix, typeTest) {}
 public ParentQuery(Query  qyInput, string Name, string Prefix, XPathNodeType Type) : base(qyInput, Name, Prefix, Type) {}
Example #29
0
 public NamespaceQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type) : base(qyParent, Name, Prefix, Type)
 {
 }
Example #30
0
 public BooleanFunctions(FT funcType, Query arg) {
     this.arg      = arg;
     this.funcType = funcType;
 }
 protected XPathSelectionIterator(XPathSelectionIterator it)
 {
     _nav = it._nav.Clone();
     _query = (Query)it._query.Clone();
     _position = it._position;
 }
Example #32
0
 private BooleanFunctions(BooleanFunctions other) : base(other) {
     this.arg      = Clone(other.arg);
     this.funcType = other.funcType;
 }
 internal XPathSelectionIterator(XPathNavigator nav, Query query)
 {
     _nav = nav.Clone();
     _query = query;
 }