Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FollSiblingQuery.cs
Go to the documentation of this file.
3
5
6internal sealed class FollSiblingQuery : BaseAxisQuery
7{
9
11
13
14 public FollSiblingQuery(Query qyInput, string name, string prefix, XPathNodeType type)
15 : base(qyInput, name, prefix, type)
16 {
19 }
20
22 : base(other)
23 {
24 _elementStk = other._elementStk.Clone();
25 _parentStk = new List<XPathNavigator>(other._parentStk);
26 _nextInput = Query.Clone(other._nextInput);
27 }
28
29 public override void Reset()
30 {
31 _elementStk.Clear();
33 _nextInput = null;
34 base.Reset();
35 }
36
37 private bool Visited(XPathNavigator nav)
38 {
40 xPathNavigator.MoveToParent();
41 for (int i = 0; i < _parentStk.Count; i++)
42 {
43 if (xPathNavigator.IsSamePosition(_parentStk[i]))
44 {
45 return true;
46 }
47 }
49 return false;
50 }
51
53 {
55 do
56 {
58 if (xPathNavigator == null)
59 {
60 return null;
61 }
62 }
63 while (Visited(xPathNavigator));
64 return xPathNavigator.Clone();
65 }
66
67 public override XPathNavigator Advance()
68 {
69 while (true)
70 {
71 if (currentNode == null)
72 {
73 if (_nextInput == null)
74 {
76 }
77 if (_elementStk.Count == 0)
78 {
79 if (_nextInput == null)
80 {
81 break;
82 }
85 }
86 else
87 {
89 }
90 }
92 {
96 if (_nextInput != null)
97 {
99 }
100 }
101 while (currentNode.MoveToNext())
102 {
103 if (matches(currentNode))
104 {
105 position++;
106 return currentNode;
107 }
108 }
109 currentNode = null;
110 }
111 return null;
112 }
113
114 public override XPathNodeIterator Clone()
115 {
116 return new FollSiblingQuery(this);
117 }
118}
virtual bool matches(XPathNavigator e)
readonly ClonableStack< XPathNavigator > _elementStk
FollSiblingQuery(Query qyInput, string name, string prefix, XPathNodeType type)
override XPathNodeIterator Clone()
readonly List< XPathNavigator > _parentStk
XPathNavigator Advance()
static Query Clone(Query input)
Definition Query.cs:66
virtual bool IsDescendant([NotNullWhen(true)] XPathNavigator? nav)