Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.Problems.ProgramSynthesis.Push.Data.Tree {
|
---|
4 | public class TreeNode<T> {
|
---|
5 | public T Value { get; set; }
|
---|
6 | public IList<TreeNode<T>> Children { get; private set; }
|
---|
7 |
|
---|
8 | public TreeNode() {
|
---|
9 | Children = new List<TreeNode<T>>();
|
---|
10 | }
|
---|
11 |
|
---|
12 | public TreeNode(T value) : this() {
|
---|
13 | Value = value;
|
---|
14 | }
|
---|
15 |
|
---|
16 | public void Add(T value) {
|
---|
17 | Children.Add(new TreeNode<T>(value));
|
---|
18 | }
|
---|
19 |
|
---|
20 | public void AddNode(TreeNode<T> node) {
|
---|
21 | Children.Add(node);
|
---|
22 | }
|
---|
23 |
|
---|
24 | public void ReplaceNode(int index, TreeNode<T> node) {
|
---|
25 | Children[index] = node;
|
---|
26 | }
|
---|
27 | }
|
---|
28 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.