Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/01/17 09:28:34 (7 years ago)
Author:
pkimmesw
Message:

#2665 Fixed Benchmark Problem Definition, Converted LoopExpressions to stateless expressions, Added several unit test to ensure funcionality, Fixed UI bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Tree/TreeNode.cs

    r14908 r15017  
    55    public T Value { get; set; }
    66    public IList<TreeNode<T>> Children { get; private set; }
     7    public int Count { get; private set; }
    78
    89    public TreeNode() {
    910      Children = new List<TreeNode<T>>();
     11      Count = 1;
    1012    }
    1113
     
    1618    public void Add(T value) {
    1719      Children.Add(new TreeNode<T>(value));
     20      Count++;
    1821    }
    1922
    2023    public void AddNode(TreeNode<T> node) {
    2124      Children.Add(node);
     25      Count += node.Count;
    2226    }
    2327
    2428    public void ReplaceNode(int index, TreeNode<T> node) {
     29      Count -= Children[index].Count;
    2530      Children[index] = node;
     31      Count += node.Count;
    2632    }
    2733  }
Note: See TracChangeset for help on using the changeset viewer.