# HG changeset patch # User Kazuma # Date 1477193157 -32400 # Node ID b71d9ea6bd8ea79afa1f71ccfa08bca6ad82cce9 # Parent 220433691c2e5cd11eda1babe74520521e556935 Add Network Operation Class. this codes can not test yet. diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/Command.cs --- 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 } diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildAtOperation.cs --- /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 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; + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperation.cs --- /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 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; + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperation.cs --- /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 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; + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperation.cs --- /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 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; + } + +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs --- /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 Path; + + public NetworkNodePath () { + Path = new LinkedList(); + Path.AddFirst(-1); + } + + public NetworkNodePath (NodePath path){ + Path = new LinkedList(); + foreach(int p in path) { + Path.AddLast(p); + } + } + + private NetworkNodePath (LinkedList path) { + this.Path = path; + } + + public IEnumerator iterator () { // iterator error. + yield return this.Path.GetEnumerator().Current; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return iterator (); + } + + public NodePath add (int pos) { + LinkedList newPath = copyPath(); + newPath.AddLast(pos); + return new NetworkNodePath(newPath); + } + + public NodePath addHead(int pos) { // still java code. + LinkedList newPath = copyPath(); + newPath.AddFirst(pos); + return new NetworkNodePath(newPath); + } + + public Pair pop () { + LinkedList cPath = copyPath(); + int e = cPath.First.Value; + cPath.RemoveFirst(); + return new Pair(e, new NetworkNodePath(cPath)); + } + + public int size () { + return this.Path.Count; + } + + + public LinkedList copyPath(){ + LinkedList newPath = new LinkedList(); + 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 last () { + int lastValue = this.Path.Last.Value; + this.Path.RemoveLast(); + return new Pair(lastValue, new NetworkNodePath(this.Path)); + } + + + +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperation.cs --- /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 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; + } + +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs --- /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; + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLog.cs --- /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 list; + public int Size; + public string Uuid; + public string TreeName; + public long TimeStamp; + + public NetworkTreeOperationLog () { + list = new LinkedList(); + this.Size = 0; + this.TreeName = ""; + this.TimeStamp = DateTime.Now.ToBinary(); + } + + public NetworkTreeOperationLog(string uid, string name, IEnumerable _list) { + this.list = new LinkedList(); + 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 _list, long timestamp) { + this.Uuid = uid; + this.TreeName = name; + this.list = new LinkedList(); + 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 _list) { + this.Uuid = ""; + this.TreeName = ""; + this.list = new LinkedList(); + 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 iterator () { + yield return this.list.GetEnumerator().Current; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + public IEnumerator 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; + } + +} diff -r 220433691c2e -r b71d9ea6bd8e src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTree.cs --- 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 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(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 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.newA(GetOldTreeError.OLD_TREE_NOT_FOUND); - } - } - string oldTreeUuid = this.Uuid + revision().ToString(); - JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, this.Writer, this.Editor); - return DefaultEither.newB(oldTree); - } - - public TreeMap>> getIndex () { - TreeContext tc = this.Repository.Get(); - return tc.getIndex(); - } - -// public InterfaceTraverser getTraverser (bool useIndex) { -// TreeMap>> index = getIndex(); -// } - - public Either getNodeOfPath (NodePath path) { - TreeNode node = this.Repository.Get().getRoot(); - foreach(var num in path) { - if (num == -1) { - continue; - } - Either either = node.getChildren().at(num); - if (either.isA()){ - return either; - } - node = either.b(); - } - return DefaultEither.newB(node); - } - - public void setBufferSize (int num) { - - } -} +using UnityEngine; +using System.Collections; + +public class NetworkDefaultJungleTree : JungleTree { + + private readonly AtomicReference 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(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 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.newA(GetOldTreeError.OLD_TREE_NOT_FOUND); + } + } + string oldTreeUuid = this.Uuid + revision().ToString(); + JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, this.Writer, this.Editor); + return DefaultEither.newB(oldTree); + } + + public TreeMap>> getIndex () { + TreeContext tc = this.Repository.Get(); + return tc.getIndex(); + } + + public Either getNodeOfPath (NodePath path) { + TreeNode node = this.Repository.Get().getRoot(); + foreach(var num in path) { + if (num == -1) { + continue; + } + Either either = node.getChildren().at(num); + if (either.isA()){ + return either; + } + node = either.b(); + } + return DefaultEither.newB(node); + } + + public void setBufferSize (int num) { + + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs --- /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 either = editor1.putAttribute(root, i.ToString(), value); + if (either.isA()) { + Debug.Log("失敗しました。"); + } + editor1 = either.b (); + + Either 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 diff -r 220433691c2e -r b71d9ea6bd8e src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/deleteTest.cs --- /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 list = new List(); + + for(int count = 0; count < 10; count++){ + list = list.addLast(count); + } + List newList = list.delete(5); + Debug.Log(list.getHead().length()); + Debug.Log (newList.getHead ().length ()); + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/listAdd.cs --- /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 list = new List (); + List list2 = new List (); + 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 newList = list.add (5, 50); + int nums = list.index (5); + int nums2 = newList.index (5); + Equals (nums, 5); + Equals (nums2, 50); + Debug.Log("------------- end -------------"); + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/replaceTest.cs --- /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 list = new List (); + for (int count = 0; count < 10; count++) { + list = list.addLast (count); + Debug.Log("list" + list.tail()); + } + List newList = list.replace (5, 15); + int attribute = list.index (5); + Debug.Log (attribute); + attribute = newList.index (5); + Debug.Log (attribute); + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapDelete.cs --- /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 map = new TreeMap (); + for (int count = 1; count < 6; count++) { + map = map.put (count, count); + map.checkDepth (); + } + + // ただ消すための数字をここに入れているだけ + List list = new List(); + 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"); + } +} diff -r 220433691c2e -r b71d9ea6bd8e src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs --- /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 map = new TreeMap(); + 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"); + + } +} + diff -r 220433691c2e -r b71d9ea6bd8e src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core/nodeeditor/PutAttributeTest.cs --- /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 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 () { + + } +}