Mercurial > hg > Database > jungle-sharp
view Main/jungle-main/transaction/DefaultTreeNode.cs @ 31:1466993c104c
byte[] to object Rewrite.
author | Kazuma Takeda |
---|---|
date | Fri, 20 Jan 2017 07:08:03 +0900 |
parents | 1f99e150f336 |
children | f2ea780b3e80 |
line wrap: on
line source
using UnityEngine; namespace JungleDB { public class DefaultTreeNode : TreeNode { private List<TreeNode> children; private TreeMap<string, object> attrs; private static readonly List<TreeNode> NIL_LIST = new List<TreeNode>(); public DefaultTreeNode() : this (NIL_LIST, new TreeMap<string, object> ()) { } public DefaultTreeNode(List<TreeNode> _children, TreeMap<string, object> _attrs) { attrs = _attrs; children = _children; } public TreeNodeChildren getChildren() { return new DefaultTreeNodeChildren(children, attrs); } public TreeNodeAttributes getAttributes() { return new DefaultTreeNodeAttribute(children, attrs); // count = null. } public TreeNode createNewNode() { return new DefaultTreeNode(); } public DefaultTreeNode clone() { return new DefaultTreeNode(children, attrs); } public Either<Error, TreeNode> appendRootNode() { TreeNodeChildren newRootChildren = new DefaultTreeNodeChildren(NIL_LIST, new TreeMap<string, object>()); Either<Error, TreeNode> either = newRootChildren.addNewChildAt(0,this); return either; } public int compareTo(TreeNode o) { return this.GetHashCode() - o.GetHashCode(); } } }