changeset 12:b71d9ea6bd8e

Add Network Operation Class. this codes can not test yet.
author Kazuma
date Sun, 23 Oct 2016 12:25:57 +0900
parents 220433691c2e
children 4c8932dad7b2
files src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/Command.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildAtOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLog.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTree.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/deleteTest.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/listAdd.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/replaceTest.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapDelete.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core/nodeeditor/PutAttributeTest.cs
diffstat 17 files changed, 771 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/Command.cs	Sun Oct 23 07:47:02 2016 +0900
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/Command.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -3,5 +3,6 @@
 	DELETE_CHILD,
 	PUT_ATTRIBUTE,
 	DELETE_ATTRIBUTE,
-	REPLACE_ROOT
+	REPLACE_ROOT,
+	DEFAULT
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildAtOperation.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,35 @@
+using UnityEngine;
+using System.Collections;
+
+public class NetworkAppendChildAtOperation : NodeOperation {
+
+	private int Position;
+
+	public NetworkAppendChildAtOperation() {
+		this.Position = -2;
+	}
+
+	public NetworkAppendChildAtOperation(int pos){
+		this.Position = pos;
+	}
+
+	public Command getCommand() {
+		return Command.APPEND_CHILD;
+	}
+
+	public Either<Error, TreeNode> invoke (TreeNode target) {
+		return target.getChildren().addNewChildAt(this.Position);
+	}
+
+	public int getPosition () {
+		return this.Position;
+	}
+
+	public string getKey() {
+		return null;
+	}
+
+	public byte[] getValue() {
+		return null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperation.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,35 @@
+using UnityEngine;
+using System.Collections;
+
+public class NetworkDeleteAttributeOperation : NodeOperation {
+
+	private string Key;
+
+	public NetworkDeleteAttributeOperation() {
+		this.Key = null;
+	}
+
+	public NetworkDeleteAttributeOperation(string key){
+		this.Key = key;
+	}
+
+	public Command getCommand() {
+		return Command.DELETE_ATTRIBUTE;
+	}
+
+	public Either<Error, TreeNode> invoke (TreeNode target) {
+		return target.getAttributes().delete(this.Key);
+	}
+
+	public int getPosition () {
+		return -1;
+	}
+
+	public string getKey() {
+		return this.Key;
+	}
+
+	public byte[] getValue() {
+		return null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperation.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,35 @@
+using UnityEngine;
+using System.Collections;
+
+public class NetworkDeleteChildAtOperation : NodeOperation {
+
+	private int Position;
+
+	public NetworkDeleteChildAtOperation () {
+
+	}
+
+	public NetworkDeleteChildAtOperation(int pos) {
+		this.Position = pos;
+	}
+
+	public Command getCommand () {
+		return Command.DELETE_CHILD;
+	}
+
+	public Either<Error, TreeNode> invoke (TreeNode target) {
+		return target.getChildren().deleteChildAt(this.Position);
+	}
+
+	public int getPosition () {
+		return this.Position;
+	}
+
+	public string getKey() {
+		return null;
+	}
+
+	public byte[] getValue () {
+		return null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperation.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,95 @@
+using UnityEngine;
+using System.Collections;
+
+public class NetworkNodeOperation : NodeOperation {
+
+	public int Position;
+	public string Key;
+	public byte[] Value;
+	public int commandType;
+
+	// when switch use static readonly so, use const. 
+	// when A code compalie, case const use is fast.
+	// case readonly use is bit slow.
+	public const int NUM_PUT_ATTRIBUTE = 1;
+	public const int NUM_APPEND_CHILD = 2;
+	public const int NUM_DELETE_CHILD = 3;
+	public const int NUM_DELETE_ATTRIBUTE = 4;
+
+	public NetworkNodeOperation () {
+		this.Position = -2;
+		this.Key = null;
+		this.Value = null;
+		this.commandType = 0;
+	}
+
+	public NetworkNodeOperation(NodeOperation op) {
+		this.Position = op.getPosition();
+		this.Key = op.getKey();
+		this.Value = op.getValue();
+		this.commandType = getCommandType(op.getCommand());
+	}
+
+	public static int getCommandType (Command c) {
+		switch(c) {
+		case Command.PUT_ATTRIBUTE:
+			return NUM_PUT_ATTRIBUTE;
+		case Command.APPEND_CHILD:
+			return NUM_APPEND_CHILD;
+		case Command.DELETE_CHILD:
+			return NUM_DELETE_CHILD;
+		case Command.DELETE_ATTRIBUTE:
+			return NUM_DELETE_ATTRIBUTE;
+		default:
+			break;
+		}
+		return 0;
+	}
+
+	public static Command getCommand (int num) {
+		switch(num) {
+		case NUM_PUT_ATTRIBUTE:
+			return Command.PUT_ATTRIBUTE;
+		case NUM_APPEND_CHILD:
+			return Command.APPEND_CHILD;
+		case NUM_DELETE_CHILD:
+			return Command.DELETE_CHILD;
+		case NUM_DELETE_ATTRIBUTE:
+			return Command.DELETE_ATTRIBUTE;
+		default:
+			break;
+		}
+		return Command.DEFAULT;
+	}
+
+	public Command getCommand() {
+		return getCommand(commandType);
+	}
+
+	public int getPosition () {
+		return this.Position;
+	}
+
+	public string getKey () {
+		return this.Key;
+	}
+
+	public byte[] getValue() {
+		return this.Value;
+	}
+
+	public Either<Error, TreeNode> invoke (TreeNode target) {
+		switch(getCommand(commandType)) {
+		case Command.PUT_ATTRIBUTE:
+			return target.getAttributes().put(this.Key, this.Value);
+		case Command.APPEND_CHILD:
+			return target.getChildren().addNewChildAt(this.Position);
+		case Command.DELETE_CHILD:
+			return target.getChildren().deleteChildAt(this.Position);
+		case Command.DELETE_ATTRIBUTE:
+			return target.getAttributes().delete(this.Key);
+		}
+		return null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,87 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+
+public class NetworkNodePath : NodePath {
+	LinkedList<int> Path;
+
+	public NetworkNodePath () {
+		Path = new LinkedList<int>();
+		Path.AddFirst(-1);
+	}
+
+	public NetworkNodePath (NodePath path){
+		Path = new LinkedList<int>();
+		foreach(int p in path) {
+			Path.AddLast(p);
+		}
+	}
+
+	private NetworkNodePath (LinkedList<int> path) {
+		this.Path = path;
+	}
+
+	public IEnumerator<int> iterator () { // iterator error. 
+		yield return this.Path.GetEnumerator().Current;
+	}
+
+	IEnumerator IEnumerable.GetEnumerator()
+	{
+		return this.GetEnumerator();
+	}
+
+	public IEnumerator<int> GetEnumerator()
+	{
+		return iterator ();
+	}
+
+	public NodePath add (int pos) {
+		LinkedList<int> newPath = copyPath();
+		newPath.AddLast(pos);
+		return new NetworkNodePath(newPath);
+	}
+
+	public NodePath addHead(int pos) { // still java code.
+		LinkedList<int> newPath = copyPath();
+		newPath.AddFirst(pos);
+		return new NetworkNodePath(newPath);
+	}
+
+	public Pair<int, NodePath> pop () {
+		LinkedList<int> cPath = copyPath();
+		int e = cPath.First.Value;
+		cPath.RemoveFirst();
+		return new Pair<int, NodePath>(e, new NetworkNodePath(cPath));
+	}
+
+	public int size () {
+		return this.Path.Count;
+	}
+
+
+	public LinkedList<int> copyPath(){
+		LinkedList<int> newPath = new LinkedList<int>();
+		foreach(int i in this.Path) {
+			newPath.AddLast(i);
+		}
+		return newPath;
+	}
+
+	public override string ToString () {
+		return Path.ToString();
+	}
+
+	public NodePath tail() {
+		this.Path.RemoveLast();
+		return new NetworkNodePath(this.Path);
+	}
+
+	public Pair<int, NodePath> last () {
+		int lastValue = this.Path.Last.Value;
+		this.Path.RemoveLast();
+		return new Pair<int, NodePath>(lastValue, new NetworkNodePath(this.Path));
+	}
+
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperation.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,39 @@
+using UnityEngine;
+using System.Collections;
+
+public class NetworkPutAttributeOperation : NodeOperation {
+
+	public string Key;
+	public byte[] Value;
+
+	public NetworkPutAttributeOperation() {
+		this.Key = null;
+		this.Value = null;
+	}
+
+	public NetworkPutAttributeOperation(string key, byte[] value){
+		this.Key = key;
+		this.Value = value;
+	}
+
+	public Command getCommand () {
+		return Command.PUT_ATTRIBUTE;
+	}
+
+	public Either<Error, TreeNode> invoke (TreeNode target) {
+		return target.getAttributes().put(this.Key, this.Value);
+	}
+
+	public string getKey () {
+		return this.Key;
+	}
+
+	public int getPosition () {
+		return -1;
+	}
+
+	public byte[] getValue () {
+		return this.Value;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,54 @@
+using UnityEngine;
+using System.Collections;
+
+public class NetworkTreeOperation : TreeOperation {
+
+	public NetworkNodePath Path;
+	public NetworkNodeOperation Operation;
+
+	public NetworkTreeOperation (TreeOperation tOp) {
+		this.Path = new NetworkNodePath(tOp.getNodePath());
+		this.Operation = new NetworkNodeOperation(tOp.getNodeOperation());
+	}
+
+	public NetworkTreeOperation(NodePath path, NodeOperation op) {
+		this.Path = new NetworkNodePath(path);
+		this.Operation = new NetworkNodeOperation(op);
+	}
+
+	public NetworkTreeOperation(NetworkNodePath path, NodeOperation op) {
+		this.Path = path;
+		this.Operation = new NetworkNodeOperation(op);
+	}
+
+	public NetworkTreeOperation(NodePath path, NetworkNodeOperation op) {
+		this.Path = new NetworkNodePath(path);
+		this.Operation = op;
+	}
+
+	public NetworkTreeOperation(NetworkNodePath path, NetworkNodeOperation op) {
+		this.Path = path;
+		this.Operation = op;
+	}
+
+	public NodePath getNodePath () {
+		return this.Path;
+	}
+
+	public NodeOperation getNodeOperation() {
+		Command c = this.Operation.getCommand();
+		switch(c){
+		case Command.PUT_ATTRIBUTE:
+			return new PutAttributeOperation(Operation.getKey(), Operation.getValue());
+		case Command.APPEND_CHILD:
+			return new AppendChildAtOperation(Operation.getPosition());
+		case Command.DELETE_CHILD:
+			return new DeleteChildAtOperation(Operation.getPosition());
+		case Command.DELETE_ATTRIBUTE:
+			return new DeleteAttributeOperation(Operation.getKey());
+		default:
+			break;
+		}
+		return null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLog.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,110 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using System;
+public class NetworkTreeOperationLog : TreeOperationLog {
+
+	public LinkedList<NetworkTreeOperation> list;
+	public int Size;
+	public string Uuid;
+	public string TreeName;
+	public long TimeStamp;
+
+	public NetworkTreeOperationLog () {
+		list = new LinkedList<NetworkTreeOperation>();
+		this.Size = 0;
+		this.TreeName = "";
+		this.TimeStamp = DateTime.Now.ToBinary();
+	}
+
+	public NetworkTreeOperationLog(string uid, string name, IEnumerable<TreeOperation> _list)  {
+		this.list = new LinkedList<NetworkTreeOperation>();
+		this.Uuid = uid;
+		this.Size = 0;
+		this.TreeName = name;
+		this.TimeStamp = DateTime.Now.ToBinary();
+		foreach(var op in _list) {
+			NetworkTreeOperation nOp = new NetworkTreeOperation(op);
+			this.list.AddLast(nOp);
+		}
+		this.Size = this.list.Count;
+	}
+
+	public NetworkTreeOperationLog (string uid, string name, IEnumerable<TreeOperation> _list, long timestamp) {
+		this.Uuid = uid;
+		this.TreeName = name;
+		this.list = new LinkedList<NetworkTreeOperation>();
+		this.Size = 0;
+		this.TimeStamp = timestamp;
+		foreach(var op in _list) {
+			NetworkTreeOperation nOp = new NetworkTreeOperation(op);
+			this.list.AddLast(nOp);
+		}
+		this.Size = this.list.Count;
+	}
+
+	public NetworkTreeOperationLog (IEnumerable<TreeOperation> _list) {
+		this.Uuid = "";
+		this.TreeName = "";
+		this.list = new LinkedList<NetworkTreeOperation>();
+		this.Size = 0;
+		this.TimeStamp = DateTime.Now.ToBinary();
+		foreach(var op in _list) {
+			NetworkTreeOperation nOp = new NetworkTreeOperation(op);
+			this.list.AddLast(nOp);
+		}
+		this.Size = this.list.Count;
+	}
+
+	public IEnumerator<TreeOperation> iterator () {
+		yield return this.list.GetEnumerator().Current;
+	}
+
+	IEnumerator IEnumerable.GetEnumerator()
+	{
+		return this.GetEnumerator();
+	}
+
+	public IEnumerator<TreeOperation> GetEnumerator()
+	{
+		return iterator ();
+	}
+
+
+	public TreeOperationLog add (NodePath path, NodeOperation op) {
+		NetworkTreeOperation nOp = new NetworkTreeOperation(path, op);
+		this.list.AddLast(nOp);
+		this.Size = list.Count;
+		return this;
+	}
+
+	public TreeOperationLog append (TreeOperationLog log) {
+		foreach(TreeOperation o in log) {
+			NetworkTreeOperation op = new NetworkTreeOperation(o);
+			this.list.AddLast(op);
+		}
+		this.Size = list.Count;
+		return this;
+	}
+
+	public int length () {
+		return this.list.Count;
+	}
+
+	public string getUuid() {
+		return Uuid;
+	}
+
+	public string getTreeName () {
+		return TreeName;
+	}
+
+	public long getTimeStamp () {
+		return TimeStamp;
+	}
+
+	public void setTimeStamp (long timestamp) {
+		this.TimeStamp = timestamp;
+	}
+
+}
--- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTree.cs	Sun Oct 23 07:47:02 2016 +0900
+++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTree.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -1,83 +1,79 @@
-using UnityEngine;
-using System.Collections;
-
-public class NetworkDefaultJungleTree : JungleTree {
-
-	private readonly AtomicReference<TreeContext> Repository;
-	private readonly string Uuid;
-	private readonly string TreeName;
-	private readonly ChangeListWriter Writer;
-	private readonly TreeEditor Editor;
-
-	public NetworkDefaultJungleTree(string name, TreeContext tc, string uid, ChangeListWriter writer, TreeEditor edit) {
-		this.TreeName   = name;
-		this.Repository = new AtomicReference<TreeContext>(tc);
-		this.Uuid       = uid;
-		this.Writer     = writer;
-		this.Editor     = edit;
-	}
-
-	public JungleTreeEditor getTreeEditor() {
-		TreeContext tc = Repository.Get();
-		NetworkTransactionManager txManager = new NetworkTransactionManager(this.TreeName, this.Writer, tc, this.Repository, this.Uuid);
-		TreeNode root = tc.getRoot();
-		return new NetworkDefaultJungleTreeEditor(this.TreeName, root, txManager, this.Editor);
-	}
-
-	public JungleTreeEditor getLocalTreeEditor () {
-		TreeContext tc = this.Repository.Get();
-		NetworkTransactionManager txManager = new NetworkTransactionManager(this.TreeName, this.Writer, tc, this.Repository, this.Uuid);
-		TreeNode root = tc.getRoot();
-		return NetworkDefaultJungleTreeEditor.NewLocalTreeEditor(this.TreeName, root, txManager, this.Editor);
-	}
-
-	public TreeNode getRootNode () {
-		TreeContext tc = this.Repository.Get();
-		return tc.getRoot();
-	}
-
-	public long revision () {
-		return 0;
-	}
-
-	public Either<Error, JungleTree> getOldTree (long rev) {
-		TreeContext tc = this.Repository.Get();
-		while(tc.getRevision() != rev) { // If I mistake this code, change this code.
-			tc = tc.prev();
-			if (tc == null) {
-				return DefaultEither<Error, JungleTree>.newA(GetOldTreeError.OLD_TREE_NOT_FOUND);
-			}
-		}
-		string oldTreeUuid = this.Uuid + revision().ToString();
-		JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, this.Writer, this.Editor);
-		return DefaultEither<Error, JungleTree>.newB(oldTree);
-	}
-
-	public TreeMap<string, TreeMap<string, List<TreeNode>>> getIndex () {
-		TreeContext tc = this.Repository.Get();
-		return tc.getIndex();
-	}
-
-//	public InterfaceTraverser getTraverser (bool useIndex) {
-//		TreeMap<string, TreeMap<string, List<TreeNode>>> index = getIndex();
-//	}
-
-	public Either<Error, TreeNode> getNodeOfPath (NodePath path) {
-		TreeNode node = this.Repository.Get().getRoot();
-		foreach(var 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 num) {
-
-	}
-}
+using UnityEngine;
+using System.Collections;
+
+public class NetworkDefaultJungleTree : JungleTree {
+
+	private readonly AtomicReference<TreeContext> Repository;
+	private readonly string Uuid;
+	private readonly string TreeName;
+	private readonly ChangeListWriter Writer;
+	private readonly TreeEditor Editor;
+
+	public NetworkDefaultJungleTree(string name, TreeContext tc, string uid, ChangeListWriter writer, TreeEditor edit) {
+		this.TreeName   = name;
+		this.Repository = new AtomicReference<TreeContext>(tc);
+		this.Uuid       = uid;
+		this.Writer     = writer;
+		this.Editor     = edit;
+	}
+
+	public JungleTreeEditor getTreeEditor() {
+		TreeContext tc = Repository.Get();
+		NetworkTransactionManager txManager = new NetworkTransactionManager(this.TreeName, this.Writer, tc, this.Repository, this.Uuid);
+		TreeNode root = tc.getRoot();
+		return new NetworkDefaultJungleTreeEditor(this.TreeName, root, txManager, this.Editor);
+	}
+
+	public JungleTreeEditor getLocalTreeEditor () {
+		TreeContext tc = this.Repository.Get();
+		NetworkTransactionManager txManager = new NetworkTransactionManager(this.TreeName, this.Writer, tc, this.Repository, this.Uuid);
+		TreeNode root = tc.getRoot();
+		return NetworkDefaultJungleTreeEditor.NewLocalTreeEditor(this.TreeName, root, txManager, this.Editor);
+	}
+
+	public TreeNode getRootNode () {
+		TreeContext tc = this.Repository.Get();
+		return tc.getRoot();
+	}
+
+	public long revision () {
+		return 0;
+	}
+
+	public Either<Error, JungleTree> getOldTree (long rev) {
+		TreeContext tc = this.Repository.Get();
+		while(tc.getRevision() != rev) { // If I mistake this code, change this code.
+			tc = tc.prev();
+			if (tc == null) {
+				return DefaultEither<Error, JungleTree>.newA(GetOldTreeError.OLD_TREE_NOT_FOUND);
+			}
+		}
+		string oldTreeUuid = this.Uuid + revision().ToString();
+		JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, this.Writer, this.Editor);
+		return DefaultEither<Error, JungleTree>.newB(oldTree);
+	}
+
+	public TreeMap<string, TreeMap<string, List<TreeNode>>> getIndex () {
+		TreeContext tc = this.Repository.Get();
+		return tc.getIndex();
+	}
+
+	public Either<Error, TreeNode> getNodeOfPath (NodePath path) {
+		TreeNode node = this.Repository.Get().getRoot();
+		foreach(var 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 num) {
+
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,50 @@
+using UnityEngine;
+using System;
+//using System.Diagnostics;
+
+public class DefaultJungleTreeTest : MonoBehaviour {
+	// apiの仕様的にこんな感じ
+	private readonly int COUNT = 500;
+
+	public string key = "moumou";
+	private byte[] value = BitConverter.GetBytes(10);
+
+	public void Start () {
+		Jungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser()));
+		JungleTree t = j.createNewTree("tree");
+
+		JungleTreeEditor editor1 = t.getTreeEditor();
+
+		DefaultNodePath root = new DefaultNodePath();
+		NodePath path = root.add(0);
+		// NodePath path = root.pop().rights();
+
+		print(path.ToString());
+
+
+		float check_time = Time.realtimeSinceStartup;
+
+		for(int i = 0; i < COUNT; i++) { 
+			Either<Error, JungleTreeEditor> either = editor1.putAttribute(root, i.ToString(), value);
+			if (either.isA()) {
+				Debug.Log("失敗しました。");
+			}
+			editor1 = either.b ();
+
+			Either<Error, JungleTreeEditor> r = editor1.success();
+			if (!r.isA()) {
+				Debug.Log("失敗しました。");
+			}
+			r.b();
+		}
+		check_time = Time.realtimeSinceStartup - check_time;
+		print ("処理時間 : " + check_time);
+
+		TreeNode node = t.getRootNode();
+		for (int i = 0; i < COUNT; i++) {
+			byte[] v = node.getAttributes ().get (i.ToString());
+			print (BitConverter.ToInt32 (v, 0));
+		}
+	}
+
+}
\ 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/junge-main/data/list/deleteTest.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,16 @@
+using UnityEngine;
+using System.Collections;
+
+public class deleteTest : MonoBehaviour {
+
+	void Start () {
+		List<int> list = new List<int>();
+
+		for(int count = 0; count < 10; count++){
+			list = list.addLast(count);
+		}
+		List<int> newList = list.delete(5);
+		Debug.Log(list.getHead().length());
+		Debug.Log (newList.getHead ().length ());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/listAdd.cs	Sun Oct 23 12:25:57 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/junge-main/data/list/replaceTest.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,18 @@
+using UnityEngine;
+
+public class replaceTest : MonoBehaviour {
+
+	// Use this for initialization
+	void Start () {
+		List<int> list = new List<int> ();
+		for (int count = 0; count < 10; count++) {
+			list = list.addLast (count);
+            Debug.Log("list" + list.tail());
+		}
+		List<int> newList = list.replace (5, 15);
+		int attribute = list.index (5);
+		Debug.Log (attribute);
+		attribute = newList.index (5);
+		Debug.Log (attribute);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapDelete.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,26 @@
+using UnityEngine;
+
+public class TreeMapDelete : MonoBehaviour {
+
+	// Use this for initialization
+	void Start () {
+		TreeMap<int,int> map = new TreeMap<int, int> ();
+		for (int count = 1; count < 6; count++) {
+			map = map.put (count, count);
+			map.checkDepth ();
+		}
+
+		// ただ消すための数字をここに入れているだけ
+		List<int> list = new List<int>();
+		for (int count = 1; count < 6; count++) {
+			list = list.addLast (count);
+		}
+
+		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/junge-main/data/treemap/TreeMapTest.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,31 @@
+using UnityEngine;
+using System.Collections;
+
+public class TreeMapTest : MonoBehaviour {
+	private int ReturnNumber;
+	// 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/junge-main/jungle/core/nodeeditor/PutAttributeTest.cs	Sun Oct 23 12:25:57 2016 +0900
@@ -0,0 +1,28 @@
+using UnityEngine;
+using System.Collections;
+
+public class PutAttributeTest : MonoBehaviour {
+
+	string key = "hoge";
+	public byte[] 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);
+		byte[] ret = newnode.getAttributes ().get (key);
+		Debug.Log ("insertしたものは" + ret);
+	}
+	
+	// Update is called once per frame
+	void Update () {
+	
+	}
+}