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

first commit
author Kazuma
date Tue, 21 Jun 2016 17:11:12 +0900
parents
children 4d08270a61c8 02b2ab7bffe6
line wrap: on
line source

using UnityEngine;
public class DefaultTreeNode : TreeNode {
	private List<TreeNode> children;
	private TreeMap<string,GameObject> attrs;
	// string nodeId = new VMID().toString();

	private static List<TreeNode> NIL_LIST = new List<TreeNode>();

	public DefaultTreeNode() 
		: this (NIL_LIST, new TreeMap<string,GameObject> ())
	{
	}

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

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


}