Clone() public static method

public static Clone ( Query input ) : Query
input Query
return Query
コード例 #1
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();
         }
     }
 }
コード例 #2
0
ファイル: Query.cs プロジェクト: noahfalk/corefx
 // ----------------- Helper methods -------------
 public static Query Clone(Query input)
 {
     if (input != null)
     {
         return (Query)input.Clone();
     }
     return null;
 }
コード例 #3
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");
        }
コード例 #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
ファイル: Query.cs プロジェクト: krytht/DotNetReferenceSource
 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;
 }
コード例 #10
0
 private FollowingQuery(FollowingQuery other) : base((BaseAxisQuery)other)
 {
     this.input    = Query.Clone(other.input);
     this.iterator = Query.Clone(other.iterator);
 }
コード例 #11
0
 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);
 }
コード例 #12
0
 private PrecedingQuery(PrecedingQuery other) : base((BaseAxisQuery)other)
 {
     this.workIterator = Query.Clone(other.workIterator);
     this.ancestorStk  = other.ancestorStk.Clone();
 }
コード例 #13
0
 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);
 }
コード例 #15
0
 private BooleanExpr(BooleanExpr other) : base(other)
 {
     this.opnd1 = Query.Clone(other.opnd1);
     this.opnd2 = Query.Clone(other.opnd2);
     this.isOr  = other.isOr;
 }
コード例 #16
0
 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;
 }