view src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNode.cs @ 10:abe0c247f5a5

Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
author Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
date Sun, 23 Oct 2016 07:40:50 +0900
parents
children
line wrap: on
line source

using UnityEngine;

public class DefaultTreeNode : TreeNode {
	
	private List<TreeNode> children;
	private TreeMap<string,byte[]> attrs;
	private static readonly List<TreeNode> NIL_LIST = new List<TreeNode>();

	public DefaultTreeNode() 
		: this (NIL_LIST, new TreeMap<string,byte[]> ())
	{
	}

	public DefaultTreeNode(List<TreeNode> _children, TreeMap<string, byte[]> _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, byte[]>());
		Either<Error, TreeNode> either = newRootChildren.addNewChildAt(0,this);
		return either;
	}

	public int compareTo(TreeNode o) {
		return this.GetHashCode() - o.GetHashCode();
	}


}