Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
JoinNodes.cs
1using System.Collections;
2using System.Xml;
3
5{
9 public class JoinNodes : IEnumerable
10 {
11 private readonly XmlNodeList nodes1;
12 private readonly XmlNodeList nodes2;
13
19 public JoinNodes(XmlNodeList Nodes1, XmlNodeList Nodes2)
20 {
21 this.nodes1 = Nodes1;
22 this.nodes2 = Nodes2;
23 }
24
29 public IEnumerator GetEnumerator()
30 {
31 return new JoinedNodesEnumerator(this.nodes1.GetEnumerator(),
32 this.nodes2.GetEnumerator());
33 }
34
38 private class JoinedNodesEnumerator : IEnumerator
39 {
40 private readonly IEnumerator enumerator1;
41 private readonly IEnumerator enumerator2;
42 private bool first;
43
49 public JoinedNodesEnumerator(IEnumerator e1, IEnumerator e2)
50 {
51 this.enumerator1 = e1;
52 this.enumerator2 = e2;
53 this.first = true;
54 }
55
59 public object Current
60 {
61 get
62 {
63 if (this.first)
64 return (XmlNode)this.enumerator1.Current;
65 else
66 return (XmlNode)this.enumerator2.Current;
67 }
68 }
69
74 public bool MoveNext()
75 {
76 if (this.first)
77 {
78 if (this.enumerator1.MoveNext())
79 return true;
80 else
81 this.first = false;
82 }
83
84 return this.enumerator2.MoveNext();
85 }
86
90 public void Reset()
91 {
92 this.enumerator1.Reset();
93 this.enumerator2.Reset();
94
95 this.first = true;
96 }
97 }
98 }
99}
Joins two sets of XML nodes.
Definition: JoinNodes.cs:10
IEnumerator GetEnumerator()
Gets an enumerator over the concatentation of nodes.
Definition: JoinNodes.cs:29
JoinNodes(XmlNodeList Nodes1, XmlNodeList Nodes2)
Joins two sets of XML nodes.
Definition: JoinNodes.cs:19