Changeset 12924 for branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/SearchTree.cs
- Timestamp:
- 08/28/15 17:50:53 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/SearchTree.cs
r12923 r12924 8 8 namespace HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction { 9 9 internal class SearchTree<TValue> { 10 private class Node <TValue>{10 private class Node { 11 11 internal TValue value; 12 internal Node <TValue>parent;13 internal Node <TValue>[] children;12 internal Node parent; 13 internal Node[] children; 14 14 // children == null -> never visited 15 15 // children[i] != null -> visited at least once, still allowed … … 17 17 } 18 18 19 private Node <TValue>root;19 private Node root; 20 20 21 21 // for iteration 22 private Node <TValue>currentNode;22 private Node currentNode; 23 23 24 24 public SearchTree() { 25 root = new Node <TValue>();25 root = new Node(); 26 26 currentNode = root; 27 27 } … … 38 38 Contract.Assert(values.Any()); 39 39 Contract.Assert(currentNode.children == null); 40 currentNode.children = values.Select(val => new Node <TValue>() { value = val, parent = currentNode }).ToArray();40 currentNode.children = values.Select(val => new Node() { value = val, parent = currentNode }).ToArray(); 41 41 } 42 42 … … 71 71 } 72 72 73 private void RemoveRecursively(Node <TValue>node) {73 private void RemoveRecursively(Node node) { 74 74 // when the last child has been removed we must remove the current node from it's parent 75 75 while (node.parent != null && node.children.All(ch => ch == null)) {
Note: See TracChangeset
for help on using the changeset viewer.