Clone() public static method

public static Clone ( Query input ) : Query
input Query
return Query
 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();
         }
     }
 }
示例#2
0
文件: Query.cs 项目: noahfalk/corefx
 // ----------------- Helper methods -------------
 public static Query Clone(Query input)
 {
     if (input != null)
     {
         return (Query)input.Clone();
     }
     return null;
 }
        public static void AssertQuery(Query query)
        {
            Debug.Assert(query != null, "AssertQuery(): query == null");
            if (query is FunctionQuery)
            {
                return;                         // Temp Fix. Functions (as document()) return now unordered sequences
            }
            query = Clone(query);
            XPathNavigator last = null;
            XPathNavigator curr;
            int            querySize  = query.Clone().Count;
            int            actualSize = 0;

            while ((curr = query.Advance()) != null)
            {
                if (curr.GetType().ToString() == "Microsoft.VisualStudio.Modeling.StoreNavigator")
                {
                    return;
                }
                if (curr.GetType().ToString() == "System.Xml.DataDocumentXPathNavigator")
                {
                    return;
                }
                Debug.Assert(curr == query.Current, "AssertQuery(): query.Advance() != query.Current");
                if (last != null)
                {
                    if (last.NodeType == XPathNodeType.Namespace && curr.NodeType == XPathNodeType.Namespace)
                    {
                        // NamespaceQuery reports namsespaces in mixed order.
                        // Ignore this for now.
                        // It seams that this doesn't breake other queries becasue NS can't have children
                    }
                    else
                    {
                        XmlNodeOrder cmp = CompareNodes(last, curr);
                        Debug.Assert(cmp == XmlNodeOrder.Before, "AssertQuery(): Wrong node order");
                    }
                }
                last = curr.Clone();
                actualSize++;
            }
            Debug.Assert(actualSize == querySize, "AssertQuery(): actualSize != querySize");
        }
示例#4
0
 public override XPathExpression Clone()
 {
     return(new CompiledXpathExpr(Query.Clone(_query), _expr, _needContext));
 }
示例#5
0
 private LogicalExpr(LogicalExpr other) : base(other)
 {
     this.op    = other.op;
     this.opnd1 = Query.Clone(other.opnd1);
     this.opnd2 = Query.Clone(other.opnd2);
 }
示例#6
0
 public static void AssertQuery(Query query) {
     Debug.Assert(query != null, "AssertQuery(): query == null");
     if (query is FunctionQuery) return; // Temp Fix. Functions (as document()) return now unordered sequences
     query = Clone(query);
     XPathNavigator last = null;
     XPathNavigator curr;
     int querySize = query.Clone().Count;
     int actualSize = 0;
     while ((curr = query.Advance()) != null) {
         if (curr.GetType().ToString() == "Microsoft.VisualStudio.Modeling.StoreNavigator") return;
         if (curr.GetType().ToString() == "System.Xml.DataDocumentXPathNavigator") return;
         Debug.Assert(curr == query.Current, "AssertQuery(): query.Advance() != query.Current");
         if (last != null) {
             if (last.NodeType == XPathNodeType.Namespace && curr.NodeType == XPathNodeType.Namespace) {
                 // NamespaceQuery reports namsespaces in mixed order.
                 // Ignore this for now. 
                 // It seams that this doesn't breake other queries becasue NS can't have children
             } else {
                 XmlNodeOrder cmp = CompareNodes(last, curr);
                 Debug.Assert(cmp == XmlNodeOrder.Before, "AssertQuery(): Wrong node order");
             }
         }
         last = curr.Clone();
         actualSize++;
     }
     Debug.Assert(actualSize == querySize, "AssertQuery(): actualSize != querySize");
 }
示例#7
0
 public DescendantQuery(DescendantQuery other) : base(other)
 {
     this.nodeIterator = Query.Clone(other.nodeIterator);
 }
示例#8
0
 protected CacheOutputQuery(CacheOutputQuery other) : base(other)
 {
     this.input        = Query.Clone(other.input);
     this.outputBuffer = new List <XPathNavigator>(other.outputBuffer);
     base.count        = other.count;
 }
示例#9
0
 private NumberFunctions(NumberFunctions other) : base(other)
 {
     this.arg   = Query.Clone(other.arg);
     this.ftype = other.ftype;
 }
 private FollowingQuery(FollowingQuery other) : base((BaseAxisQuery)other)
 {
     this.input    = Query.Clone(other.input);
     this.iterator = Query.Clone(other.iterator);
 }
 private FollSiblingQuery(FollSiblingQuery other) : base((BaseAxisQuery)other)
 {
     this.elementStk = other.elementStk.Clone();
     this.parentStk  = new List <XPathNavigator>(other.parentStk);
     this.nextInput  = Query.Clone(other.nextInput);
 }
 private PrecedingQuery(PrecedingQuery other) : base((BaseAxisQuery)other)
 {
     this.workIterator = Query.Clone(other.workIterator);
     this.ancestorStk  = other.ancestorStk.Clone();
 }
 public override XPathExpression Clone()
 {
     return(new CompiledXpathExpr(Query.Clone(this.query), this.expr, this.needContext));
 }
示例#14
0
 private MergeFilterQuery(MergeFilterQuery other) : base((CacheOutputQuery)other)
 {
     this.child = Query.Clone(other.child);
 }
 private BooleanExpr(BooleanExpr other) : base(other)
 {
     this.opnd1 = Query.Clone(other.opnd1);
     this.opnd2 = Query.Clone(other.opnd2);
     this.isOr  = other.isOr;
 }
 private NumericExpr(NumericExpr other) : base(other)
 {
     this.op    = other.op;
     this.opnd1 = Query.Clone(other.opnd1);
     this.opnd2 = Query.Clone(other.opnd2);
 }
示例#17
0
 protected ChildrenQuery(ChildrenQuery other) : base((BaseAxisQuery)other)
 {
     this.iterator = XPathEmptyIterator.Instance;
     this.iterator = Query.Clone(other.iterator);
 }
示例#18
0
 private FilterQuery(FilterQuery other) : base((BaseAxisQuery)other)
 {
     this.cond       = Query.Clone(other.cond);
     this.noPosition = other.noPosition;
 }
示例#19
0
 private BooleanFunctions(BooleanFunctions other) : base(other)
 {
     this.arg      = Query.Clone(other.arg);
     this.funcType = other.funcType;
 }