view src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNode.cs @ 6:4d08270a61c8

fix
author Kazuma
date Tue, 19 Jul 2016 16:47:43 +0900
parents dec15de2c6ff
children
line wrap: on
line source

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

	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();
	}


}