changeset 0:dec15de2c6ff

first commit
author Kazuma
date Tue, 21 Jun 2016 17:11:12 +0900
parents
children 5c58219da97e
files .hgignore src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungle.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungleTree.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/Jungle.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTree.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTreeEditor.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Attributes.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Children.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/List.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/Node.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/TailNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/headNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/BlackNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyClass.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/RedNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/Rotate.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMap.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMapNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/rebuildNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeList.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListReader.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListWriter.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Journal.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/NullJournal.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Result.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/Command.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodeEditorError.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodePath.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeContext.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeEditor.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultNodePath.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultTreeEditor.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeAttributes.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeChildren.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultOperationLog.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultTreeOperationLog.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingAttributes.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingChildren.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/OperationLog.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/TreeOperationLog.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/index/ParentIndex.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/AppendChildAtOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DefaultTreeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteAttributeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteChildAtOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/NodeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/PutAttributeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/ReplaceRootNodeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/TreeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/AppendChildAt.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteAttribute.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteChildAt.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/NodeEditor.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/PutAttribute.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/replaceRootNodeAt.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/AtomicReference.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultJungleTreeEditor.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTransactionManager.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeContext.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeAttribute.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeChildren.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/TransactionManager.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluator.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultTraverser.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Direction.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluator.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/InterfaceTraverser.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traversal.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traverser.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/TraverserError.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultEither.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultError.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Either.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Error.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/GetOldTreeError.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/IterableConverter.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Pair.cs src/test/csharp/DefaultJungleTreeTest.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/listAdd.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapDelete.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapTest.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/nodeeditor/PutAttributeTest.cs
diffstat 89 files changed, 3574 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,3 @@
+.meta
+.unity
+.DS_Store
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungle.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,101 @@
+using System.Collections;
+using System.Collections.Generic;
+using System;
+using UnityEngine;
+
+public class DefaultJungle : Jungle {
+	private Journal journal;
+	private Dictionary<string, JungleTree> trees;
+	private string uuid;
+	private TreeEditor editor;
+
+	public void Start(){
+		DefaultJungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser()));
+		JungleTree t = j.createNewTree ("fuga");
+
+		JungleTreeEditor e1 = t.getTreeEditor ();
+
+		DefaultNodePath root = new DefaultNodePath ();
+		Either<Error, JungleTreeEditor> either = e1.addNewChildAt (root, 0);
+		e1 = either.b();
+		either = e1.addNewChildAt (root.add (0), 0);
+		e1 = either.b ();
+		e1.success ();
+	}
+
+	public DefaultJungle(Journal journal, string uuid, TreeEditor editor){
+		this.journal = new NullJournal();
+		this.trees = new Dictionary <string, JungleTree>();
+		this.uuid = uuid;
+		this.editor = editor;
+	}
+
+
+	public JungleTree getTreeByName(string name) {
+		
+		JungleTree j = trees[name];
+		if (j != null) {
+			return trees [name];
+		} else {
+			return null;
+		}
+	}
+
+	public JungleTree createNewTree(string name) {
+		ChangeList list = new InnerChangeList(uuid,name);
+		// Debug.Log( list.getTreeName ());
+
+		DefaultTreeNode root = new DefaultTreeNode ();
+		InterfaceTraverser traverser = new InterfaceTraverser (root, true);
+		TreeContext tc = new DefaultTreeContext (root, null, list, uuid, name, 0, traverser);
+		JungleTree newTree = new DefaultJungleTree (tc, uuid, journal.getWriter (), editor);
+		trees.Add (name, newTree);
+		// Trees.getValue => nullの時 ここはどう書けば?
+//		if (trees.TryGetValue (name, newTree) != null) {
+//			return null;
+//		}
+		return newTree;
+	}
+
+	public class InnerChangeList : ChangeList {
+
+		string uuid;
+		string name;
+
+
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+			return this.GetEnumerator();
+		}
+			
+		public IEnumerator<TreeOperation> GetEnumerator()
+		{
+			return iterator ();
+		}
+
+		// construct
+		public InnerChangeList(string _uuid, string _name) {
+			this.uuid = _uuid;
+			this.name = _name;
+		}
+
+		public IEnumerator<TreeOperation> iterator() {
+			List<TreeOperation> nil = new List<TreeOperation>();
+			return nil.iterator();
+		}
+
+		public string uuids() {
+			return uuid;
+		}
+
+		public string getTreeName() {
+			return name;
+		}
+
+		public TreeOperationLog getLog() {
+			return new DefaultTreeOperationLog();
+		}
+	}
+
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungleTree.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,85 @@
+using UnityEngine;
+using System.Collections;
+using System;
+using System.Threading;
+
+
+public class DefaultJungleTree : JungleTree {
+	//atomic reference undefine c#.
+	private AtomicReference<TreeContext> repository;
+	private string uuid;
+	private ChangeListWriter writer;
+	private TreeEditor treeEditor;
+
+
+	public DefaultJungleTree(TreeContext tc, string uuid, ChangeListWriter writer, TreeEditor editor) {
+		this.repository = new AtomicReference<TreeContext>(tc);
+		this.uuid = uuid;
+		this.writer = writer;
+		this.treeEditor = editor;
+	}
+
+	public JungleTreeEditor getTreeEditor() {
+		TreeContext tc = repository.Get ();
+		DefaultTransactionManager txManager = new DefaultTransactionManager(writer, tc, repository, uuid);
+		TreeNode root = tc.getRoot();
+		return new DefaultJungleTreeEditor(root, txManager, treeEditor);
+	}
+
+	public JungleTreeEditor getLocalTreeEditor() {
+		return getTreeEditor ();
+	}
+
+	public TreeNode getRootNode() {
+		TreeContext tc = repository.Get();
+		return tc.getRoot(); // default jungle innner change list?
+	}
+
+	public InterfaceTraverser getTraverser(bool useIndex) {
+		TreeContext tc = repository.Get();
+		return tc.getTraverser();
+	}
+
+	public TreeMap<string, TreeMap<string, List<TreeNode>>> getIndex() {
+		TreeContext tc = repository.Get();
+		return tc.getIndex();
+	}
+
+	public long revision() {
+		TreeContext tc = repository.Get(); // 確かにnull どこから来てる? repositoryのインスタンスを生成してないからかも
+		return tc.getRevision();
+	}
+
+	public Either<Error, JungleTree> getOldTree(long revision) {
+		TreeContext tc = repository.Get();
+
+		for (; tc.getRevision() != revision; ) {
+			tc = tc.prev();
+			if (tc == null)
+				return DefaultEither<Error, JungleTree>.newA(GetOldTreeError.OLD_TREE_NOT_FOUND);
+		}
+
+
+		string oldTreeUuid = uuid + revision;
+		JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, writer, treeEditor);
+		return DefaultEither<Error, JungleTree>.newB(oldTree);
+	}
+
+	public Either<Error, TreeNode> getNodeOfPath(NodePath path) { //eitherはどちらのインターフェースをつかうか、みたいな
+		TreeNode node = repository.Get().getRoot();
+		foreach (int num in path) {
+			if (num == -1)
+				continue;
+			Either<Error, TreeNode> either = node.getChildren().at(num);
+			if (either.isA())
+				return either;
+			node = either.b();
+		}
+		return DefaultEither<Error, TreeNode>.newB(node);
+	}
+
+	public void setBufferSize(int _bufferSize) {
+		// not use
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/Jungle.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+public interface Jungle {
+	JungleTree getTreeByName (string name);
+	JungleTree createNewTree (string name);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTree.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,21 @@
+
+public interface JungleTree  {
+	
+	JungleTreeEditor getTreeEditor();
+
+	JungleTreeEditor getLocalTreeEditor();
+
+	TreeNode getRootNode();
+
+	long revision();
+
+	Either<Error, JungleTree> getOldTree(long revision);
+
+	TreeMap<string, TreeMap<string, List<TreeNode>>> getIndex();
+
+	InterfaceTraverser getTraverser(bool useIndex);
+
+	Either<Error, TreeNode> getNodeOfPath(NodePath path);
+
+	void setBufferSize(int _bufferSize);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTreeEditor.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,12 @@
+using UnityEngine;
+public interface JungleTreeEditor {
+	Either<Error,JungleTreeEditor> addNewChildAt(NodePath path,int pos);
+	Either<Error,JungleTreeEditor> deleteChildAt(NodePath path,int pos);
+	Either<Error,JungleTreeEditor> putAttribute(NodePath path,string key, GameObject value);
+	Either<Error,JungleTreeEditor> deleteAttribute(NodePath path,string key);
+	Either<Error, JungleTreeEditor> replaceNewRootNode();
+	Either<Error,JungleTreeEditor> edit(NodePath path,NodeEditor editor);
+	Either<Error,JungleTreeEditor> success();
+	Either<Error,JungleTreeEditor> flushSuccess();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Attributes.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+using UnityEngine;
+public interface Attributes{
+	GameObject get (string key);
+	string getString (string key);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Children.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+public interface Children {
+	Either<Error, TreeNode> at (int pos);
+	int size();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,85 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class DefaultNode<T> : Node<T> {
+	private T attribute;
+	private Node<T> next;
+    private Node<T> attribute1;
+    private TailNode<T> tailNode;
+    private T attribute2;
+    private Node<T> next1;
+
+    public DefaultNode(T attribute, Node<T> next) {
+		this.attribute = attribute;
+		this.next = next;
+	}
+
+    public DefaultNode(Node<T> attribute1, TailNode<T> tailNode)
+    {
+        this.attribute1 = attribute1;
+        this.tailNode = tailNode;
+    }
+
+
+    public Node<T> getNext() {
+		return next;
+	}
+
+	public T getAttribute() {
+		return attribute;
+	}
+
+	public Node<T> addLast(T attribute) {
+		Node<T> node = next.addLast(attribute);
+		return new DefaultNode<T>(this.attribute, node);
+	}
+
+	public Node<T> add(int currentNum, int num, T attribute) {
+		Node<T> newNode;
+		if (currentNum == num) {
+			newNode = new DefaultNode<T>(attribute, this.next);
+			return new DefaultNode<T>(this.attribute,  newNode);
+		}
+
+		newNode = next.add(currentNum + 1, num, attribute);
+		if (newNode == null)
+			return null;
+
+		return new DefaultNode<T>(this.attribute, newNode);
+	}
+
+	public Node<T> delete(int currentNum, int deleteNum) {
+		if (currentNum == deleteNum) {
+			return new DefaultNode<T> (this.attribute, this.next.getNext ());
+		}
+
+		Node<T> newNode = next.delete (currentNum + 1, deleteNum);
+		if (newNode == null) {
+			return null;
+		}
+		return new DefaultNode<T>(this.attribute, newNode);
+	}
+
+	public Node<T> replaceNode(int currentNum, int num, T attribute) {
+		if (currentNum == num) {
+			return new DefaultNode<T>(attribute, this.getNext());
+		}
+
+		Node<T> newNode = next.replaceNode(currentNum + 1, num, attribute);
+		if (newNode == null) {
+			return null;
+		}
+		return new DefaultNode<T>(this.attribute, newNode);
+	}
+
+
+	public int length() {
+		return next.length() + 1;
+	}
+
+    public T getAttribure()
+    {
+        throw new NotImplementedException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/List.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,133 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using System;
+
+public class List<T> : System.Collections.Generic.List<T>, IEnumerable<T> {
+    private Node<T> head;
+	T[] _array;
+	T Count;
+
+
+    public List() {
+        this.head = new headNode<T>();
+    }
+
+	// この部分がだめ。safeVarargsの部分
+	public List(T attributes) {
+		List<T> list = new List<T> ();
+		//for (int i = 0; i < Convert.ToInt32(attributes.Count); i++) {
+		list = list.addLast (attributes);
+		//}
+        this.head = list.getHead();
+    }
+
+    private List(Node<T> head) {
+        this.head = head;
+    }
+
+    public Node<T> getHead() {
+        return head;
+    }
+
+	public List<T> add(int num, T attribute) {
+        Node<T> newHead = head.add(0, num, attribute);
+        if (newHead == null)
+            return this;
+        return new List<T>(newHead);
+    }
+
+    public List<T> addLast(T attribute) {
+        Node<T> newHead = head.addLast(attribute);
+		return new List<T>(newHead);
+    }
+
+
+    public T index(int num) {
+        int count = 0;
+        Node<T> currentNode = head.getNext();
+        while (currentNode != null) {
+            if (count == num)
+                return currentNode.getAttribute();
+            currentNode = currentNode.getNext();
+            count++;
+        }
+        return default(T);
+    }
+
+	public IEnumerator<T> iterator() {
+		Node<T> currentNode = head.getNext();
+		while (currentNode.getAttribute() != null) {
+			yield return (T)currentNode.getAttribute();
+			currentNode = currentNode.getNext();
+		}
+	}
+		
+
+	public List<T> delete(int num) {
+		Node<T> newNode = head.delete(0, num);
+		if (newNode == null)
+			return this;
+		return new List<T>(newNode);
+	}
+
+	public List<T> replace(int num, T attribute) {
+		Node<T> newHead = head.replaceNode(0, num, attribute);
+		if (newHead == null)
+			return this;
+		return new List<T>(newHead);
+	}
+
+	public T tail() {
+		return index(length() - 1);
+	}
+
+	// java code head.
+	public T headList() {
+		return index(0);
+	}
+
+	public List<T> deleteLast() {
+		return delete(head.length() - 1);
+	}
+
+	public List<T> deleteHead() {
+		return delete(0);
+	}
+
+	public int length() {
+		return head.length();
+	}
+
+	public string toString() {
+		string pathString = "<";
+		//IEnumerator<T> iterator = reverseIterator();
+		while (true) {
+//			pathString += iterator.next();
+//			if (iterator.hasNext())
+//				pathString += ",";
+//			else
+//				break;
+		}
+		pathString += ">";
+		return pathString;
+	}
+
+	public List<T> append(List<T> list) {
+		IEnumerator<T> iterator = list.iterator();
+		List<T> newList = this;
+		while (iterator.MoveNext()) {
+			T attribute = iterator.Current;
+			newList = newList.addLast(attribute);
+		}
+		return newList;
+	}
+
+//	public IEnumerator<T> iterator() {
+//		Node<T> currentNode = head.getNext();
+//		while (currentNode != null) {
+//			yield return currentNode;
+//			currentNode = currentNode.getNext();
+//		}
+//	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/Node.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,17 @@
+
+public interface Node<T> {
+
+    Node<T> getNext();
+
+	Node<T> add(int currentNum, int num, T attribute);
+
+	Node<T> addLast(T attribute);
+
+	Node<T> delete(int currentNum, int num);
+
+	Node<T> replaceNode(int currentNum, int num, T attribute);
+
+    int length();
+
+    T getAttribute();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/TailNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,40 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class TailNode<T> : Node<T> {
+
+	public Node<T> getNext() {
+		return null;
+	}
+
+	public T getAttribute() {
+		return default(T);
+	}
+
+	public Node<T> add(int currentNum, int num, T attribute) {
+		return null;
+	}
+
+	public Node<T> delete(int currentNum, int num) {
+		return null;
+	}
+
+	public Node<T> replaceNode(int currentNum, int num, T attribute) {
+		return null;
+	}
+
+	public Node<T> addLast(T attribute) {
+		return new DefaultNode<T> (attribute, this);
+	}
+		
+    public T getAttribure()
+    {
+        throw new NotImplementedException();
+    }
+
+    public int length()
+    {
+		return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/headNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,70 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class headNode<T> : Node<T>{
+	private Node<T> next;
+
+	public headNode(){
+		this.next = new TailNode<T> ();
+	}
+
+	public headNode(Node<T> next){
+		this.next = next;
+	}
+
+	public Node<T> getNext(){
+		return next;
+	}
+
+	public T getAttribute(){
+		return default(T);
+	}
+
+	public Node<T> add(int currentNum, int num, T attribute) {
+		Node<T> newNode;
+		if (num == 0) {
+			newNode = new DefaultNode<T>(attribute, next);
+			return new headNode<T>(newNode);
+		}
+		newNode = next.add(currentNum + 1, num, attribute);
+		if (newNode == null) {
+			return this;
+		}
+		return new headNode<T>(newNode);
+	}
+
+	public Node<T> addLast(T attribute) {
+		Node<T> node = next.addLast(attribute);
+		return new headNode<T>(node);
+	}
+
+	public Node<T> delete(int currentNum, int deleteNum) {
+		if (currentNum == deleteNum) {
+			return new headNode<T>(this.next.getNext());
+		}
+
+		Node<T> newNode = next.delete(currentNum + 1, deleteNum);
+		if (newNode == null) {
+			return this;
+		}
+		return new headNode<T>(newNode);
+	}
+
+	public Node<T> replaceNode(int currentNum, int num, T attribute) {
+		Node<T> nextNode = getNext();
+		Node<T> newNode = nextNode.replaceNode(currentNum, num, attribute);
+		if (newNode == null)
+			return this;
+		return new headNode<T>(newNode);
+	}
+
+	public int length() {
+		return next.length();
+	}
+
+    public T getAttribure()
+    {
+        throw new NotImplementedException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/BlackNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,125 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class BlackNode<K,V> 
+	:TreeMapNode<K,V>
+{
+	
+	public BlackNode (K key, V value, TreeMapNode<K, V> left, TreeMapNode<K, V> right)
+		: base (key, value, left, right)
+	{
+	}
+
+	public override rebuildNode<K,V> deleteNode ()
+	{
+		EmptyNode<K, V> emptyNode = new EmptyNode<K,V> (key);
+		return new rebuildNode<K,V> (true, emptyNode);
+	}
+
+	public override int checkDepth (int count, int minCount)
+	{ // test method
+		count++;
+		minCount = lefts ().checkDepth (count, minCount);
+		minCount = rights ().checkDepth (count, minCount);
+		return minCount;
+	}
+
+	public override bool isNotEmpty ()
+	{
+		return true;
+	}
+
+	public override TreeMapNode<K, V> createNode (K key, V value, TreeMapNode<K, V> left, TreeMapNode<K, V> right)
+	{
+		return new BlackNode<K,V> (key, value, left, right);
+	}
+
+	public override TreeMapNode<K, V> insBalance ()
+	{
+		Rotate spin = left.checkRotate (Rotate.L);
+
+		if (spin == Rotate.R) {
+			TreeMapNode<K, V> leftChild = new BlackNode<K,V> (left.lefts ().getKey (), left.lefts ().getValue (), left.lefts ().lefts (), left.lefts ().rights ());
+			TreeMapNode<K, V> rightChild = new BlackNode<K,V> (getKey (), getValue (), left.rights (), right);
+			return new RedNode<K,V> (left.getKey (), left.getValue (), leftChild, rightChild);
+
+		} else if (spin == Rotate.LR) {
+			TreeMapNode<K, V> leftChild = new BlackNode<K,V> (left.getKey (), left.getValue (), left.lefts (), left.rights ().lefts ());
+			TreeMapNode<K, V> rightChild = new BlackNode<K,V> (getKey (), getValue (), left.rights ().rights (), right);
+			return new RedNode<K,V> (left.rights ().getKey (), left.rights ().getValue (), leftChild, rightChild);
+
+		}
+
+		spin = right.checkRotate (Rotate.R);
+		if (spin == Rotate.L) {
+			TreeMapNode<K, V> leftChild = new BlackNode<K,V> (getKey (), getValue (), left, right.lefts ());
+			TreeMapNode<K, V> rightChild = new BlackNode<K,V> (right.rights ().getKey (), right.rights ().getValue (), right.rights ().lefts (), right.rights ().rights ());
+			return new RedNode<K,V> (right.getKey (), right.getValue (), leftChild, rightChild);
+
+		} else if (spin == Rotate.RL) {
+			TreeMapNode<K, V> leftChild = new BlackNode<K,V> (getKey (), getValue (), left, right.lefts ().lefts ());
+			TreeMapNode<K, V> rightChild = new BlackNode<K,V> (right.getKey (), right.getValue (), right.lefts ().rights (), right.rights ());
+			return new RedNode<K,V> (right.lefts ().getKey (), right.lefts ().getValue (), leftChild, rightChild);
+
+		}
+
+		return this;
+	}
+
+	public override Rotate checkRotate (Rotate side)
+	{
+		return Rotate.N;
+	}
+
+	public override bool isRed ()
+	{
+		return false;
+	}
+
+	public override rebuildNode<K,V> replaceNode (TreeMapNode<K, V> parent, Comparer ctr)
+	{
+		TreeMapNode<K, V> newNode;
+		if (!this.lefts ().isNotEmpty () && !this.rights ().isNotEmpty ()) { //自身を削除する
+			return deleteNode ();//黒が1つ減るので木のバランスを取る
+		} else if (this.lefts ().isNotEmpty () && !this.rights ().isNotEmpty ()) { //左の部分木を昇格させる
+			newNode = createNode (lefts ().getKey (), lefts ().getValue (), lefts ().lefts (), lefts ().rights ());
+			if (!this.lefts ().isRed ()) //昇格させる木のrootが黒だったらバランスを取る
+				return new rebuildNode<K,V> (true, newNode);
+			return new rebuildNode<K,V> (false, newNode);
+		} else if (!this.lefts ().isNotEmpty () && this.rights ().isNotEmpty ()) { //右の部分木を昇格させる
+			newNode = createNode (rights ().getKey (), rights ().getValue (), rights ().lefts (), rights ().rights ());
+			if (!this.rights ().isRed ()) //昇格させる木のrootが黒だったらバランスを取る
+				return new rebuildNode<K,V> (true, newNode);
+			return new rebuildNode<K,V> (false, newNode);
+		} else {//子ノードが左右にある場合 二回目はここには入らない
+			//左の部分木の最大の値を持つNodeと自身を置き換える
+			TreeMapNode<K, V> cur = this.lefts ();
+			while (cur.rights ().isNotEmpty ()) { //左の部分期の最大値を持つNodeを取得する
+				cur = cur.rights ();
+			}
+			if (this.lefts ().rights ().isNotEmpty ()) { //左の部分木が右の子を持っているか
+				rebuildNode<K, V> leftSubTreeNodeRebuildNode = this.lefts ().deleteSubTreeMaxNode (null, ctr, Rotate.L);//最大値を削除した左の部分木を返す。rootはthisと同じ。
+				if (leftSubTreeNodeRebuildNode.rebuilds ()) {
+					TreeMapNode<K, V> leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode ();
+					TreeMapNode<K, V> newParent = createNode (cur.getKey (), cur.getValue (), leftSubTreeNode, this.rights ());
+					return leftSubTreeNode.deleteBalance (newParent, ctr);
+				}
+				//same name onece used.
+				TreeMapNode<K, V> leftSubTreeNodes = leftSubTreeNodeRebuildNode.getNode ();
+				newNode = createNode (cur.getKey (), cur.getValue (), leftSubTreeNodes, this.rights ()); //rootをcurと入れ替えることでNodeの削除は完了する
+				return new rebuildNode<K,V> (false, newNode);
+			} else {
+				rebuildNode<K, V> leftSubTreeNodeRebuildNode = this.lefts ().replaceNode (this, ctr);//右の子がいなかった場合、左の子を昇格させるだけで良い。
+				if (leftSubTreeNodeRebuildNode.rebuilds ()) {
+					TreeMapNode<K, V> node = leftSubTreeNodeRebuildNode.getNode ();
+					TreeMapNode<K, V> newParent = createNode (this.lefts ().getKey (), this.lefts ().getValue (), node, this.rights ());
+					return node.deleteBalance (newParent, ctr);
+				}
+				TreeMapNode<K,V> leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode ();
+				newNode = createNode (this.lefts ().getKey (), this.lefts ().getValue (), leftSubTreeNode, this.rights ());
+				return new rebuildNode<K,V> (false, newNode);
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyClass.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,12 @@
+using System;
+
+namespace AssemblyCSharpfirstpass
+{
+	public class NULL
+	{
+		public NULL ()
+		{
+		}
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,68 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class EmptyNode<K,V> : TreeMapNode<K,V>{
+	static V values;
+	// Use this for initialization
+	public EmptyNode ()
+		: base (default(K),default(V))
+	{
+	}
+
+	public EmptyNode (K key)
+		: base (key,values)
+	{
+	}
+
+	public TreeMapNode<K,V> left(){
+		return new EmptyNode<K,V>();
+	}
+
+	public TreeMapNode<K,V> right(){
+		return new EmptyNode<K,V>();
+	}
+
+	public override bool isNotEmpty(){
+		return false;
+	}
+
+	public override TreeMapNode<K,V> createNode(K k,V value,TreeMapNode<K,V> left, TreeMapNode<K,V> right){
+		return new RedNode<K,V> (key, value, new EmptyNode<K,V> (), new EmptyNode<K,V> ());
+	}
+
+	public TreeMapNode<K,V> put(K k,V value){
+		return new RedNode<K, V> (k, value, new EmptyNode<K,V> (), new EmptyNode<K,V> ());
+	}
+
+	//I don't know only Comparator method.
+	public override rebuildNode<K, V> replaceNode(TreeMapNode<K, V> parent, Comparer ctr) { // not use method
+		return new rebuildNode<K,V>(false, this);
+	}
+
+	public override rebuildNode<K,V> deleteNode(){
+		return new rebuildNode<K, V> (false, this);
+	}
+		
+	public override TreeMapNode<K,V> insBalance(){
+		return insBalance();
+	}
+
+	public override Rotate checkRotate(Rotate side){
+		return Rotate.N;
+	}
+
+	public override bool isRed(){
+		return false;
+	}
+
+	public override int checkDepth(int count, int minCount) { // test method
+		if (count < minCount | minCount == 0)
+			minCount = count;
+		Debug.Log("depth = " + count);
+		//c# is there assert??
+		//Assert.assertTrue(count <= 2 * minCount);
+		return minCount;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/RedNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,100 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class RedNode<K,V> : TreeMapNode<K,V>{
+
+	// Use this for initialization
+	public RedNode (K key, V value, TreeMapNode<K,V> left, TreeMapNode<K,V> right)
+		: base (key, value, left, right)
+	{
+	}
+	
+	// Update is called once per frame
+	public override bool isNotEmpty ()
+	{
+		return true;
+	}
+
+	public override rebuildNode<K,V> deleteNode() {
+		TreeMapNode<K,V> emptyNode = new EmptyNode<K,V>(this.getKey());
+		return new rebuildNode<K,V>(false, emptyNode);
+	}
+
+	public override Rotate checkRotate(Rotate side) {
+		if (side == Rotate.L) {
+			if (left.isRed())
+				return Rotate.R;
+			else if (right.isRed())
+				return Rotate.LR;
+			return Rotate.N;
+		} else {
+			if (left.isRed())
+				return Rotate.RL;
+			else if (right.isRed())
+				return Rotate.L;
+			return Rotate.N;
+		}
+	}
+
+	public override rebuildNode<K,V> replaceNode(TreeMapNode<K, V> parent, Comparer ctr) {
+		TreeMapNode<K, V> newNode;
+		if (!this.lefts().isNotEmpty() && !this.rights().isNotEmpty()) { //自身を削除する
+			return deleteNode();
+		} else if (this.lefts().isNotEmpty() && !this.rights().isNotEmpty()) { //左の部分木を昇格させる
+			newNode = lefts().createNode(lefts().getKey(), lefts().getValue(), lefts().lefts(), lefts().rights());
+			return new rebuildNode<K,V>(false, newNode);
+		} else if (!this.lefts().isNotEmpty() && this.rights().isNotEmpty()) { //右の部分木を昇格させる
+			newNode = rights().createNode(rights().getKey(), rights().getValue(), rights().lefts(), rights().rights());
+			return new rebuildNode<K,V>(false, newNode);
+		} else {//子ノードが左右にある場合
+			//左の部分木の最大の値を持つNodeと自身を置き換える
+			TreeMapNode<K, V> cur = this.lefts();
+			
+			while (cur.rights().isNotEmpty()) {
+				cur = cur.rights();
+			}
+			if (this.lefts().rights().isNotEmpty()) {
+				rebuildNode<K, V> leftSubTreeNodeRebuildNode = this.lefts().deleteSubTreeMaxNode(null, ctr, Rotate.L);
+				if (leftSubTreeNodeRebuildNode.rebuilds()) {
+					TreeMapNode<K, V> node = leftSubTreeNodeRebuildNode.getNode();
+					TreeMapNode<K, V> newParent = createNode(cur.getKey(), cur.getValue(), node, this.rights());
+					return node.deleteBalance(newParent, ctr);
+				}
+				TreeMapNode<K, V> leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode();
+				newNode = createNode(cur.getKey(), cur.getValue(), leftSubTreeNode, this.rights());
+				return new rebuildNode<K,V>(false, newNode);
+			} else {
+				rebuildNode<K, V> leftSubTreeNodeRebuildNode = this.lefts().replaceNode(this, ctr);
+				if (leftSubTreeNodeRebuildNode.rebuilds()) {
+					TreeMapNode<K, V> node = leftSubTreeNodeRebuildNode.getNode();
+					TreeMapNode<K, V> newParent = createNode(this.lefts().getKey(), this.lefts().getValue(), node, this.rights());
+					return node.deleteBalance(newParent, ctr);
+				}
+				TreeMapNode<K, V> leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode();
+				newNode = createNode(cur.getKey(), cur.getValue(), leftSubTreeNode, this.rights());
+				return new rebuildNode<K,V>(false, newNode);
+			}
+			
+		}
+	}
+
+	public override bool isRed() {
+		return true;
+	}
+
+	public override TreeMapNode<K, V> createNode(K key, V value, TreeMapNode<K, V> left, TreeMapNode<K, V> right) {
+		return new RedNode<K,V>(key, value, left, right);
+	}
+
+	public override TreeMapNode<K, V> insBalance() {
+		return this;
+	}
+
+	public override int checkDepth(int count, int minCount) { // test method
+		count++;
+		minCount = lefts().checkDepth(count, minCount);
+		minCount = rights().checkDepth(count, minCount);
+		return minCount;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/Rotate.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,7 @@
+using UnityEngine;
+using System.Collections;
+
+public enum Rotate{
+	R,L,RL,LR,N
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMap.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,148 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using System;
+
+public class TreeMap<K, V> {
+	TreeMapNode<K, V> root;
+	Comparer comparator;
+
+
+	public TreeMap(IComparer icompere) {
+		this.root = new EmptyNode<K, V> ();
+	}
+
+	public TreeMap() {
+		this.root = new EmptyNode<K, V> ();
+		this.comparator =  Comparer.Default;
+	}
+
+	public TreeMap(TreeMapNode<K, V> root) {
+		this.root = root;
+		//this.comparator = comparator;
+	}
+
+	public TreeMap(TreeMapNode<K, V> root, Comparer comparator) {
+		this.root = root;
+		this.comparator = comparator;
+	}
+
+	public TreeMapNode<K, V> getRoot() {
+		return root;
+	}
+
+	public V get(K key) {
+		return root.get(key, this.comparator);
+	}
+
+	public TreeMap<K, V> put(K key, V value) {
+		if(isEmpty()) {
+			TreeMapNode<K, V> newRoot = new BlackNode<K, V> (key, value, new EmptyNode<K, V> (), new EmptyNode<K, V> ());
+			return new TreeMap<K, V> (newRoot, this.comparator);
+		}
+
+		TreeMapNode<K, V> newEntry = root.put (key, value, this.comparator);
+		TreeMapNode<K, V> newRoots = new BlackNode<K, V> (newEntry.getKey (), newEntry.getValue (), newEntry.lefts (), newEntry.rights ());
+		return new TreeMap<K, V> (newRoots, this.comparator);
+	}
+		
+	public bool isEmpty() {
+		return !root.isNotEmpty ();
+	}
+
+	public TreeMap<K, V> delete(K key, Comparer ctr) {
+		if (key == null) {
+			return this;
+		}
+		rebuildNode<K, V> rootRebuildNode = this.root.delete (key, null, ctr, Rotate.N);
+		if (!rootRebuildNode.notEmpty ()) {
+			// key does not found, do nothing 
+			return this;
+		}
+		TreeMapNode<K, V> root = rootRebuildNode.getNode ();
+		if (!root.isNotEmpty ()) {
+			return new TreeMap<K, V> (new EmptyNode<K, V> (), this.comparator);
+		}
+		TreeMapNode<K, V> newRoot = new BlackNode<K, V> (root.getKey (), root.getValue (), root.lefts (), root.rights ());
+		return new TreeMap<K, V>(newRoot, this.comparator);
+	}
+
+	public TreeMap<K, V> delete(K key) {
+		if (key == null) {
+			return this;
+		}
+		rebuildNode<K, V> rootRebuildNode = root.delete (key, null, comparator, Rotate.N);
+		if (!rootRebuildNode.notEmpty ()) {
+			return this;
+		}
+		TreeMapNode<K, V> roots = rootRebuildNode.getNode ();
+		if (!root.isNotEmpty ()) {
+			return new TreeMap<K, V> (new EmptyNode<K, V> (), this.comparator);
+		}
+		TreeMapNode<K, V> newRoot = new BlackNode<K, V> (roots.getKey (), roots.getValue (), roots.lefts (), roots.rights ());
+		return new TreeMap<K, V> (newRoot, this.comparator);
+	}
+	// like to iterator and IEmurator.
+	public IEnumerator<K> keys() {
+		return new iterators<K> ();
+	}
+
+
+	public void checkDepth() {
+		root.checkDepth (0, 0);
+		Debug.Log ("-----------------------------------");
+	}
+
+	public class iterators<K> : IEnumerator<K> {
+		Stack<TreeMapNode<K,V>> nodeStack = new Stack<TreeMapNode<K,V>>();
+		TreeMapNode<K,V> currentNode = new TreeMap<K,V>().getRoot();
+		public List<K> appLines { get; set; }
+		private int position;
+
+
+		public bool MoveNext() {
+						return currentNode != null;
+					}
+			
+
+		public K Current{
+			get {
+				K key = currentNode.getKey ();
+				if (currentNode.lefts ().isNotEmpty ()) {
+					nodeStack.Push (currentNode);
+					currentNode = currentNode.lefts ();
+					return key;
+				} else if (currentNode.rights ().isNotEmpty ()) {
+					currentNode = currentNode.rights ();
+					return key;
+				} else if (nodeStack.Count == 0) {
+					currentNode = null;
+					return key;
+				}
+				do {
+					currentNode = nodeStack.Pop ().rights ();
+					if (currentNode.isNotEmpty ()) {
+						return key;
+					}
+				}while (nodeStack.Count != 0);
+				return key;
+			}
+		}
+
+		object IEnumerator.Current
+		{
+			get { return (appLines.ToArray())[position] ; }
+		}
+
+		public void Dispose() {
+			((IEnumerator<K>)this.appLines).Dispose ();
+		}
+
+		public void Reset() {
+			((IEnumerator<K>)this.appLines).Reset();
+		}
+
+	}
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMapNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,338 @@
+using System.Collections;
+using System;
+using UnityEngine;
+
+
+public abstract class  TreeMapNode<K,V>
+{
+// K,Vがnullableではないので受け付けない
+	// ジェネリックの扱いがJavaとちがうー>特にnullの扱いが面倒。
+	protected  K key;
+	protected  V value;
+	protected TreeMapNode<K,V> right;
+	protected TreeMapNode<K,V> left;
+
+	void Start(){
+		key = default(K);
+		value = default(V);
+	}
+
+	//  Use this for initialization
+	public TreeMapNode (K key, V value)
+	{
+		this.key = key;
+		this.value = value;
+	}
+
+	public TreeMapNode (K key, V value, TreeMapNode<K,V> left, TreeMapNode<K,V> right)
+	{
+		this.key = key;
+		this.value = value;
+		this.right = right;
+		this.left = left;
+	}
+
+	public TreeMapNode<K,V> lefts ()
+	{
+		return left;
+	}
+		
+
+	public int compare(K compareKey, Comparer ctr)  {
+		return ctr.Compare(compareKey, this.getKey());
+	}
+    
+	public V get (K key, Comparer ctr)
+ 	{
+ 		TreeMapNode<K,V> cur = this;
+		int result = cur.compare (key, ctr);
+		while (cur.isNotEmpty ()) {
+			if (result > 0) {
+				cur = cur.rights ();
+				Debug.Log (cur);
+			} else if (result < 0) {
+				cur = cur.lefts ();
+			} else if (result == 0) {
+				if (cur != null) {
+					return cur.getValue ();
+				}
+			}
+		}
+		return default(V); // Optional<V>.ofNullable (null);
+	}
+
+
+
+	public TreeMapNode<K,V> rights () {
+		return right;
+	}
+
+	public K getKey () {
+		return key;
+	}
+
+	public V getValue () {
+		return value;
+	}
+
+	// may be to use Comparer??
+	public TreeMapNode<K,V> put (K k, V v,Comparer ctr) {
+
+		if (!isNotEmpty ()) {
+			return createNode (k, value, left, right);
+		}
+
+		int result = compare (k,ctr);
+		if (result > 0) {
+			TreeMapNode<K,V> node = right.put (k, value,ctr);
+			node = createNode (key, this.value, left, node);
+			return node.insBalance ();
+		} else if (result < 0) {
+			TreeMapNode<K,V> node = left.put (k, value,ctr);
+			return createNode (key, this.value, node, right).insBalance ();
+		}
+		return createNode (key, value, left, right);
+	}
+		
+	public rebuildNode<K,V> delete (K key, TreeMapNode<K,V> parent, Comparer ctr, Rotate side)
+	{
+		if (this.isNotEmpty ()) {
+			rebuildNode<K,V> rebuildNode;
+			int result = compare(key, ctr);
+			if (result > 0) {
+				rebuildNode = right.delete (key, this, ctr, Rotate.R);
+			} else if (result < 0) {
+				rebuildNode = left.delete (key, this, ctr, Rotate.L);
+			} else {
+				rebuildNode = replaceNode (parent, ctr);
+			}
+			if (parent == null) {
+				return rebuildNode;
+			}
+			TreeMapNode<K,V> node = rebuildNode.getNode ();
+			if (rebuildNode.rebuilds ()) {
+				// ここのエラーは後で
+				return node.deleteBalance (parent, ctr);
+			}
+			TreeMapNode<K,V> newParent;
+			if (side == Rotate.L) {
+				newParent = parent.createNode (parent.getKey (), parent.getValue (), node, parent.rights ());
+			} else {
+				newParent = parent.createNode (parent.getKey (), parent.getValue (), parent.lefts (), node);
+			}
+			return new rebuildNode<K,V> (false, newParent);
+		}
+		return null;
+	}
+
+	public rebuildNode<K,V> deleteSubTreeMaxNode (TreeMapNode<K, V> parent, Comparer ctr, Rotate side)
+	{
+		rebuildNode<K,V> rebuildNode;
+		TreeMapNode<K, V> node;
+		if (rights ().isNotEmpty ()) {// 最大値のノードが取得できるまで潜る
+			rebuildNode = rights ().deleteSubTreeMaxNode (this, ctr, Rotate.R);
+		} else {
+			rebuildNode = this.replaceNode (parent, ctr);
+		}
+		if (parent == null)
+			return rebuildNode;
+
+		if (rebuildNode.rebuilds ()) {
+			node = rebuildNode.getNode ();
+			return node.deleteBalance (parent, ctr);
+		}
+		if (side == Rotate.R)
+			node = parent.createNode (parent.getKey (), parent.getValue (), parent.lefts (), rebuildNode.getNode ());
+		else
+			node = parent.createNode (parent.getKey (), parent.getValue (), rebuildNode.getNode (), parent.rights ());
+		return new rebuildNode<K,V> (false, node);
+	}
+
+
+	public rebuildNode<K, V> deleteBalance (TreeMapNode<K, V> parent, Comparer ctr)
+	{
+		TreeMapNode<K, V> newNode = null;
+		if (!isRed ()) {
+			if (0 > compare (parent.getKey (), ctr)) {
+				bool rightChild = parent.lefts ().rights ().isRed ();
+				bool leftChild = parent.lefts ().lefts ().isRed ();
+
+				if (!parent.isRed ()) {
+					if (!parent.lefts ().isRed ()) {
+						if (!rightChild && !leftChild) {
+							newNode = rebuildThree (parent, Rotate.R);
+							return new rebuildNode<K,V> (true, newNode);
+						}
+						if (rightChild) {
+							newNode = rebuildfive (parent, Rotate.R);
+							return new rebuildNode<K,V> (false, newNode);
+						} else {
+							newNode = rebuildsix (parent, Rotate.R);
+							return new rebuildNode<K,V> (false, newNode);
+						}
+					} else { // 左の子が赤
+						newNode = rebuildTwo (parent, ctr, Rotate.R);
+						return new rebuildNode<K,V> (false, newNode);
+					}
+				} else { // 親が赤
+					if (!rightChild && !leftChild) {
+						newNode = rebuildFour (parent, Rotate.R);
+						return new rebuildNode<K,V> (false, newNode);
+					}
+					if (rightChild) {
+						newNode = rebuildfive (parent, Rotate.R);
+						return new rebuildNode<K,V> (false, newNode);
+					} else {
+						newNode = rebuildsix (parent, Rotate.R);
+						return new rebuildNode<K,V> (false, newNode);
+					}
+				}
+			} else {
+				bool rightChild = parent.rights ().rights ().isRed ();
+				bool leftChild = parent.rights ().lefts ().isRed ();
+
+				if (!parent.isRed ()) { // 親が黒
+					if (!parent.rights ().isRed ()) { // 左の子が黒
+						if (!rightChild && !leftChild) {
+							newNode = rebuildThree (parent, Rotate.L);
+							return new rebuildNode<K,V> (true, newNode);
+						}
+						if (rightChild) {
+							newNode = rebuildsix (parent, Rotate.L);
+							return new rebuildNode<K,V> (false, newNode);
+						} else {
+							newNode = rebuildfive (parent, Rotate.L);
+							return new rebuildNode<K,V> (false, newNode);
+						}
+					} else { // 左の子が赤
+						newNode = rebuildTwo (parent, ctr, Rotate.L);
+						return new rebuildNode<K,V> (false, newNode);
+					}
+				} else { // 親が赤
+					if (!rightChild && !leftChild) {
+						newNode = rebuildFour (parent, Rotate.L);
+						return new rebuildNode<K,V> (false, newNode);
+					}
+					if (rightChild) {
+						newNode = rebuildsix (parent, Rotate.L);
+						return new rebuildNode<K,V> (false, newNode);
+					} else {
+						newNode = rebuildfive (parent, Rotate.L);
+						return new rebuildNode<K,V> (false, newNode);
+					}
+				}
+			}
+		}
+		if (0 > (compare (parent.getKey (), ctr))) {
+			newNode = parent.createNode (parent.getKey (), parent.getValue (), parent.lefts (), this);
+			return new rebuildNode<K,V> (false, newNode);
+		} else {
+			newNode = parent.createNode (parent.getKey (), parent.getValue (), this, parent.rights ());
+			return new rebuildNode<K,V> (false, newNode);
+		}
+	}
+
+	protected TreeMapNode<K, V> rebuildTwo (TreeMapNode<K, V> parent, Comparer ctr, Rotate side)
+	{ //  case2
+		if (side == Rotate.L) { //  rotate Left
+			TreeMapNode<K, V> node = parent.rights ();
+			TreeMapNode<K, V> leftSubTreeRoot = node.createNode (parent.getKey (), parent.getValue (), this, node.lefts ()); //  check
+			rebuildNode<K, V> rebuildNode = new rebuildNode<K,V> (false, leftSubTreeRoot);
+			rebuildNode<K, V> leftNodeRebuildNode = this.deleteBalance (rebuildNode.getNode (), ctr);
+			TreeMapNode<K, V> rightNode = node.rights ();
+			return parent.createNode (node.getKey (), node.getValue (), leftNodeRebuildNode.getNode (), rightNode);
+		} else {  //  rotate Right
+			TreeMapNode<K, V> node = parent.lefts ();
+			TreeMapNode<K, V> rightSubTreeRoot = node.createNode (parent.getKey (), parent.getValue (), node.rights (), this);
+			rebuildNode<K, V> rightSubTreeRebuildNode = new rebuildNode<K,V> (false, rightSubTreeRoot);
+			rebuildNode<K, V> rightNodeRebuildNode = this.deleteBalance (rightSubTreeRebuildNode.getNode (), ctr);
+			TreeMapNode<K, V> leftNode = node.lefts ();
+			return parent.createNode (node.getKey (), node.getValue (), leftNode, rightNodeRebuildNode.getNode ());
+		}
+	}
+
+	protected TreeMapNode<K, V> rebuildThree (TreeMapNode<K, V> parent, Rotate side)
+	{ //  case3 再帰
+		if (side == Rotate.L) {
+			TreeMapNode<K, V> rightNode;
+			if (parent.rights ().isNotEmpty ())
+				rightNode = new RedNode<K,V> (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts (), parent.rights ().rights ()); //  check
+			else
+				rightNode = new EmptyNode<K,V> ();
+			return parent.createNode (parent.getKey (), parent.getValue (), this, rightNode);
+		} else {
+			TreeMapNode<K, V> leftNode;
+			if (parent.lefts ().isNotEmpty ())
+				leftNode = new RedNode<K,V> (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ()); //  check
+			else
+				leftNode = new EmptyNode<K,V> ();
+			return parent.createNode (parent.getKey (), parent.getValue (), leftNode, this);
+		}
+	}
+
+	protected TreeMapNode<K, V> rebuildFour (TreeMapNode<K, V> parent, Rotate side)
+	{ // case 4
+		if (side == Rotate.R) {
+			TreeMapNode<K, V> leftNode = new RedNode<K,V> (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ());
+			return new BlackNode<K,V> (parent.getKey (), parent.getValue (), leftNode, this);
+		} else {
+			TreeMapNode<K, V> rightNode = new RedNode<K,V> (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts (), parent.rights ().rights ());
+			return new BlackNode<K,V> (parent.getKey (), parent.getValue (), this, rightNode);
+		}
+	}
+
+	protected TreeMapNode<K, V> rebuildfive (TreeMapNode<K, V> parent, Rotate side)
+	{ // case5
+		if (side == Rotate.R) { //  rotate Left
+			TreeMapNode<K, V> leftChild = new RedNode<K,V> (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ().lefts ());
+			TreeMapNode<K, V> rightChild = parent.lefts ().rights ().rights ();
+			TreeMapNode<K, V> leftSubTreeRoot = new BlackNode<K,V> (parent.lefts ().rights ().getKey (), parent.lefts ().rights ().getValue (), leftChild, rightChild);
+			TreeMapNode<K, V> newParent = parent.createNode (parent.getKey (), parent.getValue (), leftSubTreeRoot, this);
+			return this.rebuildsix (newParent, Rotate.R);
+		} else {  //  rotate Right 修正済み
+			TreeMapNode<K, V> leftChild = parent.rights ().lefts ().lefts ();
+			TreeMapNode<K, V> rightChild = new RedNode<K,V> (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts ().rights (), parent.rights ().rights ());
+			TreeMapNode<K, V> rightSubTreeRoot = new BlackNode<K,V> (parent.rights ().lefts ().getKey (), parent.rights ().lefts ().getValue (), leftChild, rightChild);
+			TreeMapNode<K, V> newParent = parent.createNode (parent.getKey (), parent.getValue (), this, rightSubTreeRoot);
+			return this.rebuildsix (newParent, Rotate.L);
+		}
+	}
+
+	protected TreeMapNode<K, V> rebuildsix (TreeMapNode<K, V> parent, Rotate side)
+	{ // case6
+		if (side == Rotate.L) { //  rotate Left
+			TreeMapNode<K, V> leftChild = parent.rights ().createNode (parent.getKey (), parent.getValue (), this, parent.rights ().lefts ()); // check
+			TreeMapNode<K, V> rightChild = new BlackNode<K,V> (parent.rights ().rights ().getKey (), parent.rights ().rights ().getValue (), parent.rights ().rights ().lefts (), parent.rights ().rights ().rights ());
+			return parent.createNode (parent.rights ().getKey (), parent.rights ().getValue (), leftChild, rightChild);
+		} else {  //  rotate Right
+			TreeMapNode<K, V> leftChild = new BlackNode<K,V> (parent.lefts ().lefts ().getKey (), parent.lefts ().lefts ().getValue (), parent.lefts ().lefts ().lefts (), parent.lefts ().lefts ().rights ());
+			TreeMapNode<K, V> rightChild = parent.lefts ().createNode (parent.getKey (), parent.getValue (), parent.lefts ().rights (), this);
+			return parent.createNode (parent.lefts ().getKey (), parent.lefts ().getValue (), leftChild, rightChild);
+		}
+	}
+
+
+
+
+
+
+
+
+	public abstract bool isNotEmpty ();
+
+	public abstract TreeMapNode<K,V> createNode (K key, V value, TreeMapNode<K,V> left, TreeMapNode<K,V> right);
+
+	public abstract TreeMapNode<K,V> insBalance ();
+
+
+	public abstract Rotate checkRotate (Rotate side);
+
+	public abstract bool isRed ();
+
+	public abstract rebuildNode<K,V> replaceNode (TreeMapNode<K,V> parent, Comparer ctr);
+
+	public abstract rebuildNode<K,V> deleteNode ();
+
+	// test method
+	public abstract int checkDepth (int count, int minCount);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/rebuildNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,25 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class rebuildNode<K,V> {
+	private bool rebuild;
+	TreeMapNode<K,V> node;
+
+	public rebuildNode(bool l,TreeMapNode<K,V> node){
+		this.rebuild = l;
+		this.node = node;
+	}
+	//don't same name.
+	public bool rebuilds(){
+		return rebuild;
+	}
+
+	public TreeMapNode<K,V> getNode(){
+		return node;
+	}
+
+	public bool notEmpty(){
+		return node != null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeList.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,8 @@
+using UnityEngine;
+using System.Collections.Generic;
+
+public interface ChangeList : IEnumerable<TreeOperation> {
+	string uuids();
+	string getTreeName();
+	TreeOperationLog getLog();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListReader.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+public interface ChangeListReader{
+	ChangeListReader newReader();
+	ChangeList read();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListWriter.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,6 @@
+using UnityEngine;
+using System.Collections;
+
+public interface ChangeListWriter {
+	Result write (ChangeList operations);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Journal.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+public interface Journal {
+	ChangeListReader getReader();
+	ChangeListWriter getWriter();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/NullJournal.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,37 @@
+using System.Collections.Generic;
+
+public class NullJournal : Journal {
+
+	private static NullChangeListWriter NULL_WRITER = new NullChangeListWriter();
+	private static NullChangeListReader NULL_READER = new NullChangeListReader();
+
+	public ChangeListReader getReader() {
+		return NULL_READER;
+	}
+
+	public ChangeListWriter getWriter() {
+		return NULL_WRITER;
+	}
+
+	private class NullChangeListWriter : ChangeListWriter{
+		public Result write(ChangeList operations){
+			return Result.SUCCESS;
+		}
+	}
+
+	private class NullChangeListReader : ChangeListReader { 
+		public ChangeListReader newReader() {
+			return this;
+		}
+
+		public ChangeList read() {
+			return null;
+		}
+
+		public IEnumerator<ChangeList> iterator() {
+			return null;
+		}
+
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Result.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,19 @@
+
+public class Result {
+	public static Result ACCEPT = new Result("ACCEPT");
+	public static Result CONTINUE = new Result("CONTINUE");
+	public static Result BREAK = new Result("BREAK");
+	public static Result GOAL = new Result("GOAL");
+	public static Result SUCCESS = new Result ("SUCCESS");
+
+	private string name;
+
+	private Result(string _name) {
+		name = _name;
+	}
+
+	private string toString() {
+		return name;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/Command.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,7 @@
+public enum Command{
+	APPEND_CHILD,
+	DELETE_CHILD,
+	PUT_ATTRIBUTE,
+	DELETE_ATTRIBUTE,
+	REPLACE_ROOT
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodeEditorError.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,10 @@
+using UnityEngine;
+using System.Collections;
+
+public class NodeEditorError{
+
+	public static Error INDEX_OUT_OF_BOUNDS = new DefaultError();
+	public static Error DELETE_KEY_NOT_FOUND = new DefaultError();
+	public static Error NULL_VALUE_NOT_ALLOWED = new DefaultError();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodePath.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,8 @@
+using System.Collections.Generic;
+public interface NodePath : IEnumerable<int> {
+	NodePath add (int pos);
+	Pair<int,NodePath> pop();
+	NodePath tail();
+	int size();
+	Pair<int, NodePath> last();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeContext.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,20 @@
+
+public interface TreeContext {
+	TreeNode getRoot();
+
+	TreeContext prev();
+
+	string getUuid();
+
+	string getTreeName();
+
+	long getRevision();
+
+	TreeMap<string, TreeMap<string, List<TreeNode>>> getIndex();
+
+    // Iterable<TreeOperation> getOperations();
+
+	// ParentIndex getParentIndex();
+
+	InterfaceTraverser getTraverser();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeEditor.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,4 @@
+
+public interface TreeEditor {
+	Either<Error, LoggingNode> edit (TreeNode root, NodePath path, NodeEditor transformer);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultNodePath.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,86 @@
+using UnityEngine;
+using System.Collections.Generic;
+using System.Collections;
+
+public class DefaultNodePath : NodePath {
+	private List<int> path = new List<int>();
+
+	int[] _array;
+	int Count;
+
+	IEnumerator IEnumerable.GetEnumerator()
+	{
+		// call the generic version of the method
+		return this.GetEnumerator();
+	}
+
+	public IEnumerator<int> GetEnumerator()
+	{
+		for (int i = 0; i < Count; i++)
+			yield return _array[i];
+	}
+
+
+
+	public void Start() {
+		NodePath p = new DefaultNodePath();
+		p = p.add(1).add(2).add(3).add(4);
+		Debug.Log (p.ToString ());
+	}
+
+	public DefaultNodePath() {
+		path = new List<int> ().addLast (-1);
+	}
+
+	private DefaultNodePath(List<int> path) {
+		this.path = path;
+	}
+
+
+//	public IEnumerator<int> iterator() {
+//		return path.iterator();
+//	}
+
+	public NodePath add(int pos) {
+		List<int> newPath = path.addLast(pos);
+		return new DefaultNodePath(newPath);
+	}
+
+	public Pair<int, NodePath> pop() {
+		int head = path.headList();
+		List<int> tail = path.deleteHead();
+		return new Pair<int, NodePath>(head, new DefaultNodePath(tail));
+	}
+
+	public Pair<int, NodePath> last() {
+		int last = path.headList();
+		List<int> list = path.deleteHead();
+		return new Pair<int, NodePath>(last, new DefaultNodePath(list));
+	}
+
+	public string toString() {
+		return path.toString();
+	}
+
+	public int size() {
+		return path.length();
+	}
+
+	public NodePath tail() {
+		List<int> tail = path.deleteLast ();
+		return new DefaultNodePath (tail);
+	}
+
+	public List<DefaultNodePath> inits() {
+		List<DefaultNodePath> paths = new List<DefaultNodePath> ();
+		List<int> coursePath = new List<int> ();
+		foreach (int tmpPath in path) {
+			List<int> tmp = coursePath.addLast (tmpPath);
+			paths = paths.addLast (new DefaultNodePath (tmp));
+			coursePath = tmp;
+		}
+		return paths;
+	}
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultTreeEditor.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,62 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+public class DefaultTreeEditor : TreeEditor {
+	private Traverser traverser;
+	public DefaultTreeEditor(Traverser traverser){
+		this.traverser = traverser;
+	}
+
+	public Either<Error,LoggingNode> edit(TreeNode root,NodePath path, NodeEditor editor){
+		DefaultEvaluator e = new DefaultEvaluator (path);
+		Either<Error, Traversal> either = traverser.traverse (root, e);
+
+		if (either.isA ()) {
+			return DefaultEither<Error, LoggingNode>.newA (either.a ());
+		}
+		Traversal t = either.b ();
+		return clone (t, editor);
+	}
+
+	private Either<Error, LoggingNode> clone(Traversal t, NodeEditor editor){
+		List<Direction<TreeNode>> path = new List<Direction<TreeNode>> ();
+
+		//while(a.MoveNext()) {
+		//	Debug.Log ("value = " + a.Current);
+		//}
+
+		foreach (Direction<TreeNode> direction in t) {
+			path = path.addLast (direction);
+		}
+
+		Direction<TreeNode> targetDirection = path.headList ();
+		TreeNode target = targetDirection.getTarget ();
+		Either<Error, LoggingNode> either = editor.edit (target);
+		if (either.isA ()) {
+			return DefaultEither<Error, LoggingNode>.newA (either.a ());
+		}
+
+		LoggingNode newWrap = either.b ();
+
+		int pos = targetDirection.getPosition ();
+		TreeNode child = newWrap.getWrap ();
+
+		foreach (Direction<TreeNode> parentDirection in path.deleteHead()) {
+			TreeNodeChildren chs = parentDirection.getTarget ().getChildren ();
+
+			Either<Error, TreeNode> ret = chs.replaceNode (pos, child);
+			if (ret.isA ()) {
+				return DefaultEither<Error, LoggingNode>.newA (ret.a ());
+			}
+
+			child = ret.b ();
+			pos = parentDirection.getPosition ();
+		}
+
+		TreeNode newRoot = child;
+		LoggingNode logNode = editor.wrap (newRoot, newWrap.getOperationLog ());
+		return DefaultEither<Error, LoggingNode>.newB (logNode);
+
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+
+public interface TreeNode {
+	TreeNodeChildren getChildren();
+
+	TreeNodeAttributes getAttributes();
+
+	TreeNode createNewNode();
+
+	Either<Error, TreeNode> appendRootNode();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeAttributes.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,8 @@
+using System.Collections.Generic;
+using UnityEngine;
+public interface TreeNodeAttributes : Attributes {
+	Either<Error,TreeNode> delete(string key);
+	Either<Error,TreeNode> put(string key, GameObject value);
+	TreeMap<string,GameObject> getAttributesAsRawMap();
+	IEnumerator<string> getKeys();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeChildren.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,8 @@
+
+public interface TreeNodeChildren : Children {
+	Either<Error, TreeNode> addNewChildAt (int pos);
+	Either<Error, TreeNode> deleteChildAt(int pos);
+	Either<Error,TreeNode> addNewChildAt(int pos,TreeNode newChild);
+	Either<Error,TreeNode> replaceNode(int pos,TreeNode replacement);
+	List<TreeNode> getChildrenAsRawList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultOperationLog.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,49 @@
+using System.Collections.Generic;
+using System.Collections;
+using System;
+
+
+public class DefaultOperationLog : OperationLog {
+	private List<NodeOperation> log;
+
+
+	IEnumerator IEnumerable.GetEnumerator()
+	{
+		// call the generic version of the method
+		return this.GetEnumerator();
+	}
+
+	public IEnumerator<NodeOperation> GetEnumerator()
+	{
+		return iterator ();
+	}
+
+	private static List<NodeOperation> EMPTY = new List<NodeOperation>();
+
+	public DefaultOperationLog()
+		: this(EMPTY)
+	{
+	}
+
+	private DefaultOperationLog(List<NodeOperation> _log)
+	{
+		log = _log;
+	}
+
+	public IEnumerator<NodeOperation> iterator()
+	{
+		return log.iterator();
+	}
+
+
+	public OperationLog add(NodeOperation _op)
+	{
+		return new DefaultOperationLog(log.addLast(_op));
+	}
+		
+	public int length()
+	{
+		return log.length();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultTreeOperationLog.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,68 @@
+using UnityEngine;
+using System.Collections.Generic;
+using System;
+using System.Collections;
+using System.Linq;
+
+
+public class DefaultTreeOperationLog : TreeOperationLog {
+	private IEnumerable<TreeOperation> list;
+	private int size;
+
+	TreeOperation[] _array;
+	TreeOperation Count;
+
+	IEnumerator IEnumerable.GetEnumerator()
+	{
+		// call the generic version of the method
+		return this.GetEnumerator();
+	}
+
+	public IEnumerator<TreeOperation> GetEnumerator()
+	{
+		for (int i = 0; i < Convert.ToInt32(Count); i++)
+			yield return _array[i];
+	}
+
+
+	public DefaultTreeOperationLog()
+	{
+		list = new List<TreeOperation>();
+		size = 0;
+	}
+
+	public DefaultTreeOperationLog(IEnumerable<TreeOperation> _list,int _size)
+	{
+		list = _list;
+		size = _size;
+	}
+
+//	public IEnumerator<TreeOperation> iterator()
+//	{
+//		return list.itetator();
+//	}
+
+	public TreeOperationLog add(NodePath _p, NodeOperation _op)
+	{
+		TreeOperation op = new DefaultTreeOperation(_p,_op);
+		List<TreeOperation> newList =  new List<TreeOperation>(op);
+		// java write Iterables.concat ここは間違い
+		IEnumerable<TreeOperation> concat = list.Union<TreeOperation>(newList);
+
+		return new DefaultTreeOperationLog(concat,size + 1);
+	}
+
+	public TreeOperationLog append(TreeOperationLog _log)
+	{
+		int argumentLogSize = _log.length();
+		// java write Iterables.concat
+		IEnumerable<TreeOperation> concat = list.Union<TreeOperation>(_log);
+
+		return new DefaultTreeOperationLog(concat,argumentLogSize + size);
+	}
+
+
+	public int length(){
+		return size;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingAttributes.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,48 @@
+using UnityEngine;
+
+public class LoggingAttributes {
+
+	private TreeNode wrap;
+	private OperationLog log;
+
+	public LoggingAttributes(TreeNode _wrap,OperationLog _log)
+	{
+		wrap = _wrap;
+		log = _log;
+	}	
+
+	public GameObject get(string _key)
+	{
+		TreeNodeAttributes attributes = wrap.getAttributes();
+		return attributes.get(_key);
+	}
+
+	private Either<Error,LoggingNode> edit(NodeOperation _op)
+	{
+		Either<Error,TreeNode> either = _op.invoke(wrap);
+		if(either.isA()){
+			Debug.Log ("faild put");
+			return DefaultEither<Error,LoggingNode>.newA(either.a());
+		}
+
+		TreeNode newNode = either.b();
+		OperationLog newLog = log.add(_op); 
+		LoggingNode newLogNode = new LoggingNode(newNode,newLog);
+
+		return DefaultEither<Error,LoggingNode>.newB(newLogNode);
+	}
+
+	public Either<Error,LoggingNode> delete(string _key)
+	{
+
+		DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key);
+		return edit(deleteAttribute);
+	}
+
+	public Either<Error,LoggingNode> put(string _key, GameObject _value)
+	{
+		PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value);
+		return edit(putAttribute);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingChildren.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,59 @@
+using System.Collections;
+using UnityEngine;
+
+public class LoggingChildren {
+	private TreeNode wrap;
+	private OperationLog log;
+
+	public LoggingChildren(TreeNode _wrap,OperationLog _log)
+	{
+		wrap = _wrap;
+		log = _log;
+	}
+
+	public int size()
+	{
+		Children children = wrap.getChildren();
+		return children.size();
+	}
+
+	public Either<Error,LoggingNode> edit(NodeOperation _op)
+	{
+		Either<Error,TreeNode> either = _op.invoke(wrap);
+		if(either.isA()){
+			return DefaultEither<Error,LoggingNode>.newA(either.a());
+		}
+
+		TreeNode newWrap = either.b();
+		OperationLog newLog = log.add(_op);
+		LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog);
+		return DefaultEither<Error,LoggingNode>.newB(newLoggingNode);
+	}
+
+	public Either<Error,LoggingNode> addNewChildAt(int _pos)
+	{
+		Debug.Log ("in addNewChild");
+		NodeOperation addNewChildAt = new AppendChildAtOperation(_pos);
+		return edit(addNewChildAt);
+	}
+
+	public Either<Error,LoggingNode> deleteChildAt(int _pos)
+	{
+		NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos);
+		return edit(deleteChildAt);
+	}
+
+	public Either<Error,LoggingNode> at(int _pos)
+	{
+		Children children = wrap.getChildren();
+		Either<Error,TreeNode> either = children.at(_pos);
+		if(either.isA()){
+			return DefaultEither<Error,LoggingNode>.newA(either.a());
+		}
+
+		TreeNode node = either.b();
+		LoggingNode logNode = new LoggingNode(node);
+		return DefaultEither<Error,LoggingNode>.newB(logNode);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,58 @@
+using UnityEngine;
+using System.Collections;
+
+public class LoggingNode {
+	private TreeNode wrap;
+	private OperationLog log;
+
+	public LoggingNode(TreeNode _wrap)
+		: this(_wrap,new DefaultOperationLog())
+	{
+	}
+
+	public LoggingNode(TreeNode _wrap,OperationLog _log)
+	{
+		wrap = _wrap;
+		log = _log;
+	}
+
+	public LoggingAttributes getAttributes()
+	{
+		return new LoggingAttributes(wrap,log);
+	}
+
+	public LoggingChildren getChildren()
+	{
+		Debug.Log ("in gtChildren");
+		return new LoggingChildren(wrap,log);
+	}
+
+
+	public OperationLog getOperationLog()
+	{
+		return log;
+	}
+
+	public Either<Error, LoggingNode> replaceNewRootNode() {
+		NodeOperation replaceRootNode = new ReplaceRootNodeOperation();
+		return edit(replaceRootNode);
+	}
+
+	public Either<Error, LoggingNode> edit(NodeOperation op){
+		Either<Error,TreeNode> either = op.invoke(wrap);
+		if(either.isA()){
+			return DefaultEither<Error, LoggingNode>.newA(either.a());
+		}
+
+		TreeNode newWrap = either.b();
+		OperationLog newLog = log.add(op);
+		LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog);
+		return DefaultEither<Error, LoggingNode>.newB(newLoggingNode);
+	}
+
+	public TreeNode getWrap()
+	{
+		return wrap;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/OperationLog.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,6 @@
+using System.Collections.Generic;
+
+public interface OperationLog : IEnumerable<NodeOperation> {
+	OperationLog add (NodeOperation _op);
+	int length();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/TreeOperationLog.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,6 @@
+using System.Collections.Generic;
+public interface TreeOperationLog : IEnumerable<TreeOperation> {
+	TreeOperationLog add (NodePath _p, NodeOperation _op);
+	TreeOperationLog append (TreeOperationLog _log);
+	int length();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/index/ParentIndex.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,50 @@
+
+public class ParentIndex {
+	
+
+	private TreeMap<TreeNode, TreeNode> parentIndex;
+
+	public ParentIndex() {
+		parentIndex = new TreeMap<TreeNode, TreeNode>();
+	}
+
+	public bool isEmpty(){
+		return parentIndex.isEmpty();
+	}
+
+	public TreeNode get(TreeNode child) {
+		// return parentIndex.get(child).get();
+		return null;
+	}
+
+	public ParentIndex set(TreeNode parent ,TreeNode child) {
+		parentIndex = parentIndex.put(child, parent);
+		return this;
+	}
+
+	public ParentIndex delete(TreeNode child) {
+		parentIndex = parentIndex.delete(child);
+		return this;
+	}
+
+	public ParentIndex deleteAllChildren(TreeNode parentNode) {
+		//TreeNodeChildren children = parentNode.getChildren();
+		// Iterator<TreeNode> childrenIterator = children.iterator();
+//		for (; childrenIterator.hasNext();) {
+//			TreeNode child = childrenIterator.next();
+//			parentIndex = parentIndex.delete(child);
+//		}
+		return this;
+	}
+
+	public ParentIndex addAllChildren(TreeNode parentNode) {
+		//TreeNodeChildren children = parentNode.getChildren();
+		// Iterator<TreeNode> childrenIterator = children.iterator();
+//		for (; childrenIterator.hasNext();) {
+//			TreeNode child = childrenIterator.next();
+//			parentIndex = parentIndex.put(child, parentNode);
+//		}
+		return this;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/AppendChildAtOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,38 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class AppendChildAtOperation : NodeOperation {
+	private int pos;
+
+	public AppendChildAtOperation(int _pos)
+	{
+		pos = _pos;
+	}
+
+	public Command getCommand()
+	{
+		return Command.APPEND_CHILD;
+	}
+
+	public Either<Error,TreeNode> invoke(TreeNode _target)
+	{
+		return _target.getChildren().addNewChildAt(pos);
+	}
+
+	public int getPosition()
+	{
+		return pos;
+	}
+
+	public string getKey()
+	{
+		return null;
+	}
+
+	public GameObject getValue()
+	{
+		return null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DefaultTreeOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,21 @@
+using UnityEngine;
+using System.Collections;
+
+public class DefaultTreeOperation : TreeOperation {
+	private NodePath path;
+	private NodeOperation operation;
+
+	public DefaultTreeOperation(NodePath _path, NodeOperation _operation){
+		path = _path;
+		operation = _operation;
+	}
+
+	public NodePath getNodePath() {
+		return path;
+	}
+
+	public NodeOperation getNodeOperation() {
+		return operation;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteAttributeOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,32 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class DeleteAttributeOperation : NodeOperation {
+	private string key;
+
+	public DeleteAttributeOperation(string _key) {
+		key = _key;
+	}
+
+	public Command getCommand() {
+		return Command.DELETE_ATTRIBUTE;
+	}
+
+	public Either<Error, TreeNode> invoke(TreeNode _target) {
+		return _target.getAttributes ().delete (key);
+	}
+
+	public int getPosition() {
+		return -1;
+	}
+
+	public string getKey() {
+		return key;
+	}
+
+	public GameObject getValue() {
+		return null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteChildAtOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,39 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class DeleteChildAtOperation : NodeOperation {
+	private int pos;
+
+	public DeleteChildAtOperation(int _pos)
+	{
+		pos = _pos;
+	}
+
+
+	public Command getCommand()
+	{
+		return Command.DELETE_CHILD;
+	}
+
+	public Either<Error, TreeNode> invoke(TreeNode _target) 
+	{
+		return _target.getChildren().deleteChildAt(pos);
+	}
+
+	public int getPosition()
+	{
+		return pos;
+	}
+
+	public string getKey()
+	{
+		return null;
+	}
+
+	public GameObject getValue()
+	{
+		return null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/NodeOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,8 @@
+using UnityEngine;
+public interface NodeOperation {
+	Command getCommand();
+	Either<Error,TreeNode> invoke (TreeNode _target);
+	int getPosition();
+	string getKey();
+	GameObject getValue();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/PutAttributeOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,37 @@
+using UnityEngine;
+
+public class PutAttributeOperation : NodeOperation {
+	private string key;
+	private GameObject value;
+
+	public PutAttributeOperation(string _key,GameObject _value)
+	{
+		key = _key;
+		value = _value;
+	}
+
+
+	public Command getCommand()
+	{
+		return Command.PUT_ATTRIBUTE;
+	}
+
+	public Either<Error,TreeNode> invoke(TreeNode _target)
+	{
+		return _target.getAttributes().put(key,value);
+	}
+	public int getPosition()
+	{
+		return -1;
+	}
+
+	public string getKey()
+	{
+		return key;
+	}
+
+	public GameObject getValue()
+	{
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/ReplaceRootNodeOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,27 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class ReplaceRootNodeOperation : NodeOperation {
+	
+	public Command getCommand() {
+		return Command.REPLACE_ROOT;
+	}
+
+	public Either<Error, TreeNode> invoke(TreeNode target) {
+		return  target.appendRootNode();
+	}
+
+	public int getPosition() {
+		return -1;
+	}
+
+	public string getKey() {
+		return null;
+	}
+
+	public GameObject getValue() {
+		return null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/TreeOperation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+public interface TreeOperation  {
+	NodePath getNodePath();
+	NodeOperation getNodeOperation();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/AppendChildAt.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,33 @@
+using UnityEngine;
+using System.Collections;
+
+public class AppendChildAt : NodeEditor {
+	private int pos;
+
+	public AppendChildAt(int _pos){
+		pos = _pos;
+	}
+
+	public Either<Error, LoggingNode> _edit(LoggingNode _e) 
+	{
+		Either<Error,LoggingNode> either = _e.getChildren().addNewChildAt(pos);
+		if(either.isA()){
+			// error
+			return either;
+		}
+		return DefaultEither<Error, LoggingNode>.newB(either.b());
+	}
+
+	public Either<Error, LoggingNode> edit(TreeNode _e) {
+		LoggingNode logNode = wrap(_e);
+		return _edit(logNode);
+	}
+
+	public LoggingNode wrap(TreeNode node) {
+		return new LoggingNode(node);
+	}
+
+	public LoggingNode wrap(TreeNode node, OperationLog op) {
+		return new LoggingNode(node, op);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteAttribute.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,34 @@
+using UnityEngine;
+using System.Collections;
+
+public class DeleteAttribute : NodeEditor {
+	private string key;
+
+	public DeleteAttribute(string _key)
+	{
+		key = _key;
+	}
+
+	public Either<Error,LoggingNode> _edit(LoggingNode logNode)
+	{
+		Either<Error,LoggingNode> either = logNode.getAttributes().delete(key);
+		if(either.isA()){
+			// error
+			return either;
+		}
+		return DefaultEither<Error, LoggingNode>.newB(either.b());
+	}
+
+	public Either<Error, LoggingNode> edit(TreeNode _e) {
+		LoggingNode logNode = wrap(_e);
+		return _edit(logNode);
+	}
+
+	public LoggingNode wrap(TreeNode node) {
+		return new LoggingNode(node);
+	}
+
+	public LoggingNode wrap(TreeNode node, OperationLog op) {
+		return new LoggingNode(node, op);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteChildAt.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,34 @@
+using UnityEngine;
+using System.Collections;
+
+public class DeleteChildAt : NodeEditor {
+	private int pos;
+
+	public DeleteChildAt(int _pos)
+	{
+		pos = _pos;
+	}
+
+	public Either<Error, LoggingNode> _edit(LoggingNode logNode)
+	{
+		Either<Error,LoggingNode> either = logNode.getChildren().deleteChildAt(pos);
+		if(either.isA()){
+			// error
+			return either;
+		}
+		return DefaultEither<Error, LoggingNode>.newB(either.b());
+	}
+
+	public Either<Error, LoggingNode> edit(TreeNode _e) {
+		LoggingNode logNode = wrap(_e);
+		return _edit(logNode);
+	}
+
+	public LoggingNode wrap(TreeNode node) {
+		return new LoggingNode(node);
+	}
+
+	public LoggingNode wrap(TreeNode node, OperationLog op) {
+		return new LoggingNode(node, op);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/NodeEditor.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+public interface NodeEditor {
+	Either<Error, LoggingNode> edit (TreeNode _e);
+	LoggingNode wrap (TreeNode node, OperationLog op);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/PutAttribute.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,36 @@
+using UnityEngine;
+using System.Collections;
+
+public class PutAttribute : NodeEditor {
+	private string key;
+	private GameObject value;
+
+	public PutAttribute(string _key,GameObject _value)
+	{
+		key = _key;
+		value = _value;
+	}
+
+	public Either<Error,LoggingNode> _edit(LoggingNode _e)
+	{
+		Either<Error,LoggingNode> either = _e.getAttributes().put(key,value);
+		if(either.isA()){
+			// error
+			return either;
+		}
+		return DefaultEither<Error, LoggingNode>.newB(either.b());
+	}
+
+	public Either<Error, LoggingNode> edit(TreeNode _e) {
+		LoggingNode logNode = wrap(_e);
+		return _edit(logNode);
+	}
+
+	public LoggingNode wrap(TreeNode node) {
+		return new LoggingNode(node);
+	}
+
+	public LoggingNode wrap(TreeNode node, OperationLog op) {
+		return new LoggingNode(node, op);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/replaceRootNodeAt.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,29 @@
+using System.Collections;
+
+public class replaceRootNodeAt : NodeEditor {
+	public Either<Error, LoggingNode> _edit(LoggingNode _e)
+	{
+		Either<Error,LoggingNode> either = _e.replaceNewRootNode();
+		if(either.isA()){
+			// error
+			return either;
+		}
+		return DefaultEither<Error, LoggingNode>.newB(either.b());
+	}
+
+	public Either<Error, LoggingNode> edit(TreeNode _e) {
+		LoggingNode logNode = wrap(_e);
+		return _edit(logNode);
+	}
+
+	public LoggingNode wrap(TreeNode node) {
+		return new LoggingNode(node);
+	}
+
+
+	public LoggingNode wrap(TreeNode node, OperationLog op) {
+		return new LoggingNode(node, op);
+	}
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/AtomicReference.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,30 @@
+using System.Threading;
+
+public class AtomicReference <T> where T : class {
+	private T value;
+	private bool isSet = false;
+
+	public AtomicReference() { }
+
+	public AtomicReference(T value) {
+		this.value = value;
+	}
+
+	public T CompareAndSet(T newValue) {
+		// change to compere exchange.
+		isSet = true;
+		return Interlocked.CompareExchange(ref value, value, newValue);
+	}
+
+	public bool OptimicSet(T oldvalue) {
+		T old;
+		do {
+			old = value;
+		} while (old != CompareAndSet (value));
+		return isSet;
+	}
+
+	public T Get() {
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultJungleTreeEditor.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,111 @@
+using UnityEngine;
+using System.Collections.Generic;
+
+public class DefaultJungleTreeEditor : JungleTreeEditor {
+
+	private TransactionManager txManager;
+	private TreeNode root;
+	private TreeEditor editor;
+	private TreeOperationLog log;
+
+	public DefaultJungleTreeEditor(TreeNode _root,TransactionManager _txManager,TreeEditor _editor)
+		: this(_root, _txManager, _editor, new DefaultTreeOperationLog())
+	{
+	}
+
+
+
+	public DefaultJungleTreeEditor(TreeNode newNode,TransactionManager _txManager,TreeEditor _editor,TreeOperationLog _log)
+	{
+		this.root = newNode;
+		this.txManager = _txManager;
+		this.editor = _editor;
+		this.log = _log;
+	}
+
+
+
+	private Either<Error,JungleTreeEditor> _edit(NodePath _path,NodeEditor _e)
+	{
+		Either<Error, LoggingNode> either = editor.edit (root, _path, _e);
+		if (either.isA ()) {
+			return DefaultEither<Error, JungleTreeEditor>.newA (either.a ());
+		}
+
+		LoggingNode newLogging = either.b ();
+		OperationLog newLog = newLogging.getOperationLog ();
+		TreeNode newNode = newLogging.getWrap ();
+
+		// 無名クラスが書けてない
+		IterableConverter<TreeOperation,NodeOperation>.Converter<TreeOperation, NodeOperation> converter = new InnerConverter (_path);
+			
+
+		IEnumerable<TreeOperation> iterable = new IterableConverter<TreeOperation, NodeOperation> (newLog, converter);
+		DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog (iterable, newLog.length ());
+		TreeOperationLog newTreeOpLog = log.append (treeOperationLog);
+
+		JungleTreeEditor newEditor = new DefaultJungleTreeEditor (newNode, txManager, editor, newTreeOpLog);
+		return DefaultEither<Error, JungleTreeEditor>.newB (newEditor);
+
+	}
+
+
+	public Either<Error, JungleTreeEditor> replaceNewRootNode() {
+		replaceRootNodeAt appendChildAt = new replaceRootNodeAt ();
+		return _edit (new DefaultNodePath(), appendChildAt);
+	}
+
+	public Either<Error, JungleTreeEditor> addNewChildAt(NodePath _path, int _pos) {
+		AppendChildAt appendChildAt = new AppendChildAt (_pos);
+		return _edit (_path, appendChildAt);
+	}
+
+	public Either<Error,JungleTreeEditor> deleteChildAt(NodePath _path, int _pos) {
+		DeleteChildAt deleteChildAt = new DeleteChildAt(_pos);
+		return _edit(_path,deleteChildAt);
+	}
+
+	public Either<Error, JungleTreeEditor> putAttribute(NodePath _path, string _key, GameObject _value) {
+		PutAttribute putAttribute = new PutAttribute (_key, _value);
+		return _edit (_path, putAttribute);
+	}
+
+	public Either<Error, JungleTreeEditor> deleteAttribute(NodePath _path, string _key) {
+		DeleteAttribute deleteAttribute = new DeleteAttribute (_key);
+		return _edit (_path, deleteAttribute);
+	}
+
+	public Either<Error,JungleTreeEditor> edit(NodePath _path,NodeEditor _editor) {
+		return _edit(_path,_editor);
+	}
+
+	public Either<Error,JungleTreeEditor> success() {
+		Either<Error,TransactionManager> either = txManager.commit(root,log);
+		if(either.isA()){
+			return DefaultEither<Error, JungleTreeEditor>.newA(either.a());
+		}
+
+		TransactionManager newTxManager = either.b();
+		JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(root,newTxManager,editor);
+
+		return DefaultEither<Error, JungleTreeEditor>.newB(newTreeEditor);
+	}
+		
+	public Either<Error, JungleTreeEditor> flushSuccess() {
+		return success();
+	}
+
+	public class InnerConverter : IterableConverter<TreeOperation,NodeOperation>.Converter<TreeOperation,NodeOperation>{
+
+		NodePath path;
+
+		public InnerConverter(NodePath _path) {
+			path = _path;
+		}
+
+
+		public TreeOperation conv(NodeOperation _b){
+			return new DefaultTreeOperation(path,_b);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTransactionManager.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,98 @@
+using System.Collections.Generic;
+using System.Collections;
+using System;
+
+public class DefaultTransactionManager : TransactionManager {
+	private AtomicReference<TreeContext> repository;
+	private TreeContext tip;
+	private ChangeListWriter writer;
+	private string uuid;
+
+
+	public DefaultTransactionManager(ChangeListWriter _writer, TreeContext _tip, AtomicReference<TreeContext> _repository, string _uuid) {
+		repository = _repository;
+		tip = _tip;
+		writer = _writer;
+		uuid = _uuid;
+	}
+
+	public Either<Error, TransactionManager> commit(TreeNode newRoot, TreeOperationLog _log) {
+		long currentRevision = tip.getRevision();
+		long nextRevision = currentRevision + 1;
+
+		string _treeName = tip.getTreeName();
+		// 通信時に必要?
+		ChangeList list = new InnerChangeList(_log, _treeName, uuid);
+
+		InterfaceTraverser traverser = new InterfaceTraverser(newRoot, true);
+		// traverser.createIndex();
+		TreeContext newTreeContext = new DefaultTreeContext(newRoot , tip, list, uuid, _treeName, nextRevision,traverser);
+		// compare and setがどういう役割か?Javaで
+		if  (repository.OptimicSet(newTreeContext)) { // CompareAndSetが成功した場合に処理を実行
+			TransactionManager txManager = new DefaultTransactionManager(writer, newTreeContext, repository, uuid);
+			return DefaultEither<Error, TransactionManager>.newB(txManager);
+		}
+
+		return DefaultEither<Error, TransactionManager>.newA((Error) new DefaultError());
+	}
+
+	public Either<Error, TransactionManager> firstcommit(TreeNode _newRoot, TreeOperationLog _log) {
+		return commit(_newRoot,_log);
+	}
+
+	public string getUUID() {
+		return uuid;
+	}
+
+	public long getRevision() {
+		return tip.getRevision();
+	}
+
+	public class InnerChangeList : ChangeList{
+
+		TreeOperationLog log;
+		string treeName;
+		string uuid;
+
+		TreeOperation[] _array;
+		TreeOperation Count;
+
+
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+			// call the generic version of the method
+			return this.GetEnumerator();
+		}
+
+		public IEnumerator<TreeOperation> GetEnumerator()
+		{
+			for (int i = 0; i < Convert.ToInt32(Count); i++)
+				yield return _array[i];
+		}
+
+
+		public InnerChangeList(TreeOperationLog _log, string _treeName, string _uuid){
+			this.log = _log;
+			this.treeName = _treeName;
+			this.uuid = _uuid;
+		}
+
+		public IEnumerator<TreeOperation> iterator() {
+			return log.GetEnumerator();
+		}
+
+		public string getTreeName() {
+			return treeName;
+		}
+
+		public TreeOperationLog getLog() {
+			return log;
+		}
+
+		public string uuids() {
+			return uuid;
+		}
+	}
+
+}
+	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeContext.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,63 @@
+using UnityEngine;
+using System.Collections.Generic;
+
+// override need? 
+
+public class DefaultTreeContext : TreeContext {
+	private TreeNode root;
+	private TreeContext previous;
+	private ChangeList changeList;
+	private string uuid;
+	private string treeName;
+	private long revision;
+	private InterfaceTraverser traverser;
+
+	public DefaultTreeContext(TreeNode _node, TreeContext _prev, ChangeList _log, string _uuid, string _treeName, long _revision, InterfaceTraverser traverser) {
+		this.root = _node;
+		this.previous = _prev;
+		this.changeList = _log;
+		this.uuid = _uuid;
+		this.treeName = _treeName;
+		this.revision = _revision;
+		this.traverser = traverser;
+	}
+
+	public TreeNode getRoot() {
+		return root;
+	}
+
+	public TreeContext prev() {
+		return previous;
+	}
+
+	public ChangeList getChangeList() {
+		return changeList;
+	}
+		
+	public string getUuid() {
+		return uuid;
+	}
+
+	public string getTreeName() {
+		return treeName;
+	}
+
+	public long getRevision() {
+		return revision;
+	}
+
+	public IEnumerable<TreeOperation> getOperations() {
+		return changeList;
+	}
+
+	public TreeMap<string, TreeMap<string, List<TreeNode>>> getIndex() {
+		return traverser.getIndex ();
+	}
+
+	// don't write parent Index.
+
+	public InterfaceTraverser getTraverser() {
+		return traverser;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,46 @@
+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();
+	}
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeAttribute.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,72 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using System;
+using System.Text;
+
+public class DefaultTreeNodeAttribute : TreeNodeAttributes {
+	public List<TreeNode> children;
+	public TreeMap<string,GameObject> attrs;
+
+	public DefaultTreeNodeAttribute(List<TreeNode> _children, TreeMap<string,GameObject> _attrs){
+		children = _children; // null?
+		attrs = _attrs;
+	}
+
+	public TreeMap<string, GameObject> getAttributesAsRawMap(){
+		return attrs;
+	}
+
+	public Either<Error, TreeNode> delete(string _key) {
+		if (_key == null) {
+			return DefaultEither<Error,TreeNode>.newA (NodeEditorError.NULL_VALUE_NOT_ALLOWED);
+		}
+
+		if (null == attrs.getRoot()) {
+			return DefaultEither<Error,TreeNode>.newA(NodeEditorError.DELETE_KEY_NOT_FOUND);
+		}
+
+		TreeMap<string, GameObject> newMap = attrs.delete(_key);
+		TreeNode newNode = new DefaultTreeNode(children, newMap);
+		return DefaultEither<Error,TreeNode>.newB(newNode);
+	}
+
+	public Either<Error, TreeNode> put(string _key, GameObject _value){
+		if (_key == null || _value == null) {
+			return DefaultEither<Error, TreeNode>.newA (NodeEditorError.NULL_VALUE_NOT_ALLOWED);
+		}
+
+		TreeMap<string, GameObject> newMap = attrs.put (_key, _value);
+
+		TreeNode newNode = new DefaultTreeNode (children, newMap);
+
+		return DefaultEither<Error, TreeNode>.newB (newNode);
+	}
+
+	public GameObject get(string _key) {
+		if (_key == null) {
+			return null;
+		}
+		GameObject op = attrs.get(_key); //null
+		if (op != null) {
+			return op.gameObject;
+		}
+		return null;
+	}
+
+	public string getString(string key , Encoding enc) {
+		char[] attribute = key.ToCharArray();
+		if (attribute != null){
+			return new string(attribute);
+		}
+		return null;
+	}
+
+	public string getString(string key) {
+		return null;
+	}
+	public IEnumerator<string> getKeys(){
+		return attrs.keys ();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeChildren.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,93 @@
+using UnityEngine;
+using System.Collections;
+
+public class DefaultTreeNodeChildren : TreeNodeChildren {
+
+	public List<TreeNode> children;
+	public TreeMap<string, GameObject> attrs;
+
+	public DefaultTreeNodeChildren(List<TreeNode> _children, TreeMap<string, GameObject> _attrs){
+		children = _children;
+		attrs = _attrs;
+	}
+
+	private bool boundaryCheck(int _pos) {
+		int size = children.length ();
+		if (size < _pos) {
+			return false;
+		}
+		return true;
+	}
+
+	public List<TreeNode> getChildrenAsRawList() {
+		return children;
+	}
+
+	public Either<Error, TreeNode> addNewChildAt(int _pos) {
+		if (!boundaryCheck(_pos) || _pos < 0) {
+			return DefaultEither<Error, TreeNode>.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS);
+		}
+
+		List<TreeNode> newChildren = children.add(_pos, new DefaultTreeNode());
+		TreeNode newNode = new DefaultTreeNode(newChildren, attrs);
+		return DefaultEither<Error, TreeNode>.newB(newNode);
+	}
+
+
+	public Either<Error, TreeNode> deleteChildAt(int _pos) {
+		if (!boundaryCheck(_pos) || _pos < 0 || size() == 0) {
+			return DefaultEither<Error, TreeNode>.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS);
+		}
+
+		List<TreeNode> newChildren = children.delete(_pos);
+		TreeNode newNode = new DefaultTreeNode(newChildren, attrs);
+
+		return DefaultEither<Error, TreeNode>.newB(newNode);
+	}
+
+
+	public int size() {
+		return children.length();
+	}
+
+
+//	public Iterator<TreeNode> iterator() {
+//		return children.iterator();
+//	}
+
+
+	public Either<Error, TreeNode> replaceNode(int _pos, TreeNode _replacement) {
+		int size = children.length();
+		if (!(0 <= _pos && _pos < size)) {
+			return DefaultEither<Error, TreeNode>.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS);
+		}
+		TreeNode replacement = _replacement;
+
+		List<TreeNode> newChildren = children.replace(_pos, replacement);
+		TreeNode node = new DefaultTreeNode(newChildren, attrs);
+		return DefaultEither<Error, TreeNode>.newB(node);
+	}
+
+
+	public Either<Error, TreeNode> at(int _pos) {
+		if (children.length() < _pos + 1) {
+			return DefaultEither<Error, TreeNode>.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS);
+		}
+
+		TreeNode Node = children.index(_pos);
+
+		return DefaultEither<Error, TreeNode>.newB(Node);
+	}
+
+
+	public Either<Error, TreeNode> addNewChildAt(int _pos, TreeNode _newChild) {
+		if (!boundaryCheck(_pos) || _pos < 0) {
+			return DefaultEither<Error, TreeNode>.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS);
+		}
+		List<TreeNode> newChildren = children.add(_pos, _newChild);
+		TreeNode newNode = new DefaultTreeNode(newChildren, attrs);
+
+		return DefaultEither<Error, TreeNode>.newB(newNode);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/TransactionManager.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,8 @@
+
+
+public interface TransactionManager  {
+	Either<Error, TransactionManager> commit(TreeNode _newRoot, TreeOperationLog _log);
+	Either<Error, TransactionManager> firstcommit(TreeNode _newRoot, TreeOperationLog _log);
+	string getUUID();
+	long getRevision();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,21 @@
+using UnityEngine;
+using System.Collections;
+
+public class DefaultEvaluation : Evaluation {
+	private Result result;
+	private Evaluator evaluator;
+
+	public DefaultEvaluation(Result _result, Evaluator _evaluator) {
+		result = _result;
+		evaluator = _evaluator;
+	}
+
+	public Result results() {
+		return result;
+	}
+
+	public Evaluator evaluators() {
+		return evaluator;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluator.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,35 @@
+using UnityEngine;
+using System.Collections;
+
+public class DefaultEvaluator : Evaluator {
+	private NodePath path;
+
+	public DefaultEvaluator(NodePath _path) {
+		path = _path;
+	}
+
+	public Evaluation evaluate(TreeNode _current, int _pos){
+		Pair<int, NodePath> pop = path.pop ();
+		int head = pop.lefts ();
+
+		if (path.size () == 1) {
+			if (head == _pos) {
+				return new DefaultEvaluation (Result.GOAL, null);
+			}
+		}
+
+		DefaultEvaluator nextEvaluator;
+		Result result;
+		if (head == _pos) {
+			result = Result.ACCEPT;
+			nextEvaluator = new DefaultEvaluator (pop.rights ());
+		} else {
+			result = Result.CONTINUE;
+			nextEvaluator = null;
+		}
+
+		return new DefaultEvaluation (result, nextEvaluator);
+
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultTraverser.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,162 @@
+using System.Collections.Generic;
+using System.Collections;
+using UnityEngine;
+using System;
+// yet write.
+public class DefaultTraverser : Traverser  {
+
+
+	public Either<Error, Traversal> traverse(TreeNode _root, Evaluator _evaluator) {
+		// 無名クラスを書いてない
+		Children warper = new InnerChildren(_root, _evaluator);
+
+		Children chs = warper;
+		Either<Error, List<Direction<TreeNode>>> ret = _traverse(chs, _evaluator, -1);
+
+		if (ret.isA ()) {
+			return DefaultEither<Error, Traversal>.newA (ret.a ());
+		}
+
+		List<Direction<TreeNode>> list = ret.b ();
+		IEnumerator<Direction<TreeNode>> iterable = list.iterator ();
+		TreeNode destination = ret.b ().headList ().getTarget ();
+
+		Traversal traversal = new InnerTraversal (iterable, destination);
+
+		return DefaultEither<Error, Traversal>.newB (traversal);
+
+	}
+
+
+	private Either<Error, List<Direction<TreeNode>>> _traverse(Children _chs, Evaluator _evaluator, int _pos) {
+		int pos = _pos;
+		TreeNode ch;
+		for (int i = 0; i < _chs.size(); i++) {
+			Either<Error,TreeNode> either = _chs.at(i);
+			if (either.isA ()) {
+				break;
+			}
+
+			ch = either.b();
+			Evaluation e = _evaluator.evaluate (ch, pos);
+			Result r = e.results();
+
+			if (r == Result.ACCEPT) {
+				return _accept (ch, pos, e.evaluators ());
+			}
+
+			if (r == Result.GOAL) {
+				return DefaultEither<Error,List<Direction<TreeNode>>>.newB(_goal(ch, pos));
+			}
+
+			if (r == Result.BREAK) {
+				break;
+			}
+
+			if (r == Result.CONTINUE) {
+				pos++;
+				continue;
+			}
+
+			return DefaultEither<Error, List<Direction<TreeNode>>>.newA (TraverserError.UNDEFINED_OPERATOR);
+		}
+		return DefaultEither<Error, List<Direction<TreeNode>>>.newA (TraverserError.PATH_NOT_FOUND);
+	}
+
+
+	private List<Direction<TreeNode>> _goal( TreeNode _current, int _pos) {
+		Direction<TreeNode> d  = new InnerDirection<TreeNode> (_pos, _current);
+
+		List<Direction<TreeNode>> list = new List<Direction<TreeNode>> ();
+		List<Direction<TreeNode>> newList = list.addLast (d);
+
+		return newList;
+	}
+
+
+	private Either<Error, List<Direction<TreeNode>>> _accept(TreeNode _current, int _pos,Evaluator _evaluator)
+	{
+		Children chs = _current.getChildren ();
+		Either<Error, List<Direction<TreeNode>>> either = _traverse (chs, _evaluator, 0);
+		if (either.isA ()) {
+			return either;
+		}
+		List<Direction<TreeNode>> list = either.b ();
+		Direction<TreeNode> d = new InnerDirection<TreeNode> (_pos, _current);
+
+		List<Direction<TreeNode>> newList = list.addLast (d);
+		return DefaultEither<Error,List<Direction<TreeNode>>>.newB (newList);
+	}
+
+	public class InnerTraversal : Traversal{
+		IEnumerator<Direction<TreeNode>> iterable;
+		TreeNode destination;
+
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+			return this.GetEnumerator();
+		}
+
+		public IEnumerator<Direction<TreeNode>> GetEnumerator()
+		{
+			return iterable;
+		}
+
+
+		public InnerTraversal(IEnumerator<Direction<TreeNode>> _iterable, TreeNode _distination){
+			this.iterable = _iterable;
+			this.destination = _distination;
+		}
+
+	
+		public TreeNode destinations() {
+			return destination;
+		}
+
+	}
+
+	public class InnerChildren : Children{
+		TreeNode root;
+		Evaluator evaluator;
+
+		public InnerChildren(TreeNode _root, Evaluator _evaluator){
+			this.root = _root;
+			this.evaluator = _evaluator;
+		}
+
+		public IEnumerator<TreeNode> iterator() {
+			List<TreeNode> list = new List<TreeNode> ();
+			return list.addLast (root).iterator ();
+		}
+
+		public int size() {
+			return 1;
+		}
+
+		public Either<Error, TreeNode> at(int _pos) {
+			if (_pos != 0) {
+				return DefaultEither<Error, TreeNode>.newA (NodeEditorError.INDEX_OUT_OF_BOUNDS);
+			}
+			return DefaultEither<Error, TreeNode>.newB (root);
+		}
+	}
+
+	public class InnerDirection<TreeNode> : Direction<TreeNode>{
+		int pos;
+		TreeNode current;
+
+		public InnerDirection(int _pos, TreeNode _current) {
+			this.pos = _pos;
+			this.current = _current;
+		}
+
+		public int getPosition() {
+			return pos;
+		}
+
+		public TreeNode getTarget(){
+			return current;
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Direction.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,6 @@
+
+
+public interface Direction<T> {
+	int getPosition();
+	T getTarget();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluation.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,6 @@
+
+
+public interface Evaluation {
+	Result results();
+	Evaluator evaluators();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluator.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,4 @@
+
+public interface Evaluator {
+	Evaluation evaluate (TreeNode _current, int _pos);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/InterfaceTraverser.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,39 @@
+
+public class InterfaceTraverser {
+	TreeNode root;
+	TreeMap<string, TreeMap<string, List<TreeNode>>> indexList;
+	ParentIndex parentIndex;
+	bool parentUpdateFlag;
+	bool useIndex;
+
+	public InterfaceTraverser(TreeNode root, bool indexFlag) 
+		: this (root, new TreeMap<string, TreeMap<string, List<TreeNode>>> (), new ParentIndex (), indexFlag)
+	{
+	}
+
+	public InterfaceTraverser(TreeNode root, TreeMap<string, TreeMap<string, List<TreeNode>>> index,
+		ParentIndex parentIndex, bool useIndex) {
+		this.root = root;
+		this.indexList = index;
+		this.parentIndex = parentIndex;
+		if (parentIndex.isEmpty())
+			parentUpdateFlag = true;
+		else
+			parentUpdateFlag = false;
+		this.useIndex = useIndex;
+	}
+
+	public TreeMap<string, TreeMap<string, List<TreeNode>>> getIndex() {
+		return indexList;
+	}
+
+	public void commit() {
+		parentUpdateFlag = false;
+	}
+
+	public ParentIndex getParentIndex() {
+		return parentIndex;
+	}
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traversal.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+using System.Collections.Generic;
+
+public interface Traversal : IEnumerable<Direction<TreeNode>> {
+	TreeNode destinations();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traverser.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,6 @@
+
+// jungle/
+public interface Traverser {
+	
+	Either<Error, Traversal> traverse ( TreeNode _root, Evaluator _evaluator);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/TraverserError.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+public class TraverserError {
+	public static Error UNDEFINED_OPERATOR = new DefaultError();
+	public static Error PATH_NOT_FOUND = new DefaultError();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultEither.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,44 @@
+
+public class DefaultEither<A,B> : Either<A,B> {
+	private A theA;
+	private B theB;
+
+	private DefaultEither(A _theA, B _theB){
+		theA = _theA;
+		theB = _theB;
+	}
+
+	public static DefaultEither<A,B> newA(A _theA)
+	{
+		return new DefaultEither<A,B>(_theA,default(B));
+	}
+
+	public static DefaultEither<A,B> newB(B _theB)
+	{
+		return new DefaultEither<A,B>(default(A),_theB);
+	}
+		
+	public A a()
+	{
+		return theA;
+	}
+
+
+	public bool isA()
+	{
+		return theA != null;
+	}
+
+
+	public B b()
+	{
+		return theB;
+	}
+
+
+	public bool isB()
+	{
+		return theB != null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultError.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,5 @@
+
+
+public class DefaultError : Error {
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Either.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,7 @@
+
+public interface Either<A,B> {	
+	A a();
+	bool isA();
+	B b();
+	bool isB();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Error.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,4 @@
+
+public interface Error {
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/GetOldTreeError.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,4 @@
+
+public class GetOldTreeError : Error {
+	public static Error OLD_TREE_NOT_FOUND = new DefaultError();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/IterableConverter.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,80 @@
+using UnityEngine;
+using System.Collections.Generic;
+using System.Collections;
+using System;
+
+public class IterableConverter<A,B> : IEnumerable<A> {
+	private IEnumerable<B> iterable;
+	private Converter<A,B> converter;
+
+
+	IEnumerator IEnumerable.GetEnumerator()
+	{
+		// call the generic version of the method
+		return this.GetEnumerator();
+	}
+
+	public IEnumerator<A> GetEnumerator()
+	{
+		return iterator ();
+	}
+
+	public IterableConverter(IEnumerable<B> _iterable,Converter<A,B> _converter)
+	{
+		iterable = _iterable;
+		converter = _converter;
+	}
+
+	public IEnumerator<A> iterator()
+	{
+		return new IteratorConverter<A,B>(iterable.GetEnumerator(),converter);
+	}
+
+	private class IteratorConverter<A,B> : IEnumerator<A>
+	{
+		public List<A> appLines { get; set; }
+		private int position;
+
+		private IEnumerator<B> iterator;
+		private Converter<A,B> converter;
+
+		public IteratorConverter(IEnumerator<B> _iterator,Converter<A,B> _converter)
+		{
+			iterator = _iterator;
+			converter = _converter;
+		}
+
+		public bool MoveNext()
+		{
+			return iterator.MoveNext();
+		}
+
+		public A Current
+		{
+			get{
+				return converter.conv (iterator.Current);
+			}
+		}
+
+		public void Reset()
+		{
+			// ホントはremove?
+			iterator.Reset();
+		}
+
+		object IEnumerator.Current
+		{
+			get { return (appLines.ToArray())[position] ; }
+		}
+
+		public void Dispose() {
+			((IEnumerator<A>)this.appLines).Dispose ();
+		}
+	}
+
+
+	public interface Converter<A,B>{
+		A conv (B _b);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Pair.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,21 @@
+using UnityEngine;
+using System.Collections;
+
+public class Pair<L, R> {
+	private L left;
+	private R right;
+
+	public Pair(L _left,R _right){
+		left = _left;
+		right = _right;
+	}
+	// not same name , add s.
+	public L lefts(){
+		return left;
+	}
+
+	public R rights(){
+		return right;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/DefaultJungleTreeTest.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,43 @@
+using UnityEngine;
+using System.Collections;
+using System;
+//using System.Diagnostics;
+
+public class DefaultJungleTreeTest : MonoBehaviour { // apiの仕様的にこんな感じ
+
+	public Jungle instance() {
+		Jungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser()));  // hogeというtreeを作る
+		return j;
+	}
+
+	public static string key = "KEY";
+	public GameObject value;
+
+	void Start() {
+		Jungle j = instance ();
+		JungleTree tree = j.createNewTree ("tree"); // hogeの中にtreeという名前の木を作る
+
+		JungleTreeEditor editor1 = tree.getTreeEditor (); // editor
+
+		DefaultNodePath path = new DefaultNodePath ();
+		// NodePath path;
+
+		Either<Error, JungleTreeEditor> either = editor1.putAttribute (path, key, value);
+		if (either.isA ()) { // 失敗した場合のコード
+			Debug.Log ("失敗しました。");
+		}
+		editor1 = either.b (); //成功した場合
+		editor1.success (); // 大本にあるTreeにここで変更を加える
+
+		TreeNode node = tree.getRootNode ();
+		Debug.Log (node);
+		Debug.Log (node.getAttributes ().getKeys ());
+		GameObject v = node.getAttributes ().get (key);
+		Debug.Log (v);
+		
+	}
+
+	void Update() {
+
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/listAdd.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,31 @@
+using UnityEngine;
+using System.Collections;
+using System;
+
+public class listAdd : MonoBehaviour {
+	
+	void Start () {
+		List<int> list = new List<int> ();
+		List<int> list2 = new List<int> ();
+		Debug.Log ("------ここまで001-------");
+		for (int count = 0; count < 10; count++) {
+			list = list.addLast (count);
+			list2 = list2.add (count, count);
+		}
+		Debug.Log ("------ここまで002-------");
+
+		for (int count = 0; count < 10; count++) {
+			int num = list.index (count);
+			int num2 = list2.index (count);
+			Equals (num, count);
+			Equals (num2, count);
+		}
+		Debug.Log ("------ここまで003-------");
+		List<int> newList = list.add (5, 50);
+		int nums = list.index (5);
+		int nums2 = newList.index (5);
+		Equals (nums, 5);
+		Equals (nums2, 50);
+		Debug.Log("------------- end -------------");
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapDelete.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,33 @@
+using UnityEngine;
+using System.Collections;
+
+public class TreeMapDelete : MonoBehaviour {
+
+	// Use this for initialization
+	void Start () {
+		TreeMap<int,int> map = new TreeMap<int, int> ();
+		for (int count = 1; count < 5; count++) {
+			map = map.put (count, count);
+			map.checkDepth ();
+		}
+
+		ArrayList list = new ArrayList ();
+		for (int i = 1; i < 5; i++) {
+			list.Add (i);
+		}
+
+		for (int i = 1; i < 5; i++) {
+			int ran = Random.Range (1, 6);
+			object obj = list [i];
+            list [i] = list [ran];
+			list [ran] = obj;
+		}
+
+		foreach(int num in list){
+			Debug.Log (num);
+			map = map.delete(num);
+			map.checkDepth();
+		}
+		Debug.Log ("end");
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapTest.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,33 @@
+using UnityEngine;
+using System.Collections;
+
+public class TreeMapTest : MonoBehaviour {
+	private int ReturnNumber;
+	private bool checknull = true;
+	// Update is called once per frame
+	public void Start () {
+		TreeMap<int, int> map = new TreeMap<int,int>();
+		Debug.Log (map);
+		for (int count = 5; count > -10; count--) {
+			map = map.put(count, count);
+			map.checkDepth();
+			Debug.Log("------------------------------------------");
+
+
+		}
+
+//		for (int count = 100; count > -10; count--) {
+//			ReturnNumber = map.get(count);
+//			if(ReturnNumber == null){
+//				checknull = false;
+//			}
+//			//this points null check.
+//			  if (checknull){
+//				Debug.Log(map.get());
+//		}
+
+		Debug.Log ("end");
+	
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/nodeeditor/PutAttributeTest.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,28 @@
+using UnityEngine;
+using System.Collections;
+
+public class PutAttributeTest : MonoBehaviour {
+
+	string key = "hoge";
+	public GameObject value;
+
+	// Use this for initialization
+	void Start () {
+		TreeNode node = new DefaultTreeNode ();
+		PutAttribute op = new PutAttribute (key, value);
+
+		Either<Error, LoggingNode> either = op.edit (node);
+		if (either.isA ()) {
+			Debug.Log ("Error発生");
+		}
+		LoggingNode newnode = either.b ();
+		Debug.Log (newnode);
+		GameObject ret = newnode.getAttributes ().get (key);
+		Debug.Log ("insertしたものは" + ret);
+	}
+	
+	// Update is called once per frame
+	void Update () {
+	
+	}
+}