0
|
1 using UnityEngine;
|
|
2 public class DefaultTreeNode : TreeNode {
|
|
3 private List<TreeNode> children;
|
7
|
4 private TreeMap<string,byte[]> attrs;
|
0
|
5 // string nodeId = new VMID().toString();
|
|
6
|
7
|
7 private static readonly List<TreeNode> NIL_LIST = new List<TreeNode>();
|
0
|
8
|
|
9 public DefaultTreeNode()
|
7
|
10 : this (NIL_LIST, new TreeMap<string,byte[]> ())
|
0
|
11 {
|
|
12 }
|
|
13
|
7
|
14 public DefaultTreeNode(List<TreeNode> _children, TreeMap<string, byte[]> _attrs) {
|
0
|
15 attrs = _attrs;
|
|
16 children = _children;
|
|
17 }
|
|
18
|
|
19 public TreeNodeChildren getChildren() {
|
|
20 return new DefaultTreeNodeChildren(children, attrs);
|
|
21 }
|
|
22
|
|
23 public TreeNodeAttributes getAttributes() {
|
|
24 return new DefaultTreeNodeAttribute(children, attrs); // count = null.
|
|
25 }
|
|
26
|
|
27 public TreeNode createNewNode() {
|
|
28 return new DefaultTreeNode();
|
|
29 }
|
|
30
|
|
31 public DefaultTreeNode clone() {
|
|
32 return new DefaultTreeNode(children, attrs);
|
|
33 }
|
|
34
|
|
35 public Either<Error, TreeNode> appendRootNode() {
|
7
|
36 TreeNodeChildren newRootChildren = new DefaultTreeNodeChildren(NIL_LIST, new TreeMap<string, byte[]>());
|
0
|
37 Either<Error, TreeNode> either = newRootChildren.addNewChildAt(0,this);
|
|
38 return either;
|
|
39 }
|
|
40
|
|
41 public int compareTo(TreeNode o) {
|
|
42 return this.GetHashCode() - o.GetHashCode();
|
|
43 }
|
|
44
|
|
45
|
|
46 }
|