Changeset 15017 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Tree/TreeNode.cs
- Timestamp:
- 06/01/17 09:28:34 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Tree/TreeNode.cs
r14908 r15017 5 5 public T Value { get; set; } 6 6 public IList<TreeNode<T>> Children { get; private set; } 7 public int Count { get; private set; } 7 8 8 9 public TreeNode() { 9 10 Children = new List<TreeNode<T>>(); 11 Count = 1; 10 12 } 11 13 … … 16 18 public void Add(T value) { 17 19 Children.Add(new TreeNode<T>(value)); 20 Count++; 18 21 } 19 22 20 23 public void AddNode(TreeNode<T> node) { 21 24 Children.Add(node); 25 Count += node.Count; 22 26 } 23 27 24 28 public void ReplaceNode(int index, TreeNode<T> node) { 29 Count -= Children[index].Count; 25 30 Children[index] = node; 31 Count += node.Count; 26 32 } 27 33 }
Note: See TracChangeset
for help on using the changeset viewer.