mscorlib(4.0.0.0) API with additions
ActiveAxis.cs
1 using System.Collections;
2 
4 {
5  internal class ActiveAxis
6  {
7  private int currentDepth;
8 
9  private bool isActive;
10 
11  private Asttree axisTree;
12 
13  private ArrayList axisStack;
14 
15  public int CurrentDepth => currentDepth;
16 
17  internal void Reactivate()
18  {
19  isActive = true;
20  currentDepth = -1;
21  }
22 
23  internal ActiveAxis(Asttree axisTree)
24  {
25  this.axisTree = axisTree;
26  currentDepth = -1;
27  axisStack = new ArrayList(axisTree.SubtreeArray.Count);
28  for (int i = 0; i < axisTree.SubtreeArray.Count; i++)
29  {
30  AxisStack value = new AxisStack((ForwardAxis)axisTree.SubtreeArray[i], this);
31  axisStack.Add(value);
32  }
33  isActive = true;
34  }
35 
36  public bool MoveToStartElement(string localname, string URN)
37  {
38  if (!isActive)
39  {
40  return false;
41  }
42  currentDepth++;
43  bool result = false;
44  for (int i = 0; i < this.axisStack.Count; i++)
45  {
46  AxisStack axisStack = (AxisStack)this.axisStack[i];
47  if (axisStack.Subtree.IsSelfAxis)
48  {
49  if (axisStack.Subtree.IsDss || CurrentDepth == 0)
50  {
51  result = true;
52  }
53  }
54  else if (CurrentDepth != 0 && axisStack.MoveToChild(localname, URN, currentDepth))
55  {
56  result = true;
57  }
58  }
59  return result;
60  }
61 
62  public virtual bool EndElement(string localname, string URN)
63  {
64  if (currentDepth == 0)
65  {
66  isActive = false;
67  currentDepth--;
68  }
69  if (!isActive)
70  {
71  return false;
72  }
73  for (int i = 0; i < axisStack.Count; i++)
74  {
75  ((AxisStack)axisStack[i]).MoveToParent(localname, URN, currentDepth);
76  }
77  currentDepth--;
78  return false;
79  }
80 
81  public bool MoveToAttribute(string localname, string URN)
82  {
83  if (!isActive)
84  {
85  return false;
86  }
87  bool result = false;
88  for (int i = 0; i < axisStack.Count; i++)
89  {
90  if (((AxisStack)axisStack[i]).MoveToAttribute(localname, URN, currentDepth + 1))
91  {
92  result = true;
93  }
94  }
95  return result;
96  }
97  }
98 }
virtual int Count
Gets the number of elements actually contained in the T:System.Collections.ArrayList.
Definition: ArrayList.cs:2255
Definition: __Canon.cs:3
An end element tag (for example, </item> ).
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
Definition: ArrayList.cs:2381
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...
Definition: ArrayList.cs:14