Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DescendantOverDescendantQuery.cs
Go to the documentation of this file.
2
4
6{
7 private int _level;
8
9 public DescendantOverDescendantQuery(Query qyParent, bool matchSelf, string name, string prefix, XPathNodeType typeTest, bool abbrAxis)
10 : base(qyParent, name, prefix, typeTest, matchSelf, abbrAxis)
11 {
12 }
13
15 : base(other)
16 {
17 _level = other._level;
18 }
19
20 public override void Reset()
21 {
22 _level = 0;
23 base.Reset();
24 }
25
26 public override XPathNavigator Advance()
27 {
28 while (true)
29 {
30 if (_level == 0)
31 {
33 position = 0;
34 if (currentNode == null)
35 {
36 return null;
37 }
39 {
40 break;
41 }
43 if (!MoveToFirstChild())
44 {
45 continue;
46 }
47 }
48 else if (!MoveUpUntilNext())
49 {
50 continue;
51 }
52 do
53 {
55 {
56 position++;
57 return currentNode;
58 }
59 }
60 while (MoveToFirstChild());
61 }
62 position = 1;
63 return currentNode;
64 }
65
66 private bool MoveToFirstChild()
67 {
69 {
70 _level++;
71 return true;
72 }
73 return false;
74 }
75
76 private bool MoveUpUntilNext()
77 {
78 while (!currentNode.MoveToNext())
79 {
80 _level--;
81 if (_level == 0)
82 {
83 return false;
84 }
85 bool flag = currentNode.MoveToParent();
86 }
87 return true;
88 }
89
90 public override XPathNodeIterator Clone()
91 {
92 return new DescendantOverDescendantQuery(this);
93 }
94}
virtual bool matches(XPathNavigator e)
DescendantOverDescendantQuery(Query qyParent, bool matchSelf, string name, string prefix, XPathNodeType typeTest, bool abbrAxis)
XPathNavigator Advance()