You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the important abilities of ```Node<T>``` and its supporting classes is to allow for creating and modifying tree structures that only have a parent to child relationship. It's important to ensure that a node cannot occur multiple times in a tree but an instance of its value can occur any number of times. This facilitates potential 'value sub-trees' that can have dupicate references but not duplicate instances. By using ```Node<T>``` as a container, a single instance can exist multiple times in a tree but still be uniquely indentifyable by its position.
5
+
6
+
## ```Node<T>.Factory```
7
+
8
+
### Blank Instance
9
+
Calling ```.GetBlankNode()``` will retrieve a blank node from the underlying object pool or create a new one.
10
+
11
+
### Mapping
12
+
Calling ```.Map(root)``` generates node hierarchy map based upon if the root or any of its children implement ```IParent```.
13
+
14
+
### Cloning
15
+
Calling ```.Clone(node)``` creates a copy of the node map.
16
+
17
+
### Recycling
18
+
```Node<T>``` instances can be recycled by calling the ```Factory.Recycle(node)``` method. The node itself and its children are torn down and recycled to an object pool.
19
+
20
+
***WARNING:*** The ```Factory.Recycle(node)``` method is the one point of potential trouble if multiple references are retained. It must be used with care.
0 commit comments