# HG changeset patch # User Kazuma # Date 1478445325 -32400 # Node ID f99f39ac5be83e1178d1441c75f2951b869ed53d # Parent e07d8f2416309c7f6316209892b455ae7256e542 Liq File. diff -r e07d8f241630 -r f99f39ac5be8 .hgignore --- a/.hgignore Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -.meta -.unity -.DS_Store diff -r e07d8f241630 -r f99f39ac5be8 src.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6b794ae322075482facd9dfc4488bfd5 +folderAsset: yes +timeCreated: 1478444950 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 67d2a4ab8fd30466f9fa1b0c46cfbabd +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0937d204b0e094944809807389d19608 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e6f4b3c7bb232460598d6a11e9cd83b7 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 656119783c5434471a699a9e9b034665 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungle.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungle.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System; -using UnityEngine; - -public class DefaultJungle : Jungle { - private Journal journal; - private TreeMap 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 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 TreeMap (); - this.uuid = uuid; - this.editor = editor; - } - - public JungleTree getTreeByName(string name) { - - JungleTree jungle_tree = trees.get(name); - if (jungle_tree != null) { - return jungle_tree; - } else { - Debug.Log ("そのTreeは無いようですね。"); - return null; - } - } - - public JungleTree createNewTree(string name) { - ChangeList list = new InnerChangeList(uuid,name); - 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); - if (newTree != null) { - trees = trees.put (name, newTree); - } else { - Debug.Log ("こんばんは、nullです。"); - } - return newTree; - } - - public class InnerChangeList : ChangeList { - - string uuid; - string name; - - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - // construct - public InnerChangeList(string _uuid, string _name) { - this.uuid = _uuid; - this.name = _name; - } - - public IEnumerator iterator() { - List nil = new List(); - 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 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungle.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungle.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: de9a3121a9713488d8f5c91a2f3b1178 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungleTree.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungleTree.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ - - - -public class DefaultJungleTree : JungleTree { - - private AtomicReference repository; - private string uuid; - private ChangeListWriter writer; - private TreeEditor treeEditor; - - - public DefaultJungleTree(TreeContext tc, string uuid, ChangeListWriter writer, TreeEditor editor) { - this.repository = new AtomicReference(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>> getIndex() { - TreeContext tc = repository.Get(); - return tc.getIndex(); - } - - public long revision() { - TreeContext tc = repository.Get(); // 確かにnull どこから来てる? repositoryのインスタンスを生成してないからかも - return tc.getRevision(); - } - - public Either getOldTree(long revision) { - TreeContext tc = repository.Get(); - - for (; tc.getRevision() != revision; ) { - tc = tc.prev(); - if (tc == null) - return DefaultEither.newA(GetOldTreeError.OLD_TREE_NOT_FOUND); - } - - - string oldTreeUuid = uuid + revision; - JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, writer, treeEditor); - return DefaultEither.newB(oldTree); - } - - public Either getNodeOfPath(NodePath path) { //eitherはどちらのインターフェースをつかうか、みたいな - TreeNode node = repository.Get().getRoot(); - foreach (int 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 _bufferSize) { - // not use - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungleTree.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/DefaultJungleTree.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7c332a53d5a594ac09c0e79838e88dd9 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/Jungle.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/Jungle.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface Jungle { - JungleTree getTreeByName (string name); - JungleTree createNewTree (string name); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/Jungle.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/Jungle.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c6bff85e8d90b4aef802b715fa869033 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTree.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTree.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ - -public interface JungleTree { - - JungleTreeEditor getTreeEditor(); - - JungleTreeEditor getLocalTreeEditor(); - - TreeNode getRootNode(); - - long revision(); - - Either getOldTree(long revision); - - TreeMap>> getIndex(); - - // InterfaceTraverser getTraverser(bool useIndex); - - Either getNodeOfPath(NodePath path); - - void setBufferSize(int _bufferSize); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTree.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTree.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7b79d7bb24c334a7b8944b7f3543bceb +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - -public interface JungleTreeEditor { - Either addNewChildAt(NodePath path,int pos); - Either deleteChildAt(NodePath path,int pos); - Either putAttribute(NodePath path,string key, byte[] value); - Either deleteAttribute(NodePath path,string key); - Either replaceNewRootNode(); - Either edit(NodePath path,NodeEditor editor); - Either success(); - Either flushSuccess(); - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTreeEditor.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/JungleTreeEditor.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d9bff7d78a2a745ec9c9628182599297 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c5f97185db8b1422da710e620238d2ee +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Attributes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Attributes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -using UnityEngine; -public interface Attributes{ - byte[] get (string key); - string getString (string key); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Attributes.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Attributes.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ab5cea75f003c448b83e3ed8048bee85 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Children.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Children.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface Children { - Either at (int pos); - int size(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Children.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/core/Children.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a8f48f5f334c24c15bcbf64a998f32bb +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 01e319b63d0cd46cca76d048685816e6 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f42538f7ed7e54ec4a37a04f21312e9b +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/DefaultNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/DefaultNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class DefaultNode : Node { - private readonly T attribute; - private readonly Node next; - //private TailNode tailNode; - - public DefaultNode(T attribute, Node next) { - this.attribute = attribute; - this.next = next; - } - - public Node getNext() { - return next; - } - - public T getAttribute() { - return attribute; - } - - public Node addLast(T attribute) { - Node node = next.addLast(attribute); - return new DefaultNode(this.attribute, node); - } - - public Node add(int currentNum, int num, T attribute) { - if (currentNum == num) { - Node newNode = new DefaultNode(attribute, this.next); - return new DefaultNode(this.attribute, newNode); - } - - Node newNodes = next.add(currentNum + 1, num, attribute); - if (newNodes == null) - return null; - - return new DefaultNode(this.attribute, newNodes); - } - - public Node delete(int currentNum, int deleteNum) { - if (currentNum == deleteNum) { - return new DefaultNode (this.attribute, this.next.getNext ()); - } - - Node newNode = next.delete (currentNum + 1, deleteNum); - if (newNode == null) { - return null; - } - return new DefaultNode(this.attribute, newNode); - } - - public Node replaceNode(int currentNum, int num, T attribute) { - if (currentNum == num) { - return new DefaultNode(attribute, this.getNext()); - } - - Node newNode = next.replaceNode(currentNum + 1, num, attribute); - if (newNode == null) { - return null; - } - return new DefaultNode(this.attribute, newNode); - } - - - public int length() { - return next.length() + 1; - } - - public T getAttribure() - { - throw new NotImplementedException(); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/DefaultNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/DefaultNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6b67d821fc9bd43979c27dfb175ac68e +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/List.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/List.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -public class List : IEnumerable { - private readonly Node head; - - public List() { - this.head = new headNode(); - } - - // T...はC#だとparamsらしい 可変引数型というみたいだ - public List(params T[] attributes) { - List list = new List (); - foreach (T attribute_local in attributes) { - list = list.addLast (attribute_local); - } - this.head = list.getHead (); - } - - private List(Node head) { - this.head = head; - } - - public Node getHead() { - return head; - } - - public List add(int num, T attribute) { - Node newHead = head.add(0, num, attribute); - if (newHead == null) - return this; - return new List(newHead); - } - - public List addLast(T attribute) { - Node newHead = head.addLast(attribute); - return new List(newHead); - } - - - public T index(int num) { - int count = 0; - Node currentNode = head.getNext(); - while (currentNode != null) { - if (count == num) { - return currentNode.getAttribute (); - } - currentNode = currentNode.getNext(); - count++; - } - return default(T); - } - - public IEnumerator iterator() { - Node currentNode = head.getNext(); - while (currentNode != null) { - yield return (T)currentNode.getAttribute(); - currentNode = currentNode.getNext (); - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - - public List delete(int num) { - Node newNode = head.delete(0, num); - if (newNode == null) - return this; - return new List(newNode); - } - - public List replace(int num, T attribute) { - Node newHead = head.replaceNode(0, num, attribute); - if (newHead == null) - return this; - return new List(newHead); - } - - public T tail() { - return index(length() - 1); - } - - // java code head. - public T headList() { - return index(0); - } - - public List deleteLast() { - return delete(head.length() - 1); - } - - public List deleteHead() { - return delete(0); - } - - public int length() { - return head.length(); - } - - public List append(List list) { - IEnumerator iterator = list.iterator(); - List newList = this; - while (iterator.MoveNext()) { - T attribute = iterator.Current; - newList = newList.addLast(attribute); - } - return newList; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/List.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/List.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c6229ba2334234624b81d7937a4836f0 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/Node.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/Node.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - -public interface Node { - - Node getNext(); - - Node add(int currentNum, int num, T attribute); - - Node addLast(T attribute); - - Node delete(int currentNum, int num); - - Node replaceNode(int currentNum, int num, T attribute); - - int length(); - - T getAttribute(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/Node.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/Node.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8fb528b48193c4ef78dd04e42fadbfae +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/TailNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/TailNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class TailNode : Node { - - public Node getNext() { - return null; - } - - public T getAttribute() { - return default(T); - } - - public Node add(int currentNum, int num, T attribute) { - return null; - } - - public Node delete(int currentNum, int num) { - return null; - } - - public Node replaceNode(int currentNum, int num, T attribute) { - return null; - } - - public Node addLast(T attribute) { - return new DefaultNode (attribute, this); - } - - public T getAttribure() - { - throw new NotImplementedException(); - } - - public int length() - { - return 0; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/TailNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/TailNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bb9b8fbb3fe354a428b5c65e6a8d95dc +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/headNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/headNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class headNode : Node{ - private readonly Node next; - - public headNode(){ - this.next = new TailNode (); - } - - public headNode(Node next){ - this.next = next; - } - - public Node getNext(){ - return next; - } - - public T getAttribute(){ - return default(T); - } - - public Node add(int currentNum, int num, T attribute) { - if (num == 0) { - Node newNode = new DefaultNode(attribute, next); - return new headNode(newNode); - } - Node newNodes = next.add(currentNum + 1, num, attribute); - if (newNodes == null) { - return this; - } - return new headNode(newNodes); - } - - public Node addLast(T attribute) { - Node node = next.addLast(attribute); - return new headNode(node); - } - - public Node delete(int currentNum, int deleteNum) { - if (currentNum == deleteNum) { - return new headNode(this.next.getNext()); - } - - Node newNode = next.delete(currentNum + 1, deleteNum); - if (newNode == null) { - return this; - } - return new headNode(newNode); - } - - public Node replaceNode(int currentNum, int num, T attribute) { - Node nextNode = getNext(); - Node newNode = nextNode.replaceNode(currentNum, num, attribute); - if (newNode == null) - return this; - return new headNode(newNode); - } - - public int length() { - return next.length(); - } - - public T getAttribure() - { - throw new NotImplementedException(); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/headNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/list/headNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 69564a913f4204672be99d874a8000f3 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 50a74bf86e2b44c4382e3a8183a38c99 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/BlackNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/BlackNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Collections; -using System; - -public class BlackNode - :TreeMapNode -{ - - public BlackNode (K key, V value, TreeMapNode left, TreeMapNode right) - : base (key, value, left, right) - { - } - - public override rebuildNode deleteNode () - { - EmptyNode emptyNode = new EmptyNode (key); - return new rebuildNode (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 createNode (K key, V value, TreeMapNode left, TreeMapNode right) - { - return new BlackNode (key, value, left, right); - } - - public override TreeMapNode insBalance () - { - Rotate spin = left.checkRotate (Rotate.L); - - if (spin == Rotate.R) { - TreeMapNode leftChild = new BlackNode (left.lefts ().getKey (), left.lefts ().getValue (), left.lefts ().lefts (), left.lefts ().rights ()); - TreeMapNode rightChild = new BlackNode (getKey (), getValue (), left.rights (), right); - return new RedNode (left.getKey (), left.getValue (), leftChild, rightChild); - - } else if (spin == Rotate.LR) { - TreeMapNode leftChild = new BlackNode (left.getKey (), left.getValue (), left.lefts (), left.rights ().lefts ()); - TreeMapNode rightChild = new BlackNode (getKey (), getValue (), left.rights ().rights (), right); - return new RedNode (left.rights ().getKey (), left.rights ().getValue (), leftChild, rightChild); - - } - - spin = right.checkRotate (Rotate.R); - if (spin == Rotate.L) { - TreeMapNode leftChild = new BlackNode (getKey (), getValue (), left, right.lefts ()); - TreeMapNode rightChild = new BlackNode (right.rights ().getKey (), right.rights ().getValue (), right.rights ().lefts (), right.rights ().rights ()); - return new RedNode (right.getKey (), right.getValue (), leftChild, rightChild); - - } else if (spin == Rotate.RL) { - TreeMapNode leftChild = new BlackNode (getKey (), getValue (), left, right.lefts ().lefts ()); - TreeMapNode rightChild = new BlackNode (right.getKey (), right.getValue (), right.lefts ().rights (), right.rights ()); - return new RedNode (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 replaceNode (TreeMapNode parent, Comparer ctr) - { - TreeMapNode 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 (true, newNode); - return new rebuildNode (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 (true, newNode); - return new rebuildNode (false, newNode); - } else {//子ノードが左右にある場合 二回目はここには入らない - //左の部分木の最大の値を持つNodeと自身を置き換える - TreeMapNode cur = this.lefts (); - while (cur.rights ().isNotEmpty ()) { //左の部分期の最大値を持つNodeを取得する - cur = cur.rights (); - } - if (this.lefts ().rights ().isNotEmpty ()) { //左の部分木が右の子を持っているか - rebuildNode leftSubTreeNodeRebuildNode = this.lefts ().deleteSubTreeMaxNode (null, ctr, Rotate.L);//最大値を削除した左の部分木を返す。rootはthisと同じ。 - if (leftSubTreeNodeRebuildNode.rebuilds ()) { - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode (); - TreeMapNode newParent = createNode (cur.getKey (), cur.getValue (), leftSubTreeNode, this.rights ()); - return leftSubTreeNode.deleteBalance (newParent, ctr); - } - //same name onece used. - TreeMapNode leftSubTreeNodes = leftSubTreeNodeRebuildNode.getNode (); - newNode = createNode (cur.getKey (), cur.getValue (), leftSubTreeNodes, this.rights ()); //rootをcurと入れ替えることでNodeの削除は完了する - return new rebuildNode (false, newNode); - } else { - rebuildNode leftSubTreeNodeRebuildNode = this.lefts ().replaceNode (this, ctr);//右の子がいなかった場合、左の子を昇格させるだけで良い。 - if (leftSubTreeNodeRebuildNode.rebuilds ()) { - TreeMapNode node = leftSubTreeNodeRebuildNode.getNode (); - TreeMapNode newParent = createNode (this.lefts ().getKey (), this.lefts ().getValue (), node, this.rights ()); - return node.deleteBalance (newParent, ctr); - } - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode (); - newNode = createNode (this.lefts ().getKey (), this.lefts ().getValue (), leftSubTreeNode, this.rights ()); - return new rebuildNode (false, newNode); - } - } - } -} \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/BlackNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/BlackNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 83ccaa142a9744eb2a42df8ed09df0ab +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyClass.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyClass.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -using System; - -namespace AssemblyCSharpfirstpass -{ - public class NULL - { - public NULL () - { - } - } -} - diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyClass.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyClass.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ba0d8b20d9cf9400b863dab1376f7e74 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -public class EmptyNode : TreeMapNode{ - //static V values; - // Use this for initialization - public EmptyNode () - : base (default(K),default(V)) - { - } - - public EmptyNode (K key) - : base (key,default(V)) - { - } - - public override TreeMapNode lefts(){ - return new EmptyNode(); - } - - public override TreeMapNode rights(){ - return new EmptyNode(); - } - - public override bool isNotEmpty(){ - return false; - } - - public override TreeMapNode createNode(K key,V value,TreeMapNode left, TreeMapNode right){ - return new RedNode (key, value, new EmptyNode (), new EmptyNode ()); - } - - public TreeMapNode put(K k,V value){ - return new RedNode (k, value, new EmptyNode (), new EmptyNode ()); - } - - //I don't know only Comparator method. - public override rebuildNode replaceNode(TreeMapNode parent, Comparer ctr) { // not use method - return new rebuildNode(false, this); - } - - public override rebuildNode deleteNode(){ - return new rebuildNode (false, this); - } - - public override TreeMapNode 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; - } - //c# is there assert?? - //Assert.assertTrue(count <= 2 * minCount); - return minCount; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 36bda4326baa44cb6af5995189b87f06 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/RedNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/RedNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; -using System.Collections.Generic; - -public class RedNode : TreeMapNode{ - - // Use this for initialization - public RedNode (K key, V value, TreeMapNode left, TreeMapNode right) - : base (key, value, left, right) - { - } - - // Update is called once per frame - public override bool isNotEmpty () - { - return true; - } - - public override rebuildNode deleteNode() { - TreeMapNode emptyNode = new EmptyNode(this.getKey()); - return new rebuildNode(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 replaceNode(TreeMapNode parent, Comparer ctr) { - TreeMapNode 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(false, newNode); - } else if (!this.lefts().isNotEmpty() && this.rights().isNotEmpty()) { //右の部分木を昇格させる - newNode = rights().createNode(rights().getKey(), rights().getValue(), rights().lefts(), rights().rights()); - return new rebuildNode(false, newNode); - } else {//子ノードが左右にある場合 - //左の部分木の最大の値を持つNodeと自身を置き換える - TreeMapNode cur = this.lefts(); - - while (cur.rights().isNotEmpty()) { - cur = cur.rights(); - } - if (this.lefts().rights().isNotEmpty()) { - rebuildNode leftSubTreeNodeRebuildNode = this.lefts().deleteSubTreeMaxNode(null, ctr, Rotate.L); - if (leftSubTreeNodeRebuildNode.rebuilds()) { - TreeMapNode node = leftSubTreeNodeRebuildNode.getNode(); - TreeMapNode newParent = createNode(cur.getKey(), cur.getValue(), node, this.rights()); - return node.deleteBalance(newParent, ctr); - } - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode(); - newNode = createNode(cur.getKey(), cur.getValue(), leftSubTreeNode, this.rights()); - return new rebuildNode(false, newNode); - } else { - rebuildNode leftSubTreeNodeRebuildNode = this.lefts().replaceNode(this, ctr); - if (leftSubTreeNodeRebuildNode.rebuilds()) { - TreeMapNode node = leftSubTreeNodeRebuildNode.getNode(); - TreeMapNode newParent = createNode(this.lefts().getKey(), this.lefts().getValue(), node, this.rights()); - return node.deleteBalance(newParent, ctr); - } - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode(); - newNode = createNode(cur.getKey(), cur.getValue(), leftSubTreeNode, this.rights()); - return new rebuildNode(false, newNode); - } - - } - } - - public override bool isRed() { - return true; - } - - public override TreeMapNode createNode(K key, V value, TreeMapNode left, TreeMapNode right) { - return new RedNode(key, value, left, right); - } - - public override TreeMapNode 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; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/RedNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/RedNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fa96232a7b5d44253971b0bb2d28e7fb +timeCreated: 1478444958 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/Rotate.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/Rotate.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -using UnityEngine; -using System.Collections; - -public enum Rotate{ - R,L,RL,LR,N -} - diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/Rotate.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/Rotate.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c67ac1e4e4eff4c9abda3fe218ec1015 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMap.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMap.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -public class TreeMap { - TreeMapNode root; - Comparer comparator; - - - public TreeMap(IComparer icompere) { - this.root = new EmptyNode (); - } - - public TreeMap() { - this.root = new EmptyNode (); - this.comparator = Comparer.Default; - } - - public TreeMap(TreeMapNode root) { - this.root = root; - } - - public TreeMap(TreeMapNode root, Comparer comparator) { - this.root = root; - this.comparator = comparator; - } - - public TreeMapNode getRoot() { - return root; - } - - public V get(K key) { - return root.get(key, this.comparator); - } - - public TreeMap put(K key, V value) { - if(isEmpty()) { - TreeMapNode newRoot = new BlackNode (key, value, new EmptyNode (), new EmptyNode ()); - return new TreeMap (newRoot, this.comparator); - } - - TreeMapNode newEntry = root.put (key, value, this.comparator); - TreeMapNode newRoots = new BlackNode (newEntry.getKey (), newEntry.getValue (), newEntry.lefts (), newEntry.rights ()); - return new TreeMap (newRoots, this.comparator); - } - - public bool isEmpty() { - return !root.isNotEmpty (); - } - - public TreeMap delete(K key) { - if (key.Equals(default(K))) { - return this; - } - rebuildNode rootRebuildNode = root.delete (key, null, this.comparator, Rotate.N); - if (!rootRebuildNode.notEmpty ()) { - return this; - } - TreeMapNode roots = rootRebuildNode.getNode (); - if (!root.isNotEmpty ()) { - return new TreeMap (new EmptyNode (), this.comparator); - } - TreeMapNode newRoot = new BlackNode (roots.getKey (), roots.getValue (), roots.lefts (), roots.rights ()); - return new TreeMap (newRoot, this.comparator); - } - // like to iterator and IEmurator. - public IEnumerator keys() { - return new iterators (); - } - - - public void checkDepth() { - root.checkDepth (0, 0); - Debug.Log ("-----------------------------------"); - } - - public class iterators : IEnumerator { - Stack> nodeStack = new Stack>(); - TreeMapNode currentNode = new TreeMap().getRoot(); - public List 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; } - } - - public void Dispose() { - ((IEnumerator)this.appLines).Dispose (); - } - - public void Reset() { - ((IEnumerator)this.appLines).Reset(); - } - - } -} - - diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMap.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMap.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 14196b1514bb6416cb105508dc2f85d3 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMapNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMapNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,332 +0,0 @@ -using System.Collections; -using System; -using UnityEngine; -using System.Collections.Generic; - - -public abstract class TreeMapNode -{ - - protected K key = default(K); - protected V value = default(V); - - public TreeMapNode right; - public TreeMapNode left; - - - // Use this for initialization - public TreeMapNode (K key, V value) - { - this.key = key; - this.value = value; - } - - public TreeMapNode (K key, V value, TreeMapNode left, TreeMapNode right) - { - this.key = key; - this.value = value; - this.right = right; - this.left = left; - } - - public virtual TreeMapNode lefts () - { - return left; - } - - - public int compare(K compareKey, Comparer ctr) { - return ctr.Compare (compareKey, this.getKey ()); - } - - public V get (K key, Comparer ctr){ - TreeMapNode cur = this; - while (cur.isNotEmpty ()) { // getでEmpty nodeを返している ? compareでKeyが0になっている - int result = cur.compare (key, ctr); - if (result > 0) { - cur = cur.rights (); - } else if (result < 0) { - cur = cur.lefts (); - } else if (result == 0) { - if (cur != null) { - return cur.getValue (); - } - } - } - return default(V); - } - - - - public virtual TreeMapNode rights () { - return right; - } - - public K getKey () { - return key; - } - - public V getValue () { - return value; - } - - public TreeMapNode put (K k, V v,Comparer ctr) { - - if (!isNotEmpty ()) { - return createNode (k, v, left, right); - } - - int result = compare (k, ctr); - if (result > 0) { - TreeMapNode node = right.put (k, v, ctr); - node = createNode (key, this.value, left, node); - return node.insBalance (); - } else if (result < 0) { - TreeMapNode node = left.put (k, v,ctr); - return createNode (key, this.value, node, right).insBalance (); - } - return createNode (key, v, left, right); - } - - public rebuildNode delete (K key, TreeMapNode parent, Comparer ctr, Rotate side) - { - if (this.isNotEmpty ()) { - rebuildNode rebuildNode = null; - 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 if (result == 0){ - rebuildNode = replaceNode (parent, ctr); - } - if (parent == null) { - return rebuildNode; - } - TreeMapNode node = rebuildNode.getNode (); - if (rebuildNode.rebuilds ()) { - // ここのエラーは後で - return node.deleteBalance (parent, ctr); - } - TreeMapNode 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 (false, newParent); - } - return null; - } - - public rebuildNode deleteSubTreeMaxNode (TreeMapNode parent, Comparer ctr, Rotate side) - { - rebuildNode rebuildNode; - TreeMapNode 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 (false, node); - } - - - public rebuildNode deleteBalance (TreeMapNode parent, Comparer ctr) - { - TreeMapNode 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 (true, newNode); - } - if (rightChild) { - newNode = rebuildfive (parent, Rotate.R); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildsix (parent, Rotate.R); - return new rebuildNode (false, newNode); - } - } else { // 左の子が赤 - newNode = rebuildTwo (parent, ctr, Rotate.R); - return new rebuildNode (false, newNode); - } - } else { // 親が赤 - if (!rightChild && !leftChild) { - newNode = rebuildFour (parent, Rotate.R); - return new rebuildNode (false, newNode); - } - if (rightChild) { - newNode = rebuildfive (parent, Rotate.R); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildsix (parent, Rotate.R); - return new rebuildNode (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 (true, newNode); - } - if (rightChild) { - newNode = rebuildsix (parent, Rotate.L); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildfive (parent, Rotate.L); - return new rebuildNode (false, newNode); - } - } else { // 左の子が赤 - newNode = rebuildTwo (parent, ctr, Rotate.L); - return new rebuildNode (false, newNode); - } - } else { // 親が赤 - if (!rightChild && !leftChild) { - newNode = rebuildFour (parent, Rotate.L); - return new rebuildNode (false, newNode); - } - if (rightChild) { - newNode = rebuildsix (parent, Rotate.L); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildfive (parent, Rotate.L); - return new rebuildNode (false, newNode); - } - } - } - } - if (0 > (compare (parent.getKey (), ctr))) { - newNode = parent.createNode (parent.getKey (), parent.getValue (), parent.lefts (), this); - return new rebuildNode (false, newNode); - } else { - newNode = parent.createNode (parent.getKey (), parent.getValue (), this, parent.rights ()); - return new rebuildNode (false, newNode); - } - } - - protected TreeMapNode rebuildTwo (TreeMapNode parent, Comparer ctr, Rotate side) - { // case2 - if (side == Rotate.L) { // rotate Left - TreeMapNode node = parent.rights (); - TreeMapNode leftSubTreeRoot = node.createNode (parent.getKey (), parent.getValue (), this, node.lefts ()); // check - rebuildNode rebuildNode = new rebuildNode (false, leftSubTreeRoot); - rebuildNode leftNodeRebuildNode = this.deleteBalance (rebuildNode.getNode (), ctr); - TreeMapNode rightNode = node.rights (); - return parent.createNode (node.getKey (), node.getValue (), leftNodeRebuildNode.getNode (), rightNode); - } else { // rotate Right - TreeMapNode node = parent.lefts (); - TreeMapNode rightSubTreeRoot = node.createNode (parent.getKey (), parent.getValue (), node.rights (), this); - rebuildNode rightSubTreeRebuildNode = new rebuildNode (false, rightSubTreeRoot); - rebuildNode rightNodeRebuildNode = this.deleteBalance (rightSubTreeRebuildNode.getNode (), ctr); - TreeMapNode leftNode = node.lefts (); - return parent.createNode (node.getKey (), node.getValue (), leftNode, rightNodeRebuildNode.getNode ()); - } - } - - protected TreeMapNode rebuildThree (TreeMapNode parent, Rotate side) - { // case3 再帰 - if (side == Rotate.L) { - TreeMapNode rightNode; - if (parent.rights ().isNotEmpty ()) - rightNode = new RedNode (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts (), parent.rights ().rights ()); // check - else - rightNode = new EmptyNode (); - return parent.createNode (parent.getKey (), parent.getValue (), this, rightNode); - } else { - TreeMapNode leftNode; - if (parent.lefts ().isNotEmpty ()) - leftNode = new RedNode (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ()); // check - else - leftNode = new EmptyNode (); - return parent.createNode (parent.getKey (), parent.getValue (), leftNode, this); - } - } - - protected TreeMapNode rebuildFour (TreeMapNode parent, Rotate side) - { // case 4 - if (side == Rotate.R) { - TreeMapNode leftNode = new RedNode (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ()); - return new BlackNode (parent.getKey (), parent.getValue (), leftNode, this); - } else { - TreeMapNode rightNode = new RedNode (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts (), parent.rights ().rights ()); - return new BlackNode (parent.getKey (), parent.getValue (), this, rightNode); - } - } - - protected TreeMapNode rebuildfive (TreeMapNode parent, Rotate side) - { // case5 - if (side == Rotate.R) { // rotate Left - TreeMapNode leftChild = new RedNode (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ().lefts ()); - TreeMapNode rightChild = parent.lefts ().rights ().rights (); - TreeMapNode leftSubTreeRoot = new BlackNode (parent.lefts ().rights ().getKey (), parent.lefts ().rights ().getValue (), leftChild, rightChild); - TreeMapNode newParent = parent.createNode (parent.getKey (), parent.getValue (), leftSubTreeRoot, this); - return this.rebuildsix (newParent, Rotate.R); - } else { // rotate Right 修正済み - TreeMapNode leftChild = parent.rights ().lefts ().lefts (); - TreeMapNode rightChild = new RedNode (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts ().rights (), parent.rights ().rights ()); - TreeMapNode rightSubTreeRoot = new BlackNode (parent.rights ().lefts ().getKey (), parent.rights ().lefts ().getValue (), leftChild, rightChild); - TreeMapNode newParent = parent.createNode (parent.getKey (), parent.getValue (), this, rightSubTreeRoot); - return this.rebuildsix (newParent, Rotate.L); - } - } - - protected TreeMapNode rebuildsix (TreeMapNode parent, Rotate side) - { // case6 - if (side == Rotate.L) { // rotate Left - TreeMapNode leftChild = parent.rights ().createNode (parent.getKey (), parent.getValue (), this, parent.rights ().lefts ()); // check - TreeMapNode rightChild = new BlackNode (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 leftChild = new BlackNode (parent.lefts ().lefts ().getKey (), parent.lefts ().lefts ().getValue (), parent.lefts ().lefts ().lefts (), parent.lefts ().lefts ().rights ()); - TreeMapNode 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 createNode (K key, V value, TreeMapNode left, TreeMapNode right); - - public abstract TreeMapNode insBalance (); - - - public abstract Rotate checkRotate (Rotate side); - - public abstract bool isRed (); - - public abstract rebuildNode replaceNode (TreeMapNode parent, Comparer ctr); - - public abstract rebuildNode deleteNode (); - - // test method - public abstract int checkDepth (int count, int minCount); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMapNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/TreeMapNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7d8eea1edb907416ea8245914fb76702 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/rebuildNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/rebuildNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class rebuildNode { - private bool rebuild; - TreeMapNode node; - - public rebuildNode(bool l,TreeMapNode node){ - this.rebuild = l; - this.node = node; - } - //don't same name. - public bool rebuilds(){ - return rebuild; - } - - public TreeMapNode getNode(){ - return node; - } - - public bool notEmpty(){ - return node != null; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/rebuildNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/rebuildNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1efdf988ad0624de2b7f8afa0d5501d0 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b82a125b6ca2840dea8c96528f9def74 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeList.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeList.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; - -public interface ChangeList : IEnumerable { - string uuids(); - string getTreeName(); - TreeOperationLog getLog(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeList.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeList.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f1c4c25bfed524ece94d988e6824f290 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListReader.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListReader.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface ChangeListReader{ - ChangeListReader newReader(); - ChangeList read(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListReader.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListReader.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7997dd13eb8fe476c861f46c19be814e +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListWriter.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListWriter.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -using UnityEngine; -using System.Collections; - -public interface ChangeListWriter { - Result write (ChangeList operations); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListWriter.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/ChangeListWriter.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dcd886cd98dd2451fb6ed5da660a2d41 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Journal.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Journal.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface Journal { - ChangeListReader getReader(); - ChangeListWriter getWriter(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Journal.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Journal.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7b791ae31ec9d42969a4be01c17b1a63 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/NullJournal.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/NullJournal.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -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 iterator() { - return null; - } - - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/NullJournal.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/NullJournal.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c2bb90b4ff25042a2b56c774672ab101 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Result.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Result.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - -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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Result.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/Result.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 61861d682cfc74c7bb17a5592501b415 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/SingletonMessage.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/SingletonMessage.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class SingletonMessage : MonoBehaviour { - - public static MsgPack.ObjectPacker getInstance () { - return new MsgPack.ObjectPacker(); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/SingletonMessage.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/SingletonMessage.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8b181774844234172872ff385f89e15b +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b1ec37f5011f44b0e80f5baa87cd3adf +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -ref: refs/heads/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/config --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/config Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = false - bare = false - logallrefupdates = true - symlinks = false - ignorecase = true -[remote "origin"] - url = https://github.com/masharada/msgpack-unity.git - fetch = +refs/heads/*:refs/remotes/origin/* -[branch "master"] - remote = origin - merge = refs/heads/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/description --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/description Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/applypatch-msg.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/applypatch-msg.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh -# -# An example hook script to check the commit log message taken by -# applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. The hook is -# allowed to edit the commit message file. -# -# To enable this hook, rename this file to "applypatch-msg". - -. git-sh-setup -commitmsg="$(git rev-parse --git-path hooks/commit-msg)" -test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} -: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/commit-msg.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/commit-msg.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -#!/bin/sh -# -# An example hook script to check the commit log message. -# Called by "git commit" with one argument, the name of the file -# that has the commit message. The hook should exit with non-zero -# status after issuing an appropriate message if it wants to stop the -# commit. The hook is allowed to edit the commit message file. -# -# To enable this hook, rename this file to "commit-msg". - -# Uncomment the below to add a Signed-off-by line to the message. -# Doing this in a hook is a bad idea in general, but the prepare-commit-msg -# hook is more suited to it. -# -# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" - -# This example catches duplicate Signed-off-by lines. - -test "" = "$(grep '^Signed-off-by: ' "$1" | - sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { - echo >&2 Duplicate Signed-off-by lines. - exit 1 -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/post-update.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/post-update.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#!/bin/sh -# -# An example hook script to prepare a packed repository for use over -# dumb transports. -# -# To enable this hook, rename this file to "post-update". - -exec git update-server-info diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-applypatch.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-applypatch.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed -# by applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-applypatch". - -. git-sh-setup -precommit="$(git rev-parse --git-path hooks/pre-commit)" -test -x "$precommit" && exec "$precommit" ${1+"$@"} -: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-commit.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-commit.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed. -# Called by "git commit" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message if -# it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-commit". - -if git rev-parse --verify HEAD >/dev/null 2>&1 -then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 -fi - -# If you want to allow non-ASCII filenames set this variable to true. -allownonascii=$(git config --bool hooks.allownonascii) - -# Redirect output to stderr. -exec 1>&2 - -# Cross platform projects tend to avoid non-ASCII filenames; prevent -# them from being added to the repository. We exploit the fact that the -# printable range starts at the space character and ends with tilde. -if [ "$allownonascii" != "true" ] && - # Note that the use of brackets around a tr range is ok here, (it's - # even required, for portability to Solaris 10's /usr/bin/tr), since - # the square bracket bytes happen to fall in the designated range. - test $(git diff --cached --name-only --diff-filter=A -z $against | - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 -then - cat <<\EOF -Error: Attempt to add a non-ASCII file name. - -This can cause problems if you want to work with people on other platforms. - -To be portable it is advisable to rename the file. - -If you know what you are doing you can disable this check using: - - git config hooks.allownonascii true -EOF - exit 1 -fi - -# If there are whitespace errors, print the offending file names and fail. -exec git diff-index --check --cached $against -- diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-push.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-push.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#!/bin/sh - -# An example hook script to verify what is about to be pushed. Called by "git -# push" after it has checked the remote status, but before anything has been -# pushed. If this script exits with a non-zero status nothing will be pushed. -# -# This hook is called with the following parameters: -# -# $1 -- Name of the remote to which the push is being done -# $2 -- URL to which the push is being done -# -# If pushing without using a named remote those arguments will be equal. -# -# Information about the commits which are being pushed is supplied as lines to -# the standard input in the form: -# -# -# -# This sample shows how to prevent push of commits where the log message starts -# with "WIP" (work in progress). - -remote="$1" -url="$2" - -z40=0000000000000000000000000000000000000000 - -while read local_ref local_sha remote_ref remote_sha -do - if [ "$local_sha" = $z40 ] - then - # Handle delete - : - else - if [ "$remote_sha" = $z40 ] - then - # New branch, examine all commits - range="$local_sha" - else - # Update to existing branch, examine new commits - range="$remote_sha..$local_sha" - fi - - # Check for WIP commit - commit=`git rev-list -n 1 --grep '^WIP' "$range"` - if [ -n "$commit" ] - then - echo >&2 "Found WIP commit in $local_ref, not pushing" - exit 1 - fi - fi -done - -exit 0 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-rebase.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/pre-rebase.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2006, 2008 Junio C Hamano -# -# The "pre-rebase" hook is run just before "git rebase" starts doing -# its job, and can prevent the command from running by exiting with -# non-zero status. -# -# The hook is called with the following parameters: -# -# $1 -- the upstream the series was forked from. -# $2 -- the branch being rebased (or empty when rebasing the current branch). -# -# This sample shows how to prevent topic branches that are already -# merged to 'next' branch from getting rebased, because allowing it -# would result in rebasing already published history. - -publish=next -basebranch="$1" -if test "$#" = 2 -then - topic="refs/heads/$2" -else - topic=`git symbolic-ref HEAD` || - exit 0 ;# we do not interrupt rebasing detached HEAD -fi - -case "$topic" in -refs/heads/??/*) - ;; -*) - exit 0 ;# we do not interrupt others. - ;; -esac - -# Now we are dealing with a topic branch being rebased -# on top of master. Is it OK to rebase it? - -# Does the topic really exist? -git show-ref -q "$topic" || { - echo >&2 "No such branch $topic" - exit 1 -} - -# Is topic fully merged to master? -not_in_master=`git rev-list --pretty=oneline ^master "$topic"` -if test -z "$not_in_master" -then - echo >&2 "$topic is fully merged to master; better remove it." - exit 1 ;# we could allow it, but there is no point. -fi - -# Is topic ever merged to next? If so you should not be rebasing it. -only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` -only_next_2=`git rev-list ^master ${publish} | sort` -if test "$only_next_1" = "$only_next_2" -then - not_in_topic=`git rev-list "^$topic" master` - if test -z "$not_in_topic" - then - echo >&2 "$topic is already up-to-date with master" - exit 1 ;# we could allow it, but there is no point. - else - exit 0 - fi -else - not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` - /usr/bin/perl -e ' - my $topic = $ARGV[0]; - my $msg = "* $topic has commits already merged to public branch:\n"; - my (%not_in_next) = map { - /^([0-9a-f]+) /; - ($1 => 1); - } split(/\n/, $ARGV[1]); - for my $elem (map { - /^([0-9a-f]+) (.*)$/; - [$1 => $2]; - } split(/\n/, $ARGV[2])) { - if (!exists $not_in_next{$elem->[0]}) { - if ($msg) { - print STDERR $msg; - undef $msg; - } - print STDERR " $elem->[1]\n"; - } - } - ' "$topic" "$not_in_next" "$not_in_master" - exit 1 -fi - -exit 0 - -################################################################ - -This sample hook safeguards topic branches that have been -published from being rewound. - -The workflow assumed here is: - - * Once a topic branch forks from "master", "master" is never - merged into it again (either directly or indirectly). - - * Once a topic branch is fully cooked and merged into "master", - it is deleted. If you need to build on top of it to correct - earlier mistakes, a new topic branch is created by forking at - the tip of the "master". This is not strictly necessary, but - it makes it easier to keep your history simple. - - * Whenever you need to test or publish your changes to topic - branches, merge them into "next" branch. - -The script, being an example, hardcodes the publish branch name -to be "next", but it is trivial to make it configurable via -$GIT_DIR/config mechanism. - -With this workflow, you would want to know: - -(1) ... if a topic branch has ever been merged to "next". Young - topic branches can have stupid mistakes you would rather - clean up before publishing, and things that have not been - merged into other branches can be easily rebased without - affecting other people. But once it is published, you would - not want to rewind it. - -(2) ... if a topic branch has been fully merged to "master". - Then you can delete it. More importantly, you should not - build on top of it -- other people may already want to - change things related to the topic as patches against your - "master", so if you need further changes, it is better to - fork the topic (perhaps with the same name) afresh from the - tip of "master". - -Let's look at this example: - - o---o---o---o---o---o---o---o---o---o "next" - / / / / - / a---a---b A / / - / / / / - / / c---c---c---c B / - / / / \ / - / / / b---b C \ / - / / / / \ / - ---o---o---o---o---o---o---o---o---o---o---o "master" - - -A, B and C are topic branches. - - * A has one fix since it was merged up to "next". - - * B has finished. It has been fully merged up to "master" and "next", - and is ready to be deleted. - - * C has not merged to "next" at all. - -We would want to allow C to be rebased, refuse A, and encourage -B to be deleted. - -To compute (1): - - git rev-list ^master ^topic next - git rev-list ^master next - - if these match, topic has not merged in next at all. - -To compute (2): - - git rev-list master..topic - - if this is empty, it is fully merged to "master". diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/prepare-commit-msg.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/prepare-commit-msg.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#!/bin/sh -# -# An example hook script to prepare the commit log message. -# Called by "git commit" with the name of the file that has the -# commit message, followed by the description of the commit -# message's source. The hook's purpose is to edit the commit -# message file. If the hook fails with a non-zero status, -# the commit is aborted. -# -# To enable this hook, rename this file to "prepare-commit-msg". - -# This hook includes three examples. The first comments out the -# "Conflicts:" part of a merge commit. -# -# The second includes the output of "git diff --name-status -r" -# into the message, just before the "git status" output. It is -# commented because it doesn't cope with --amend or with squashed -# commits. -# -# The third example adds a Signed-off-by line to the message, that can -# still be edited. This is rarely a good idea. - -case "$2,$3" in - merge,) - /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; - -# ,|template,) -# /usr/bin/perl -i.bak -pe ' -# print "\n" . `git diff --cached --name-status -r` -# if /^#/ && $first++ == 0' "$1" ;; - - *) ;; -esac - -# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/update.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/hooks/update.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -#!/bin/sh -# -# An example hook script to block unannotated tags from entering. -# Called by "git receive-pack" with arguments: refname sha1-old sha1-new -# -# To enable this hook, rename this file to "update". -# -# Config -# ------ -# hooks.allowunannotated -# This boolean sets whether unannotated tags will be allowed into the -# repository. By default they won't be. -# hooks.allowdeletetag -# This boolean sets whether deleting tags will be allowed in the -# repository. By default they won't be. -# hooks.allowmodifytag -# This boolean sets whether a tag may be modified after creation. By default -# it won't be. -# hooks.allowdeletebranch -# This boolean sets whether deleting branches will be allowed in the -# repository. By default they won't be. -# hooks.denycreatebranch -# This boolean sets whether remotely creating branches will be denied -# in the repository. By default this is allowed. -# - -# --- Command line -refname="$1" -oldrev="$2" -newrev="$3" - -# --- Safety check -if [ -z "$GIT_DIR" ]; then - echo "Don't run this script from the command line." >&2 - echo " (if you want, you could supply GIT_DIR then run" >&2 - echo " $0 )" >&2 - exit 1 -fi - -if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then - echo "usage: $0 " >&2 - exit 1 -fi - -# --- Config -allowunannotated=$(git config --bool hooks.allowunannotated) -allowdeletebranch=$(git config --bool hooks.allowdeletebranch) -denycreatebranch=$(git config --bool hooks.denycreatebranch) -allowdeletetag=$(git config --bool hooks.allowdeletetag) -allowmodifytag=$(git config --bool hooks.allowmodifytag) - -# check for no description -projectdesc=$(sed -e '1q' "$GIT_DIR/description") -case "$projectdesc" in -"Unnamed repository"* | "") - echo "*** Project description file hasn't been set" >&2 - exit 1 - ;; -esac - -# --- Check types -# if $newrev is 0000...0000, it's a commit to delete a ref. -zero="0000000000000000000000000000000000000000" -if [ "$newrev" = "$zero" ]; then - newrev_type=delete -else - newrev_type=$(git cat-file -t $newrev) -fi - -case "$refname","$newrev_type" in - refs/tags/*,commit) - # un-annotated tag - short_refname=${refname##refs/tags/} - if [ "$allowunannotated" != "true" ]; then - echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 - echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 - exit 1 - fi - ;; - refs/tags/*,delete) - # delete tag - if [ "$allowdeletetag" != "true" ]; then - echo "*** Deleting a tag is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/tags/*,tag) - # annotated tag - if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 - then - echo "*** Tag '$refname' already exists." >&2 - echo "*** Modifying a tag is not allowed in this repository." >&2 - exit 1 - fi - ;; - refs/heads/*,commit) - # branch - if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then - echo "*** Creating a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/heads/*,delete) - # delete branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/remotes/*,commit) - # tracking branch - ;; - refs/remotes/*,delete) - # delete tracking branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a tracking branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - *) - # Anything else (is there anything else?) - echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 - exit 1 - ;; -esac - -# --- Finished -exit 0 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/index Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/index has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/info/exclude --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/info/exclude Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/logs/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/logs/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000000000000000000000000000000000000000 e7c80cc200584b818c491a184cfc6f2b5f9e17a8 Kazuma Takeda 1477164441 +0900 clone: from https://github.com/masharada/msgpack-unity.git diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/logs/refs/heads/master --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/logs/refs/heads/master Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000000000000000000000000000000000000000 e7c80cc200584b818c491a184cfc6f2b5f9e17a8 Kazuma Takeda 1477164441 +0900 clone: from https://github.com/masharada/msgpack-unity.git diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/logs/refs/remotes/origin/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/logs/refs/remotes/origin/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000000000000000000000000000000000000000 e7c80cc200584b818c491a184cfc6f2b5f9e17a8 Kazuma Takeda 1477164441 +0900 clone: from https://github.com/masharada/msgpack-unity.git diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/00/c8e51cd16ac10c74dd2f9974e6261ae72dfe4c --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/00/c8e51cd16ac10c74dd2f9974e6261ae72dfe4c Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -xSn0 5 -"촇[Ѓf.E8Bɓ^/a_8Iv-|QJ -w~/`|bt~7g0Q 3V,fP 5BX>]dh -. B1ht[р*TCZXR,Hޖ*E[}*>xj J(Ы@# vu]k^ ntO.Nh-^ICrDIRBԠ ŜfʵN|V\- 2LZgdRWuJtgBA?!pQ<"n bΖ4&u3}p7zH~d4hJָ`EqS)ISy%r\@HhL-̘R! n‹ y^e97níU))e=O-ZWƟUB^CZp/d۽Ez ˦$Q i|}2|:#${||B6>G } -UPɓ8,J5jѱ|DӻL'u~M6OV*\,%}P< ~WGI&" *2C3Ìj#TV\- uSiqV MПon:߄qnxϣm`}: :7̣'܆Nrn\J2)uTk[R"αLUL!XJ2>uDӎZ. yW/[t \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/05/4668352f9f1e28268bc74604ad4c73a3a24e74 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/05/4668352f9f1e28268bc74604ad4c73a3a24e74 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/18/17b354ce3301394fc5af5f8a2a17b690812ec1 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/18/17b354ce3301394fc5af5f8a2a17b690812ec1 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/1f/116ad7ca93823183d33d8223139c717df069c3 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/1f/116ad7ca93823183d33d8223139c717df069c3 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/2d/f9bb3e0866da49532c79177f5a2febd5b8973e Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/2d/f9bb3e0866da49532c79177f5a2febd5b8973e has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/30/6b516bef3bf54505433f44b53d4fc99311ecd6 --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/30/6b516bef3bf54505433f44b53d4fc99311ecd6 Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -xUR͎0<Ũ'JESmIQ'45 h+0.|ߏVpů?$JXj3Zn../G q@Ț+RjUM 5X2! 'X+/eOջ@1:Ai#`{n "T3-=K8']zqf?hm Inm̸d-Wyz-#w%җ-G@#*,Ehh X yY5 pzt%69}> yZ@V}Zd"@?m,$/i D&,>WPo[<읡\54+Y%؅N;OHaGN&X㥔*5{43})a{bݍ]Gjh=G75 \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/34/d46e7bef952bd8fabb5f2847d7a283855b83fe --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/34/d46e7bef952bd8fabb5f2847d7a283855b83fe Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -x}Sn06y^RIbT25ݦ !产,=<m]UVs3_|ϯq1 UQk,QLĚUr.8J (5 `J.Q$EuN[EJذP$a`)rXX`#T®N9C-#8i8*bntM'8='m˅k`YlNFsV2TYBf}0ji+\c$@43&3H!I;~&iߑ\%\ xRLa8$d2,i^-K@6%.Rt,Φ@.S4,C jI@ԐG7akCaXכ)4BG5G4Xx +iktӃ? J0Xy Gk6zby$%KOC|iG-lyNo:6^ϧʼn~%GwNvWtϠnX6t Mg_F8j:ԍK'/aLom?vVw_ \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/46/d080685b602b8ccec7a343da7c62256c35ad0c Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/46/d080685b602b8ccec7a343da7c62256c35ad0c has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/50/bcb39015be539af4a654036cef49a5f08c0321 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/50/bcb39015be539af4a654036cef49a5f08c0321 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/57/543770118822a5eb91efa7cac5037297df169d Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/57/543770118822a5eb91efa7cac5037297df169d has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/5e/618130994ffb0591f53545cf84a89f552df84f Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/5e/618130994ffb0591f53545cf84a89f552df84f has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/5e/cbb52610087bad1c48572c99c998a4928013d5 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/5e/cbb52610087bad1c48572c99c998a4928013d5 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/61/c2225fc4a2b7742c3b8d3ec6cb6f78aac73868 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/61/c2225fc4a2b7742c3b8d3ec6cb6f78aac73868 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/6c/4d4e0b98bd4200dea587f867232aaf94fb7efa Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/6c/4d4e0b98bd4200dea587f867232aaf94fb7efa has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/79/4aff4f6de364bc022a7653c2cde3116f184e8f Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/79/4aff4f6de364bc022a7653c2cde3116f184e8f has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/79/a31fc6b0d5d061f5151d9e1ada8e54346e2c98 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/79/a31fc6b0d5d061f5151d9e1ada8e54346e2c98 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/8c/c971fe5e16554747f616b1f65e26103b5f71ec Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/8c/c971fe5e16554747f616b1f65e26103b5f71ec has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/9a/c0ec3d0fb15a1b74cb749b1d25189f5bab7ff1 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/9a/c0ec3d0fb15a1b74cb749b1d25189f5bab7ff1 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/9c/6d483546704aaa1453f57ca14c6471830c91ac Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/9c/6d483546704aaa1453f57ca14c6471830c91ac has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/a7/c97a61698cdf1839fcdcd447b37ecdd4ffd88e Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/a7/c97a61698cdf1839fcdcd447b37ecdd4ffd88e has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/ae/899d9608dcb968d6073329c2cd45a4b9b825de Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/ae/899d9608dcb968d6073329c2cd45a4b9b825de has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/be/c4d4c4558d625539410a5b3a2e69f48ec48f48 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/be/c4d4c4558d625539410a5b3a2e69f48ec48f48 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/d5/40b060aeccc5b4e1ab26aec45267e8ae7393c2 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/d5/40b060aeccc5b4e1ab26aec45267e8ae7393c2 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/e7/c80cc200584b818c491a184cfc6f2b5f9e17a8 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/e7/c80cc200584b818c491a184cfc6f2b5f9e17a8 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/e9/8430e1f9a9d93e5971d6e65d0d70a771e6a070 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/objects/e9/8430e1f9a9d93e5971d6e65d0d70a771e6a070 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/packed-refs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/packed-refs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# pack-refs with: peeled fully-peeled -e7c80cc200584b818c491a184cfc6f2b5f9e17a8 refs/remotes/origin/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/refs/heads/master --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/refs/heads/master Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -e7c80cc200584b818c491a184cfc6f2b5f9e17a8 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/refs/remotes/origin/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.git/refs/remotes/origin/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -ref: refs/remotes/origin/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.gitignore --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/.gitignore Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) -bin -obj - -# mstest test results -TestResults \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/README.md --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/README.md Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -# MessagePack for Unity - -## What is it? - -This is MessagePack serialization/deserialization for Unity (or Unity Pro.) - -This library is based on Kazuki's MessagePack for C# -(not the current official for CLI, because it depends on .NET framework 4.0.) - -## Install - -To install this, copy files in src to Assets folder in your project. - -## See also - - Official Library : https://github.com/msgpack/msgpack - - Original C# Implementation : https://github.com/kazuki/msgpack - -## License - - Copyright (C) 2011-2012 Kazuki Oikawa, Kazunari Kida - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/README.md.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/README.md.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d7a91058245d942248e01af683a3030f +timeCreated: 1478444952 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 23eba2fc8206143eab7f1ce442902491 +folderAsset: yes +timeCreated: 1478444952 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/BoxingPacker.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/BoxingPacker.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Reflection; - -namespace MsgPack -{ - public class BoxingPacker - { - static Type KeyValuePairDefinitionType; - - static BoxingPacker () - { - KeyValuePairDefinitionType = typeof (KeyValuePair).GetGenericTypeDefinition (); - } - - public void Pack (Stream strm, object o) - { - MsgPackWriter writer = new MsgPackWriter (strm); - Pack (writer, o); - } - - public byte[] Pack (object o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - void Pack (MsgPackWriter writer, object o) - { - if (o == null) { - writer.WriteNil (); - return; - } - - Type t = o.GetType (); - if (t.IsPrimitive) { - if (t.Equals (typeof (int))) writer.Write ((int)o); - else if (t.Equals (typeof (uint))) writer.Write ((uint)o); - else if (t.Equals (typeof (float))) writer.Write ((float)o); - else if (t.Equals (typeof (double))) writer.Write ((double)o); - else if (t.Equals (typeof (long))) writer.Write ((long)o); - else if (t.Equals (typeof (ulong))) writer.Write ((ulong)o); - else if (t.Equals (typeof (bool))) writer.Write ((bool)o); - else if (t.Equals (typeof (byte))) writer.Write ((byte)o); - else if (t.Equals (typeof (sbyte))) writer.Write ((sbyte)o); - else if (t.Equals (typeof (short))) writer.Write ((short)o); - else if (t.Equals (typeof (ushort))) writer.Write ((ushort)o); - else throw new NotSupportedException (); // char? - return; - } - - IDictionary dic = o as IDictionary; - if (dic != null) { - writer.WriteMapHeader (dic.Count); - foreach (System.Collections.DictionaryEntry e in dic) { - Pack (writer, e.Key); - Pack (writer, e.Value); - } - return; - } - - if (t.IsArray) { - Array ary = (Array)o; - Type et = t.GetElementType (); - - // KeyValuePair[] (Map Type) - if (et.IsGenericType && et.GetGenericTypeDefinition ().Equals (KeyValuePairDefinitionType)) { - PropertyInfo propKey = et.GetProperty ("Key"); - PropertyInfo propValue = et.GetProperty ("Value"); - writer.WriteMapHeader (ary.Length); - for (int i = 0; i < ary.Length; i ++) { - object e = ary.GetValue (i); - Pack (writer, propKey.GetValue (e, null)); - Pack (writer, propValue.GetValue (e, null)); - } - return; - } - - // Array - writer.WriteArrayHeader (ary.Length); - for (int i = 0; i < ary.Length; i ++) - Pack (writer, ary.GetValue (i)); - return; - } - } - - public object Unpack (Stream strm) - { - MsgPackReader reader = new MsgPackReader (strm); - return Unpack (reader); - } - - public object Unpack (byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (ms); - } - } - - public object Unpack (byte[] buf) - { - return Unpack (buf, 0, buf.Length); - } - - object Unpack (MsgPackReader reader) - { - if (!reader.Read ()) - throw new FormatException (); - - switch (reader.Type) { - case TypePrefixes.PositiveFixNum: - case TypePrefixes.NegativeFixNum: - case TypePrefixes.Int8: - case TypePrefixes.Int16: - case TypePrefixes.Int32: - return reader.ValueSigned; - case TypePrefixes.Int64: - return reader.ValueSigned64; - case TypePrefixes.UInt8: - case TypePrefixes.UInt16: - case TypePrefixes.UInt32: - return reader.ValueUnsigned; - case TypePrefixes.UInt64: - return reader.ValueUnsigned64; - case TypePrefixes.True: - return true; - case TypePrefixes.False: - return false; - case TypePrefixes.Float: - return reader.ValueFloat; - case TypePrefixes.Double: - return reader.ValueDouble; - case TypePrefixes.Nil: - return null; - case TypePrefixes.FixRaw: - case TypePrefixes.Raw16: - case TypePrefixes.Raw32: - byte[] raw = new byte[reader.Length]; - reader.ReadValueRaw (raw, 0, raw.Length); - return raw; - case TypePrefixes.FixArray: - case TypePrefixes.Array16: - case TypePrefixes.Array32: - object[] ary = new object[reader.Length]; - for (int i = 0; i < ary.Length; i ++) - ary[i] = Unpack (reader); - return ary; - case TypePrefixes.FixMap: - case TypePrefixes.Map16: - case TypePrefixes.Map32: - IDictionary dic = new Dictionary ((int)reader.Length); - int count = (int)reader.Length; - for (int i = 0; i < count; i ++) { - object k = Unpack (reader); - object v = Unpack (reader); - dic.Add (k, v); - } - return dic; - default: - throw new FormatException (); - } - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/BoxingPacker.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/BoxingPacker.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b75a30b129778498fa6a03aa4fd4ef20 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/CompiledPacker.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/CompiledPacker.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,549 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Reflection.Emit; -using System.Threading; -using MsgPack.Compiler; - -namespace MsgPack -{ - public class CompiledPacker - { - static PackerBase _publicFieldPacker, _allFieldPacker; - PackerBase _packer; - - static CompiledPacker () - { - _publicFieldPacker = new MethodBuilderPacker (); - _allFieldPacker = new DynamicMethodPacker (); - } - - public CompiledPacker () : this (false) {} - public CompiledPacker (bool packPrivateField) - { - _packer = (packPrivateField ? _allFieldPacker : _publicFieldPacker); - } - - public void Prepare () - { - _packer.CreatePacker (); - _packer.CreateUnpacker (); - } - - #region Generics Pack/Unpack Methods - public byte[] Pack (T o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - public void Pack (Stream strm, T o) - { - _packer.CreatePacker () (new MsgPackWriter (strm), o); - } - - public T Unpack (byte[] buf) - { - return Unpack (buf, 0, buf.Length); - } - - public T Unpack (byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (ms); - } - } - - public T Unpack (Stream strm) - { - return _packer.CreateUnpacker () (new MsgPackReader (strm)); - } - #endregion - - #region Non-generics Pack/Unpack Methods - public byte[] Pack (object o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - public void Pack (Stream strm, object o) - { - throw new NotImplementedException (); - } - - public object Unpack (Type t, byte[] buf) - { - return Unpack (t, buf, 0, buf.Length); - } - - public object Unpack (Type t, byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (t, ms); - } - } - - public object Unpack (Type t, Stream strm) - { - throw new NotImplementedException (); - } - #endregion - - #region Compiled Packer Implementations - public abstract class PackerBase - { - Dictionary _packers = new Dictionary (); - Dictionary _unpackers = new Dictionary (); - - protected Dictionary _packMethods = new Dictionary (); - protected Dictionary _unpackMethods = new Dictionary (); - - protected PackerBase () - { - DefaultPackMethods.Register (_packMethods, _unpackMethods); - } - - public Action CreatePacker () - { - Delegate d; - lock (_packers) { - if (!_packers.TryGetValue (typeof (T), out d)) { - d = CreatePacker_Internal (); - _packers.Add (typeof (T), d); - } - } - return (Action)d; - } - - public Func CreateUnpacker () - { - Delegate d; - lock (_unpackers) { - if (!_unpackers.TryGetValue (typeof (T), out d)) { - d = CreateUnpacker_Internal (); - _unpackers.Add (typeof (T), d); - } - } - return (Func)d; - } - - protected abstract Action CreatePacker_Internal (); - protected abstract Func CreateUnpacker_Internal (); - } - public sealed class DynamicMethodPacker : PackerBase - { - private static MethodInfo LookupMemberMappingMethod; - static Dictionary> UnpackMemberMappings; - - static DynamicMethodPacker () - { - UnpackMemberMappings = new Dictionary> (); - LookupMemberMappingMethod = typeof (DynamicMethodPacker).GetMethod ("LookupMemberMapping", BindingFlags.Static | BindingFlags.NonPublic); - } - - public DynamicMethodPacker () : base () - { - } - - protected override Action CreatePacker_Internal () - { - DynamicMethod dm = CreatePacker (typeof (T), CreatePackDynamicMethod (typeof (T))); - return (Action)dm.CreateDelegate (typeof (Action)); - } - - protected override Func CreateUnpacker_Internal () - { - DynamicMethod dm = CreateUnpacker (typeof (T), CreateUnpackDynamicMethod (typeof (T))); - return (Func)dm.CreateDelegate (typeof (Func)); - } - - DynamicMethod CreatePacker (Type t, DynamicMethod dm) - { - ILGenerator il = dm.GetILGenerator (); - _packMethods.Add (t, dm); - PackILGenerator.EmitPackCode (t, dm, il, LookupMembers, FormatMemberName, LookupPackMethod); - return dm; - } - - DynamicMethod CreateUnpacker (Type t, DynamicMethod dm) - { - ILGenerator il = dm.GetILGenerator (); - _unpackMethods.Add (t, dm); - PackILGenerator.EmitUnpackCode (t, dm, il, LookupMembers, FormatMemberName, LookupUnpackMethod, - LookupMemberMapping, LookupMemberMappingMethod); - return dm; - } - - static DynamicMethod CreatePackDynamicMethod (Type t) - { - return CreateDynamicMethod (typeof (void), new Type[] {typeof (MsgPackWriter), t}); - } - - static DynamicMethod CreateUnpackDynamicMethod (Type t) - { - return CreateDynamicMethod (t, new Type[] {typeof (MsgPackReader)}); - } - - static MemberInfo[] LookupMembers (Type t) - { - BindingFlags baseFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; - System.Collections.Generic.List list = new System.Collections.Generic.List (); - list.AddRange (t.GetFields (baseFlags)); - // TODO: Add NonSerialized Attribute Filter ? - return list.ToArray (); - } - - MethodInfo LookupPackMethod (Type t) - { - MethodInfo mi; - DynamicMethod dm; - if (_packMethods.TryGetValue (t, out mi)) - return mi; - dm = CreatePackDynamicMethod (t); - return CreatePacker (t, dm); - } - - MethodInfo LookupUnpackMethod (Type t) - { - MethodInfo mi; - if (_unpackMethods.TryGetValue (t, out mi)) - return mi; - DynamicMethod dm = CreateUnpackDynamicMethod (t); - return CreateUnpacker (t, dm); - } - - static string FormatMemberName (MemberInfo m) - { - if (m.MemberType != MemberTypes.Field) - return m.Name; - - int pos; - string name = m.Name; - if (name[0] == '<' && (pos = name.IndexOf ('>')) > 1) - name = name.Substring (1, pos - 1); // Auto-Property (\<.+\>) - return name; - } - - static int _dynamicMethodIdx = 0; - static DynamicMethod CreateDynamicMethod (Type returnType, Type[] parameterTypes) - { - string name = "_" + Interlocked.Increment (ref _dynamicMethodIdx).ToString (); - return new DynamicMethod (name, returnType, parameterTypes, true); - } - - internal static IDictionary LookupMemberMapping (Type t) - { - IDictionary mapping; - lock (UnpackMemberMappings) { - if (!UnpackMemberMappings.TryGetValue (t, out mapping)) { - mapping = new Dictionary (); - UnpackMemberMappings.Add (t, mapping); - } - } - return mapping; - } - } - public sealed class MethodBuilderPacker : PackerBase - { - public const string AssemblyName = "MessagePackInternalAssembly"; - static AssemblyName DynamicAsmName; - static AssemblyBuilder DynamicAsmBuilder; - static ModuleBuilder DynamicModuleBuilder; - - private static MethodInfo LookupMemberMappingMethod; - static Dictionary> UnpackMemberMappings; - - static MethodBuilderPacker () - { - UnpackMemberMappings = new Dictionary> (); - LookupMemberMappingMethod = typeof (MethodBuilderPacker).GetMethod ("LookupMemberMapping", BindingFlags.Static | BindingFlags.NonPublic); - - DynamicAsmName = new AssemblyName (AssemblyName); - DynamicAsmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (DynamicAsmName, AssemblyBuilderAccess.Run); - DynamicModuleBuilder = DynamicAsmBuilder.DefineDynamicModule (DynamicAsmName.Name); - } - - public MethodBuilderPacker () : base () - { - } - - protected override Action CreatePacker_Internal () - { - TypeBuilder tb; - MethodBuilder mb; - CreatePackMethodBuilder (typeof (T), out tb, out mb); - _packMethods.Add (typeof (T), mb); - CreatePacker (typeof (T), mb); - MethodInfo mi = ToCallableMethodInfo (typeof (T), tb, true); - return (Action)Delegate.CreateDelegate (typeof (Action), mi); - } - - protected override Func CreateUnpacker_Internal () - { - TypeBuilder tb; - MethodBuilder mb; - CreateUnpackMethodBuilder (typeof (T), out tb, out mb); - _unpackMethods.Add (typeof (T), mb); - CreateUnpacker (typeof (T), mb); - MethodInfo mi = ToCallableMethodInfo (typeof (T), tb, false); - return (Func)Delegate.CreateDelegate (typeof (Func), mi); - } - - void CreatePacker (Type t, MethodBuilder mb) - { - ILGenerator il = mb.GetILGenerator (); - PackILGenerator.EmitPackCode (t, mb, il, LookupMembers, FormatMemberName, LookupPackMethod); - } - - void CreateUnpacker (Type t, MethodBuilder mb) - { - ILGenerator il = mb.GetILGenerator (); - PackILGenerator.EmitUnpackCode (t, mb, il, LookupMembers, FormatMemberName, LookupUnpackMethod, - LookupMemberMapping, LookupMemberMappingMethod); - } - - MethodInfo ToCallableMethodInfo (Type t, TypeBuilder tb, bool isPacker) - { - Type type = tb.CreateType (); - MethodInfo mi = type.GetMethod (isPacker ? "Pack" : "Unpack", BindingFlags.Static | BindingFlags.Public); - if (isPacker) { - _packMethods[t] = mi; - } else { - _unpackMethods[t] = mi; - } - return mi; - } - - MethodInfo LookupPackMethod (Type t) - { - MethodInfo mi; - TypeBuilder tb; - MethodBuilder mb; - if (_packMethods.TryGetValue (t, out mi)) - return mi; - CreatePackMethodBuilder (t, out tb, out mb); - _packMethods.Add (t, mb); - CreatePacker (t, mb); - return ToCallableMethodInfo (t, tb, true); - } - - MethodInfo LookupUnpackMethod (Type t) - { - MethodInfo mi; - TypeBuilder tb; - MethodBuilder mb; - if (_unpackMethods.TryGetValue (t, out mi)) - return mi; - CreateUnpackMethodBuilder (t, out tb, out mb); - _unpackMethods.Add (t, mb); - CreateUnpacker (t, mb); - return ToCallableMethodInfo (t, tb, false); - } - - static string FormatMemberName (MemberInfo m) - { - return m.Name; - } - - static MemberInfo[] LookupMembers (Type t) - { - BindingFlags baseFlags = BindingFlags.Instance | BindingFlags.Public; - System.Collections.Generic.List list = new System.Collections.Generic.List (); - list.AddRange (t.GetFields (baseFlags)); - // TODO: Add NonSerialized Attribute Filter ? - return list.ToArray (); - } - - static void CreatePackMethodBuilder (Type t, out TypeBuilder tb, out MethodBuilder mb) - { - tb = DynamicModuleBuilder.DefineType (t.Name + "PackerType", TypeAttributes.Public); - mb = tb.DefineMethod ("Pack", MethodAttributes.Static | MethodAttributes.Public, typeof (void), new Type[] {typeof (MsgPackWriter), t}); - } - - static void CreateUnpackMethodBuilder (Type t, out TypeBuilder tb, out MethodBuilder mb) - { - tb = DynamicModuleBuilder.DefineType (t.Name + "UnpackerType", TypeAttributes.Public); - mb = tb.DefineMethod ("Unpack", MethodAttributes.Static | MethodAttributes.Public, t, new Type[] {typeof (MsgPackReader)}); - } - - internal static IDictionary LookupMemberMapping (Type t) - { - IDictionary mapping; - lock (UnpackMemberMappings) { - if (!UnpackMemberMappings.TryGetValue (t, out mapping)) { - mapping = new Dictionary (); - UnpackMemberMappings.Add (t, mapping); - } - } - return mapping; - } - } - #endregion - - #region default pack/unpack methods - internal static class DefaultPackMethods - { - public static void Register (Dictionary packMethods, Dictionary unpackMethods) - { - RegisterPackMethods (packMethods); - RegisterUnpackMethods (unpackMethods); - } - - #region Pack - static void RegisterPackMethods (Dictionary packMethods) - { - Type type = typeof (DefaultPackMethods); - MethodInfo[] methods = type.GetMethods (BindingFlags.Static | BindingFlags.NonPublic); - string methodName = "Pack"; - for (int i = 0; i < methods.Length; i ++) { - if (!methodName.Equals (methods[i].Name)) - continue; - ParameterInfo[] parameters = methods[i].GetParameters (); - if (parameters.Length != 2 || parameters[0].ParameterType != typeof (MsgPackWriter)) - continue; - packMethods.Add (parameters[1].ParameterType, methods[i]); - } - } - - internal static void Pack (MsgPackWriter writer, string x) - { - if (x == null) { - writer.WriteNil (); - } else { - writer.Write (x, false); - } - } - #endregion - - #region Unpack - static void RegisterUnpackMethods (Dictionary unpackMethods) - { - BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic; - Type type = typeof (DefaultPackMethods); - MethodInfo mi = type.GetMethod ("Unpack_Signed", flags); - unpackMethods.Add (typeof (sbyte), mi); - unpackMethods.Add (typeof (short), mi); - unpackMethods.Add (typeof (int), mi); - - mi = type.GetMethod ("Unpack_Signed64", flags); - unpackMethods.Add (typeof (long), mi); - - mi = type.GetMethod ("Unpack_Unsigned", flags); - unpackMethods.Add (typeof (byte), mi); - unpackMethods.Add (typeof (ushort), mi); - unpackMethods.Add (typeof (char), mi); - unpackMethods.Add (typeof (uint), mi); - - mi = type.GetMethod ("Unpack_Unsigned64", flags); - unpackMethods.Add (typeof (ulong), mi); - - mi = type.GetMethod ("Unpack_Boolean", flags); - unpackMethods.Add (typeof (bool), mi); - - mi = type.GetMethod ("Unpack_Float", flags); - unpackMethods.Add (typeof (float), mi); - - mi = type.GetMethod ("Unpack_Double", flags); - unpackMethods.Add (typeof (double), mi); - - mi = type.GetMethod ("Unpack_String", flags); - unpackMethods.Add (typeof (string), mi); - } - - internal static int Unpack_Signed (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsSigned ()) - UnpackFailed (); - return reader.ValueSigned; - } - - internal static long Unpack_Signed64 (MsgPackReader reader) - { - if (!reader.Read ()) - UnpackFailed (); - if (reader.IsSigned ()) - return reader.ValueSigned; - if (reader.IsSigned64 ()) - return reader.ValueSigned64; - UnpackFailed (); - return 0; // unused - } - - internal static uint Unpack_Unsigned (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsUnsigned ()) - UnpackFailed (); - return reader.ValueUnsigned; - } - - internal static ulong Unpack_Unsigned64 (MsgPackReader reader) - { - if (!reader.Read ()) - UnpackFailed (); - if (reader.IsUnsigned ()) - return reader.ValueUnsigned; - if (reader.IsUnsigned64 ()) - return reader.ValueUnsigned64; - UnpackFailed (); - return 0; // unused - } - - internal static bool Unpack_Boolean (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsBoolean ()) - UnpackFailed (); - return reader.ValueBoolean; - } - - internal static float Unpack_Float (MsgPackReader reader) - { - if (!reader.Read () || reader.Type != TypePrefixes.Float) - UnpackFailed (); - return reader.ValueFloat; - } - - internal static double Unpack_Double (MsgPackReader reader) - { - if (!reader.Read () || reader.Type != TypePrefixes.Double) - UnpackFailed (); - return reader.ValueDouble; - } - - internal static string Unpack_String (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsRaw ()) - UnpackFailed (); - return reader.ReadRawString (); - } - - internal static void UnpackFailed () - { - throw new FormatException (); - } - #endregion - } - #endregion - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/CompiledPacker.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/CompiledPacker.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2489e1f0fe88948f68c318a7243e4f1f +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4aebcb603c9f6437eb1765bdeec80600 +folderAsset: yes +timeCreated: 1478444952 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/EmitExtensions.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/EmitExtensions.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Reflection; -using System.Reflection.Emit; - -namespace MsgPack.Compiler -{ - public static class EmitExtensions - { - public static void EmitLd (this ILGenerator il, Variable v) - { - switch (v.VarType) { - case VariableType.Arg: - EmitLdarg (il, v); - break; - case VariableType.Local: - EmitLdloc (il, v); - break; - default: - throw new ArgumentException (); - } - } - - public static void EmitLd (this ILGenerator il, params Variable[] list) - { - for (int i = 0; i < list.Length; i ++) - EmitLd (il, list[i]); - } - - public static void EmitLdarg (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Arg) - throw new ArgumentException (); - - switch (v.Index) { - case 0: il.Emit (OpCodes.Ldarg_0); return; - case 1: il.Emit (OpCodes.Ldarg_1); return; - case 2: il.Emit (OpCodes.Ldarg_2); return; - case 3: il.Emit (OpCodes.Ldarg_3); return; - } - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Ldarg_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Ldarg, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitLdloc (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Local) - throw new ArgumentException (); - - switch (v.Index) { - case 0: il.Emit (OpCodes.Ldloc_0); return; - case 1: il.Emit (OpCodes.Ldloc_1); return; - case 2: il.Emit (OpCodes.Ldloc_2); return; - case 3: il.Emit (OpCodes.Ldloc_3); return; - } - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Ldloc_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Ldloc, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitSt (this ILGenerator il, Variable v) - { - switch (v.VarType) { - case VariableType.Arg: - EmitStarg (il, v); - break; - case VariableType.Local: - EmitStloc (il, v); - break; - default: - throw new ArgumentException (); - } - } - - public static void EmitStarg (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Arg) - throw new ArgumentException (); - - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Starg_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Starg, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitStloc (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Local) - throw new ArgumentException (); - - switch (v.Index) { - case 0: il.Emit (OpCodes.Stloc_0); return; - case 1: il.Emit (OpCodes.Stloc_1); return; - case 2: il.Emit (OpCodes.Stloc_2); return; - case 3: il.Emit (OpCodes.Stloc_3); return; - } - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Stloc_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Stloc, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitLdc (this ILGenerator il, int v) - { - switch (v) { - case 0: il.Emit (OpCodes.Ldc_I4_0); return; - case 1: il.Emit (OpCodes.Ldc_I4_1); return; - case 2: il.Emit (OpCodes.Ldc_I4_2); return; - case 3: il.Emit (OpCodes.Ldc_I4_3); return; - case 4: il.Emit (OpCodes.Ldc_I4_4); return; - case 5: il.Emit (OpCodes.Ldc_I4_5); return; - case 6: il.Emit (OpCodes.Ldc_I4_6); return; - case 7: il.Emit (OpCodes.Ldc_I4_7); return; - case 8: il.Emit (OpCodes.Ldc_I4_8); return; - case -1: il.Emit (OpCodes.Ldc_I4_M1); return; - } - if (v <= sbyte.MaxValue && v >= sbyte.MinValue) { - il.Emit (OpCodes.Ldc_I4_S, (sbyte)v); - } else { - il.Emit (OpCodes.Ldc_I4, v); - } - } - - public static void EmitLd_False (this ILGenerator il) - { - il.Emit (OpCodes.Ldc_I4_1); - } - - public static void EmitLd_True (this ILGenerator il) - { - il.Emit (OpCodes.Ldc_I4_1); - } - - public static void EmitLdstr (this ILGenerator il, string v) - { - il.Emit (OpCodes.Ldstr, v); - } - - public static void EmitLdMember (this ILGenerator il, MemberInfo m) - { - if (m.MemberType == MemberTypes.Field) { - il.Emit (OpCodes.Ldfld, (FieldInfo)m); - } else if (m.MemberType == MemberTypes.Property) { - il.Emit (OpCodes.Callvirt, ((PropertyInfo)m).GetGetMethod (true)); - } else { - throw new ArgumentException (); - } - } - - public static void EmitStMember (this ILGenerator il, MemberInfo m) - { - if (m.MemberType == MemberTypes.Field) { - il.Emit (OpCodes.Stfld, (FieldInfo)m); - } else if (m.MemberType == MemberTypes.Property) { - il.Emit (OpCodes.Callvirt, ((PropertyInfo)m).GetSetMethod (true)); - } else { - throw new ArgumentException (); - } - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/EmitExtensions.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/EmitExtensions.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9f9260bb673cf40ed8b95fabad8a8ff0 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/PackILGenerator.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/PackILGenerator.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,386 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.Serialization; - -namespace MsgPack.Compiler -{ - static class PackILGenerator - { - #region Pack IL Generator - public static void EmitPackCode (Type type, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupPackMethod) - { - if (type.IsPrimitive || type.IsInterface) - throw new NotSupportedException (); - - Variable arg_writer = Variable.CreateArg (0); - Variable arg_obj = Variable.CreateArg (1); - Variable local_i = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - - if (!type.IsValueType) { // null check - Label notNullLabel = il.DefineLabel (); - il.EmitLd (arg_obj); - il.Emit (OpCodes.Brtrue_S, notNullLabel); - il.EmitLd (arg_writer); - il.Emit (OpCodes.Call, typeof(MsgPackWriter).GetMethod("WriteNil", new Type[0])); - il.Emit (OpCodes.Ret); - il.MarkLabel (notNullLabel); - } - - if (type.IsArray) { - EmitPackArrayCode (mi, il, type, arg_writer, arg_obj, local_i, lookupPackMethod); - goto FinallyProcess; - } - - // MsgPackWriter.WriteMapHeader - MemberInfo[] members = targetMemberSelector (type); - il.EmitLd (arg_writer); - il.EmitLdc (members.Length); - il.Emit (OpCodes.Callvirt, typeof (MsgPackWriter).GetMethod("WriteMapHeader", new Type[]{typeof (int)})); - - for (int i = 0; i < members.Length; i ++) { - MemberInfo m = members[i]; - Type mt = m.GetMemberType (); - - // write field-name - il.EmitLd (arg_writer); - il.EmitLdstr (memberNameFormatter (m)); - il.EmitLd_True (); - il.Emit (OpCodes.Call, typeof (MsgPackWriter).GetMethod("Write", new Type[]{typeof (string), typeof (bool)})); - - // write value - EmitPackMemberValueCode (mt, il, arg_writer, arg_obj, m, null, type, mi, lookupPackMethod); - } - -FinallyProcess: - il.Emit (OpCodes.Ret); - } - - static void EmitPackArrayCode (MethodInfo mi, ILGenerator il, Type t, Variable var_writer, Variable var_obj, Variable var_loop, Func lookupPackMethod) - { - Type et = t.GetElementType (); - il.EmitLd (var_writer, var_obj); - il.Emit (OpCodes.Ldlen); - il.Emit (OpCodes.Call, typeof(MsgPackWriter).GetMethod("WriteArrayHeader", new Type[]{ typeof(int) })); - - Label beginLabel = il.DefineLabel (); - Label exprLabel = il.DefineLabel (); - - // for-loop: init loop counter - il.EmitLdc (0); - il.EmitSt (var_loop); - - // jump - il.Emit (OpCodes.Br_S, exprLabel); - - // mark begin-label - il.MarkLabel (beginLabel); - - // write element - EmitPackMemberValueCode (et, il, var_writer, var_obj, null, var_loop, t, mi, lookupPackMethod); - - // increment loop-counter - il.EmitLd (var_loop); - il.Emit (OpCodes.Ldc_I4_1); - il.Emit (OpCodes.Add); - il.EmitSt (var_loop); - - // mark expression label - il.MarkLabel (exprLabel); - - // expression - il.EmitLd (var_loop, var_obj); - il.Emit (OpCodes.Ldlen); - il.Emit (OpCodes.Blt_S, beginLabel); - } - - /// (optional) - /// (optional) - static void EmitPackMemberValueCode (Type type, ILGenerator il, Variable var_writer, Variable var_obj, - MemberInfo m, Variable elementIdx, Type currentType, MethodInfo currentMethod, Func lookupPackMethod) - { - MethodInfo mi; - il.EmitLd (var_writer, var_obj); - if (m != null) - il.EmitLdMember (m); - if (elementIdx != null) { - il.EmitLd (elementIdx); - il.Emit (OpCodes.Ldelem, type); - } - if (type.IsPrimitive) { - mi = typeof(MsgPackWriter).GetMethod("Write", new Type[]{type}); - } else { - if (currentType == type) { - mi = currentMethod; - } else { - mi = lookupPackMethod (type); - } - } - il.Emit (OpCodes.Call, mi); - } - #endregion - - #region Unpack IL Generator - public static void EmitUnpackCode (Type type, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupUnpackMethod, - Func> lookupMemberMapping, - MethodInfo lookupMemberMappingMethod) - { - if (type.IsArray) { - EmitUnpackArrayCode (type, mi, il, targetMemberSelector, memberNameFormatter, lookupUnpackMethod); - } else { - EmitUnpackMapCode (type, mi, il, targetMemberSelector, memberNameFormatter, lookupUnpackMethod, lookupMemberMapping, lookupMemberMappingMethod); - } - } - - static void EmitUnpackMapCode (Type type, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupUnpackMethod, - Func> lookupMemberMapping, - MethodInfo lookupMemberMappingMethod) - { - MethodInfo failedMethod = typeof (PackILGenerator).GetMethod ("UnpackFailed", BindingFlags.Static | BindingFlags.NonPublic); - MemberInfo[] members = targetMemberSelector (type); - IDictionary member_mapping = lookupMemberMapping (type); - for (int i = 0; i < members.Length; i ++) - member_mapping.Add (memberNameFormatter (members[i]), i); - - Variable msgpackReader = Variable.CreateArg (0); - Variable obj = Variable.CreateLocal (il.DeclareLocal (type)); - Variable num_of_fields = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable loop_idx = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable mapping = Variable.CreateLocal (il.DeclareLocal (typeof (IDictionary))); - Variable switch_idx = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable var_type = Variable.CreateLocal (il.DeclareLocal (typeof (Type))); - - // if (!MsgPackReader.Read()) UnpackFailed (); - // if (MsgPackReader.Type == TypePrefixes.Nil) return null; - // if (!MsgPackReader.IsMap ()) UnpackFailed (); - EmitUnpackReadAndTypeCheckCode (il, msgpackReader, typeof (MsgPackReader).GetMethod ("IsMap"), failedMethod, true); - - // type = typeof (T) - il.Emit (OpCodes.Ldtoken, type); - il.Emit (OpCodes.Call, typeof(Type).GetMethod ("GetTypeFromHandle")); - il.EmitSt (var_type); - - // mapping = LookupMemberMapping (typeof (T)) - il.EmitLd (var_type); - il.Emit (OpCodes.Call, lookupMemberMappingMethod); - il.EmitSt (mapping); - - // object o = FormatterServices.GetUninitializedObject (Type); - il.EmitLd (var_type); - il.Emit (OpCodes.Call, typeof (FormatterServices).GetMethod ("GetUninitializedObject")); - il.Emit (OpCodes.Castclass, type); - il.EmitSt (obj); - - // num_of_fields = (int)reader.Length - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetProperty ("Length").GetGetMethod ()); - il.EmitSt (num_of_fields); - - // Loop labels - Label lblLoopStart = il.DefineLabel (); - Label lblLoopExpr = il.DefineLabel (); - - // i = 0; - il.EmitLdc (0); - il.EmitSt (loop_idx); - il.Emit (OpCodes.Br, lblLoopExpr); - il.MarkLabel (lblLoopStart); - - /* process */ - // if (!MsgPackReader.Read() || !MsgPackReader.IsRaw()) UnpackFailed(); - EmitUnpackReadAndTypeCheckCode (il, msgpackReader, typeof (MsgPackReader).GetMethod ("IsRaw"), failedMethod, false); - - // MsgPackReader.ReadRawString () - // if (!Dictionary.TryGetValue (,)) UnpackFailed(); - Label lbl3 = il.DefineLabel (); - il.EmitLd (mapping); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetMethod ("ReadRawString", new Type[0])); - il.Emit (OpCodes.Ldloca_S, (byte)switch_idx.Index); - il.Emit (OpCodes.Callvirt, typeof (IDictionary).GetMethod ("TryGetValue")); - il.Emit (OpCodes.Brtrue, lbl3); - il.Emit (OpCodes.Call, failedMethod); - il.MarkLabel (lbl3); - - // switch - Label[] switchCases = new Label[members.Length]; - for (int i = 0; i < switchCases.Length; i ++) - switchCases[i] = il.DefineLabel (); - Label switchCaseEndLabel = il.DefineLabel (); - il.EmitLd (switch_idx); - il.Emit (OpCodes.Switch, switchCases); - il.Emit (OpCodes.Call, failedMethod); - - for (int i = 0; i < switchCases.Length; i ++) { - il.MarkLabel (switchCases[i]); - MemberInfo minfo = members[i]; - Type mt = minfo.GetMemberType (); - MethodInfo unpack_method = lookupUnpackMethod (mt); - il.EmitLd (obj); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, unpack_method); - il.EmitStMember (minfo); - il.Emit (OpCodes.Br, switchCaseEndLabel); - } - il.MarkLabel (switchCaseEndLabel); - - // i ++ - il.EmitLd (loop_idx); - il.EmitLdc (1); - il.Emit (OpCodes.Add); - il.EmitSt (loop_idx); - - // i < num_of_fields; - il.MarkLabel (lblLoopExpr); - il.EmitLd (loop_idx); - il.EmitLd (num_of_fields); - il.Emit (OpCodes.Blt, lblLoopStart); - - // return - il.EmitLd (obj); - il.Emit (OpCodes.Ret); - } - - static void EmitUnpackArrayCode (Type arrayType, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupUnpackMethod) - { - Type elementType = arrayType.GetElementType (); - MethodInfo failedMethod = typeof (PackILGenerator).GetMethod ("UnpackFailed", BindingFlags.Static | BindingFlags.NonPublic); - - Variable msgpackReader = Variable.CreateArg (0); - Variable obj = Variable.CreateLocal (il.DeclareLocal (arrayType)); - Variable num_of_elements = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable loop_idx = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable type = Variable.CreateLocal (il.DeclareLocal (typeof (Type))); - - // if (!MsgPackReader.Read() || !MsgPackReader.IsArray ()) UnpackFailed (); - EmitUnpackReadAndTypeCheckCode (il, msgpackReader, typeof (MsgPackReader).GetMethod ("IsArray"), failedMethod, true); - - // type = typeof (T) - il.Emit (OpCodes.Ldtoken, elementType); - il.Emit (OpCodes.Call, typeof(Type).GetMethod ("GetTypeFromHandle")); - il.EmitSt (type); - - // num_of_elements = (int)reader.Length - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetProperty ("Length").GetGetMethod ()); - il.EmitSt (num_of_elements); - - // object o = Array.CreateInstance (Type, Length); - il.EmitLd (type); - il.EmitLd (num_of_elements); - il.Emit (OpCodes.Call, typeof (Array).GetMethod ("CreateInstance", new Type[] {typeof (Type), typeof (int)})); - il.Emit (OpCodes.Castclass, arrayType); - il.EmitSt (obj); - - // Unpack element method - MethodInfo unpack_method = lookupUnpackMethod (elementType); - - // Loop labels - Label lblLoopStart = il.DefineLabel (); - Label lblLoopExpr = il.DefineLabel (); - - // i = 0; - il.EmitLdc (0); - il.EmitSt (loop_idx); - il.Emit (OpCodes.Br, lblLoopExpr); - il.MarkLabel (lblLoopStart); - - /* process */ - il.EmitLd (obj, loop_idx); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, unpack_method); - il.Emit (OpCodes.Stelem, elementType); - - // i ++ - il.EmitLd (loop_idx); - il.EmitLdc (1); - il.Emit (OpCodes.Add); - il.EmitSt (loop_idx); - - // i < num_of_fields; - il.MarkLabel (lblLoopExpr); - il.EmitLd (loop_idx); - il.EmitLd (num_of_elements); - il.Emit (OpCodes.Blt, lblLoopStart); - - // return - il.EmitLd (obj); - il.Emit (OpCodes.Ret); - } - - static void EmitUnpackReadAndTypeCheckCode (ILGenerator il, Variable msgpackReader, MethodInfo typeCheckMethod, MethodInfo failedMethod, bool nullCheckAndReturn) - { - Label lblFailed = il.DefineLabel (); - Label lblNullReturn = nullCheckAndReturn ? il.DefineLabel () : default(Label); - Label lblPassed = il.DefineLabel (); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetMethod ("Read")); - il.Emit (OpCodes.Brfalse_S, lblFailed); - if (nullCheckAndReturn) { - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetProperty ("Type").GetGetMethod ()); - il.EmitLdc ((int)TypePrefixes.Nil); - il.Emit (OpCodes.Beq_S, lblNullReturn); - } - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeCheckMethod); - il.Emit (OpCodes.Brtrue_S, lblPassed); - il.Emit (OpCodes.Br, lblFailed); - if (nullCheckAndReturn) { - il.MarkLabel (lblNullReturn); - il.Emit (OpCodes.Ldnull); - il.Emit (OpCodes.Ret); - } - il.MarkLabel (lblFailed); - il.Emit (OpCodes.Call, failedMethod); - il.MarkLabel (lblPassed); - } - - /// Exception Helper - internal static void UnpackFailed () - { - throw new FormatException (); - } - #endregion - - #region Misc - static Type GetMemberType (this MemberInfo mi) - { - if (mi.MemberType == MemberTypes.Field) - return ((FieldInfo)mi).FieldType; - if (mi.MemberType == MemberTypes.Property) - return ((PropertyInfo)mi).PropertyType; - throw new ArgumentException (); - } - #endregion - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/PackILGenerator.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/PackILGenerator.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: af772018a5b3a4615b2cad8f00ca82b4 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/Variable.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/Variable.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System.Reflection.Emit; - -namespace MsgPack.Compiler -{ - public class Variable - { - Variable (VariableType type, int index) - { - this.VarType = type; - this.Index = index; - } - - public static Variable CreateLocal (LocalBuilder local) - { - return new Variable (VariableType.Local, local.LocalIndex); - } - - public static Variable CreateArg (int idx) - { - return new Variable (VariableType.Arg, idx); - } - - public VariableType VarType { get; set; } - public int Index { get; set; } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/Variable.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/Variable.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ced0fabe4b5ab4c4594479d5c8887bf1 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/VariableType.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/VariableType.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace MsgPack.Compiler -{ - public enum VariableType - { - Local, - Arg - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/VariableType.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/Compiler/VariableType.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bc80d58aaa20b45c184727fcd925849a +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackReader.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackReader.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.IO; -using System.Text; - -namespace MsgPack -{ - public class MsgPackReader - { - Stream _strm; - byte[] _tmp0 = new byte[8]; - byte[] _tmp1 = new byte[8]; - - Encoding _encoding = Encoding.UTF8; - //Decoder _decoder = Encoding.UTF8.GetDecoder (); - byte[] _buf = new byte[64]; - - public MsgPackReader (Stream strm) - { - _strm = strm; - } - - public TypePrefixes Type { get; private set; } - - public bool ValueBoolean { get; private set; } - public uint Length { get; private set; } - - public uint ValueUnsigned { get; private set; } - public ulong ValueUnsigned64 { get; private set; } - - public int ValueSigned { get; private set; } - public long ValueSigned64 { get; private set; } - - public float ValueFloat { get; private set; } - public double ValueDouble { get; private set; } - - public bool IsSigned () - { - return this.Type == TypePrefixes.NegativeFixNum || - this.Type == TypePrefixes.PositiveFixNum || - this.Type == TypePrefixes.Int8 || - this.Type == TypePrefixes.Int16 || - this.Type == TypePrefixes.Int32; - } - - public bool IsBoolean () - { - return this.Type == TypePrefixes.True || this.Type == TypePrefixes.False; - } - - public bool IsSigned64 () - { - return this.Type == TypePrefixes.Int64; - } - - public bool IsUnsigned () - { - return this.Type == TypePrefixes.PositiveFixNum || - this.Type == TypePrefixes.UInt8 || - this.Type == TypePrefixes.UInt16 || - this.Type == TypePrefixes.UInt32; - } - - public bool IsUnsigned64 () - { - return this.Type == TypePrefixes.UInt64; - } - - public bool IsRaw () - { - return this.Type == TypePrefixes.FixRaw || this.Type == TypePrefixes.Raw16 || this.Type == TypePrefixes.Raw32; - } - - public bool IsArray () - { - return this.Type == TypePrefixes.FixArray || this.Type == TypePrefixes.Array16 || this.Type == TypePrefixes.Array32; - } - - public bool IsMap () - { - return this.Type == TypePrefixes.FixMap || this.Type == TypePrefixes.Map16 || this.Type == TypePrefixes.Map32; - } - - public bool Read () - { - byte[] tmp0 = _tmp0, tmp1 = _tmp1; - int x = _strm.ReadByte (); - if (x < 0) - return false; // EOS - - if (x >= 0x00 && x <= 0x7f) { - this.Type = TypePrefixes.PositiveFixNum; - } else if (x >= 0xe0 && x <= 0xff) { - this.Type = TypePrefixes.NegativeFixNum; - } else if (x >= 0xa0 && x <= 0xbf) { - this.Type = TypePrefixes.FixRaw; - } else if (x >= 0x90 && x <= 0x9f) { - this.Type = TypePrefixes.FixArray; - } else if (x >= 0x80 && x <= 0x8f) { - this.Type = TypePrefixes.FixMap; - } else { - this.Type = (TypePrefixes)x; - } - - switch (this.Type) { - case TypePrefixes.Nil: - break; - case TypePrefixes.False: - ValueBoolean = false; - break; - case TypePrefixes.True: - ValueBoolean = true; - break; - case TypePrefixes.Float: - _strm.Read (tmp0, 0, 4); - if (BitConverter.IsLittleEndian) { - tmp1[0] = tmp0[3]; - tmp1[1] = tmp0[2]; - tmp1[2] = tmp0[1]; - tmp1[3] = tmp0[0]; - ValueFloat = BitConverter.ToSingle (tmp1, 0); - } else { - ValueFloat = BitConverter.ToSingle (tmp0, 0); - } - break; - case TypePrefixes.Double: - _strm.Read (tmp0, 0, 8); - if (BitConverter.IsLittleEndian) { - tmp1[0] = tmp0[7]; - tmp1[1] = tmp0[6]; - tmp1[2] = tmp0[5]; - tmp1[3] = tmp0[4]; - tmp1[4] = tmp0[3]; - tmp1[5] = tmp0[2]; - tmp1[6] = tmp0[1]; - tmp1[7] = tmp0[0]; - ValueDouble = BitConverter.ToDouble (tmp1, 0); - } else { - ValueDouble = BitConverter.ToDouble (tmp0, 0); - } - break; - case TypePrefixes.NegativeFixNum: - ValueSigned = (x & 0x1f) - 0x20; - break; - case TypePrefixes.PositiveFixNum: - ValueSigned = x & 0x7f; - ValueUnsigned = (uint)ValueSigned; - break; - case TypePrefixes.UInt8: - x = _strm.ReadByte (); - if (x < 0) - throw new FormatException (); - ValueUnsigned = (uint)x; - break; - case TypePrefixes.UInt16: - if (_strm.Read (tmp0, 0, 2) != 2) - throw new FormatException (); - ValueUnsigned = ((uint)tmp0[0] << 8) | (uint)tmp0[1]; - break; - case TypePrefixes.UInt32: - if (_strm.Read (tmp0, 0, 4) != 4) - throw new FormatException (); - ValueUnsigned = ((uint)tmp0[0] << 24) | ((uint)tmp0[1] << 16) | ((uint)tmp0[2] << 8) | (uint)tmp0[3]; - break; - case TypePrefixes.UInt64: - if (_strm.Read (tmp0, 0, 8) != 8) - throw new FormatException (); - ValueUnsigned64 = ((ulong)tmp0[0] << 56) | ((ulong)tmp0[1] << 48) | ((ulong)tmp0[2] << 40) | ((ulong)tmp0[3] << 32) | ((ulong)tmp0[4] << 24) | ((ulong)tmp0[5] << 16) | ((ulong)tmp0[6] << 8) | (ulong)tmp0[7]; - break; - case TypePrefixes.Int8: - x = _strm.ReadByte (); - if (x < 0) - throw new FormatException (); - ValueSigned = (sbyte)x; - break; - case TypePrefixes.Int16: - if (_strm.Read (tmp0, 0, 2) != 2) - throw new FormatException (); - ValueSigned = (short)((tmp0[0] << 8) | tmp0[1]); - break; - case TypePrefixes.Int32: - if (_strm.Read (tmp0, 0, 4) != 4) - throw new FormatException (); - ValueSigned = (tmp0[0] << 24) | (tmp0[1] << 16) | (tmp0[2] << 8) | tmp0[3]; - break; - case TypePrefixes.Int64: - if (_strm.Read (tmp0, 0, 8) != 8) - throw new FormatException (); - ValueSigned64 = ((long)tmp0[0] << 56) | ((long)tmp0[1] << 48) | ((long)tmp0[2] << 40) | ((long)tmp0[3] << 32) | ((long)tmp0[4] << 24) | ((long)tmp0[5] << 16) | ((long)tmp0[6] << 8) | (long)tmp0[7]; - break; - case TypePrefixes.FixRaw: - Length = (uint)(x & 0x1f); - break; - case TypePrefixes.FixArray: - case TypePrefixes.FixMap: - Length = (uint)(x & 0xf); - break; - case TypePrefixes.Raw16: - case TypePrefixes.Array16: - case TypePrefixes.Map16: - if (_strm.Read (tmp0, 0, 2) != 2) - throw new FormatException (); - Length = ((uint)tmp0[0] << 8) | (uint)tmp0[1]; - break; - case TypePrefixes.Raw32: - case TypePrefixes.Array32: - case TypePrefixes.Map32: - if (_strm.Read (tmp0, 0, 4) != 4) - throw new FormatException (); - Length = ((uint)tmp0[0] << 24) | ((uint)tmp0[1] << 16) | ((uint)tmp0[2] << 8) | (uint)tmp0[3]; - break; - default: - throw new FormatException (); - } - return true; - } - - public int ReadValueRaw (byte[] buf, int offset, int count) - { - return _strm.Read (buf, offset, count); - } - - public string ReadRawString () - { - return ReadRawString (_buf); - } - - public string ReadRawString (byte[] buf) - { - if (this.Length < buf.Length) { - if (ReadValueRaw (buf, 0, (int)this.Length) != this.Length) - throw new FormatException (); - return _encoding.GetString (buf, 0, (int)this.Length); - } - - // Poor implementation - byte[] tmp = new byte[(int)this.Length]; - if (ReadValueRaw (tmp, 0, tmp.Length) != tmp.Length) - throw new FormatException (); - return _encoding.GetString (tmp); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackReader.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackReader.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 19509e7fa3e404e259a3f2caa6cc425f +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackWriter.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackWriter.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,321 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa, Kazunari Kida -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.IO; -using System.Text; - -namespace MsgPack -{ - public class MsgPackWriter - { - Stream _strm; - //Encoding _encoding = Encoding.UTF8; - Encoder _encoder = Encoding.UTF8.GetEncoder (); - byte[] _tmp = new byte[9]; - byte[] _buf = new byte[64]; - - public MsgPackWriter (Stream strm) - { - _strm = strm; - } - - public void Write (byte x) - { - if (x < 128) { - _strm.WriteByte (x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xcc; - tmp[1] = x; - _strm.Write (tmp, 0, 2); - } - } - - public void Write (ushort x) - { - if (x < 0x100) { - Write ((byte)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xcd; - tmp[1] = (byte)(x >> 8); - tmp[2] = (byte)x; - _strm.Write (tmp, 0, 3); - } - } - - public void Write (char x) - { - Write ((ushort)x); - } - - public void Write (uint x) - { - if (x < 0x10000) { - Write ((ushort)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xce; - tmp[1] = (byte)(x >> 24); - tmp[2] = (byte)(x >> 16); - tmp[3] = (byte)(x >> 8); - tmp[4] = (byte)x; - _strm.Write (tmp, 0, 5); - } - } - - public void Write (ulong x) - { - if (x < 0x100000000) { - Write ((uint)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xcf; - tmp[1] = (byte)(x >> 56); - tmp[2] = (byte)(x >> 48); - tmp[3] = (byte)(x >> 40); - tmp[4] = (byte)(x >> 32); - tmp[5] = (byte)(x >> 24); - tmp[6] = (byte)(x >> 16); - tmp[7] = (byte)(x >> 8); - tmp[8] = (byte)x; - _strm.Write (tmp, 0, 9); - } - } - - public void Write (sbyte x) - { - if (x >= -32 && x <= -1) { - _strm.WriteByte ((byte)(0xe0 | (byte)x)); - } else if (x >= 0 && x <= 127) { - _strm.WriteByte ((byte)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd0; - tmp[1] = (byte)x; - _strm.Write (tmp, 0, 2); - } - } - - public void Write (short x) - { - if (x >= sbyte.MinValue && x <= sbyte.MaxValue) { - Write ((sbyte)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd1; - tmp[1] = (byte)(x >> 8); - tmp[2] = (byte)x; - _strm.Write (tmp, 0, 3); - } - } - - public void Write (int x) - { - if (x >= short.MinValue && x <= short.MaxValue) { - Write ((short)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd2; - tmp[1] = (byte)(x >> 24); - tmp[2] = (byte)(x >> 16); - tmp[3] = (byte)(x >> 8); - tmp[4] = (byte)x; - _strm.Write (tmp, 0, 5); - } - } - - public void Write (long x) - { - if (x >= int.MinValue && x <= int.MaxValue) { - Write ((int)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd3; - tmp[1] = (byte)(x >> 56); - tmp[2] = (byte)(x >> 48); - tmp[3] = (byte)(x >> 40); - tmp[4] = (byte)(x >> 32); - tmp[5] = (byte)(x >> 24); - tmp[6] = (byte)(x >> 16); - tmp[7] = (byte)(x >> 8); - tmp[8] = (byte)x; - _strm.Write (tmp, 0, 9); - } - } - - public void WriteNil () - { - _strm.WriteByte (0xc0); - } - - public void Write (bool x) - { - _strm.WriteByte ((byte)(x ? 0xc3 : 0xc2)); - } - - public void Write (float x) - { - byte[] raw = BitConverter.GetBytes (x); // unsafeコードを使う? - byte[] tmp = _tmp; - - tmp[0] = 0xca; - if (BitConverter.IsLittleEndian) { - tmp[1] = raw[3]; - tmp[2] = raw[2]; - tmp[3] = raw[1]; - tmp[4] = raw[0]; - } else { - tmp[1] = raw[0]; - tmp[2] = raw[1]; - tmp[3] = raw[2]; - tmp[4] = raw[3]; - } - _strm.Write (tmp, 0, 5); - } - - public void Write (double x) - { - byte[] raw = BitConverter.GetBytes (x); // unsafeコードを使う? - byte[] tmp = _tmp; - - tmp[0] = 0xcb; - if (BitConverter.IsLittleEndian) { - tmp[1] = raw[7]; - tmp[2] = raw[6]; - tmp[3] = raw[5]; - tmp[4] = raw[4]; - tmp[5] = raw[3]; - tmp[6] = raw[2]; - tmp[7] = raw[1]; - tmp[8] = raw[0]; - } else { - tmp[1] = raw[0]; - tmp[2] = raw[1]; - tmp[3] = raw[2]; - tmp[4] = raw[3]; - tmp[5] = raw[4]; - tmp[6] = raw[5]; - tmp[7] = raw[6]; - tmp[8] = raw[7]; - } - _strm.Write (tmp, 0, 9); - } - - public void Write (byte[] bytes) - { - WriteRawHeader (bytes.Length); - _strm.Write (bytes, 0, bytes.Length); - } - - public void WriteRawHeader (int N) - { - WriteLengthHeader (N, 32, 0xa0, 0xda, 0xdb); - } - - public void WriteArrayHeader (int N) - { - WriteLengthHeader (N, 16, 0x90, 0xdc, 0xdd); - } - - public void WriteMapHeader (int N) - { - WriteLengthHeader (N, 16, 0x80, 0xde, 0xdf); - } - - void WriteLengthHeader (int N, int fix_length, byte fix_prefix, byte len16bit_prefix, byte len32bit_prefix) - { - if (N < fix_length) { - _strm.WriteByte ((byte)(fix_prefix | N)); - } else { - byte[] tmp = _tmp; - int header_len; - if (N < 0x10000) { - tmp[0] = len16bit_prefix; - tmp[1] = (byte)(N >> 8); - tmp[2] = (byte)N; - header_len = 3; - } else { - tmp[0] = len32bit_prefix; - tmp[1] = (byte)(N >> 24); - tmp[2] = (byte)(N >> 16); - tmp[3] = (byte)(N >> 8); - tmp[4] = (byte)N; - header_len = 5; - } - _strm.Write (tmp, 0, header_len); - } - } - - public void Write (string x) - { - Write (x, false); - } - - public void Write (string x, bool highProbAscii) - { - Write (x, _buf, highProbAscii); - } - - public void Write (string x, byte[] buf) - { - Write (x, buf, false); - } - - public void Write (string x, byte[] buf, bool highProbAscii) - { - Encoder encoder = _encoder; - //fixed (char *pstr = x) - //fixed (byte *pbuf = buf) { - char[] str = x.ToCharArray(); - if (highProbAscii && x.Length <= buf.Length) { - bool isAsciiFullCompatible = true; - for (int i = 0; i < x.Length; i ++) { - //int v = (int)pstr[i]; - int v = (int)(x[i]); - if (v > 0x7f) { - isAsciiFullCompatible = false; - break; - } - buf[i] = (byte)v; - } - if (isAsciiFullCompatible) { - WriteRawHeader (x.Length); - _strm.Write (buf, 0, x.Length); - return; - } - } - - //WriteRawHeader (encoder.GetByteCount (pstr, x.Length, true)); - WriteRawHeader (encoder.GetByteCount (str, 0, x.Length, true)); - int str_len = x.Length; - //char *p = pstr; - int convertedChars, bytesUsed; - bool completed = true; - int j = 0; - while (str_len > 0 || !completed) { - //encoder.Convert (p, str_len, pbuf, buf.Length, false, out convertedChars, out bytesUsed, out completed); - encoder.Convert (str, j, str_len, buf, 0, buf.Length, false, out convertedChars, out bytesUsed, out completed); - _strm.Write (buf, 0, bytesUsed); - str_len -= convertedChars; - //p += convertedChars; - j += convertedChars; - } - //} - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackWriter.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/MsgPackWriter.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3012f618b0d0d4edbbc46ed4bf751bf8 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ObjectPacker.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ObjectPacker.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,259 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Runtime.Serialization; -using System.Text; - -namespace MsgPack -{ - public class ObjectPacker - { - byte[] _buf = new byte[64]; - //Encoding _encoding = Encoding.UTF8; - static Dictionary PackerMapping; - static Dictionary UnpackerMapping; - - delegate void PackDelegate (ObjectPacker packer, MsgPackWriter writer, object o); - delegate object UnpackDelegate (ObjectPacker packer, MsgPackReader reader); - - static ObjectPacker () - { - PackerMapping = new Dictionary (); - UnpackerMapping = new Dictionary (); - - PackerMapping.Add (typeof (string), StringPacker); - UnpackerMapping.Add (typeof (string), StringUnpacker); - } - - public byte[] Pack (object o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - public void Pack (Stream strm, object o) - { - if (o != null && o.GetType ().IsPrimitive) - throw new NotSupportedException (); - MsgPackWriter writer = new MsgPackWriter (strm); - Pack (writer, o); - } - - void Pack (MsgPackWriter writer, object o) - { - if (o == null) { - writer.WriteNil (); - return; - } - - Type t = o.GetType (); - if (t.IsPrimitive) { - if (t.Equals (typeof (int))) writer.Write ((int)o); - else if (t.Equals (typeof (uint))) writer.Write ((uint)o); - else if (t.Equals (typeof (float))) writer.Write ((float)o); - else if (t.Equals (typeof (double))) writer.Write ((double)o); - else if (t.Equals (typeof (long))) writer.Write ((long)o); - else if (t.Equals (typeof (ulong))) writer.Write ((ulong)o); - else if (t.Equals (typeof (bool))) writer.Write ((bool)o); - else if (t.Equals (typeof (byte))) writer.Write ((byte)o); - else if (t.Equals (typeof (sbyte))) writer.Write ((sbyte)o); - else if (t.Equals (typeof (short))) writer.Write ((short)o); - else if (t.Equals (typeof (ushort))) writer.Write ((ushort)o); - else if (t.Equals (typeof (char))) writer.Write ((ushort)(char)o); - else throw new NotSupportedException (); - return; - } - - PackDelegate packer; - if (PackerMapping.TryGetValue (t, out packer)) { - packer (this, writer, o); - return; - } - - if (t.IsArray) { - Array ary = (Array)o; - writer.WriteArrayHeader (ary.Length); - for (int i = 0; i < ary.Length; i ++) - Pack (writer, ary.GetValue (i)); - return; - } - - ReflectionCacheEntry entry = ReflectionCache.Lookup (t); - writer.WriteMapHeader (entry.FieldMap.Count); - foreach (KeyValuePair pair in entry.FieldMap) { - writer.Write (pair.Key, _buf); - object v = pair.Value.GetValue (o); - if (pair.Value.FieldType.IsInterface && v != null) { - writer.WriteArrayHeader (2); - writer.Write (v.GetType().FullName); - } - Pack (writer, v); - } - } - - public T Unpack (byte[] buf) - { - return Unpack (buf, 0, buf.Length); - } - - public T Unpack (byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (ms); - } - } - - public T Unpack (Stream strm) - { - if (typeof (T).IsPrimitive) - throw new NotSupportedException (); - MsgPackReader reader = new MsgPackReader (strm); - return (T)Unpack (reader, typeof (T)); - } - - public object Unpack (Type type, byte[] buf) - { - return Unpack (type, buf, 0, buf.Length); - } - - public object Unpack (Type type, byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (type, ms); - } - } - - public object Unpack (Type type, Stream strm) - { - if (type.IsPrimitive) - throw new NotSupportedException (); - MsgPackReader reader = new MsgPackReader (strm); - return Unpack (reader, type); - } - - object Unpack (MsgPackReader reader, Type t) - { - if (t.IsPrimitive) { - if (!reader.Read ()) throw new FormatException (); - if (t.Equals (typeof (int)) && reader.IsSigned ()) return reader.ValueSigned; - else if (t.Equals (typeof (uint)) && reader.IsUnsigned ()) return reader.ValueUnsigned; - else if (t.Equals (typeof (float)) && reader.Type == TypePrefixes.Float) return reader.ValueFloat; - else if (t.Equals (typeof (double)) && reader.Type == TypePrefixes.Double) return reader.ValueDouble; - else if (t.Equals (typeof (long))) { - if (reader.IsSigned64 ()) - return reader.ValueSigned64; - if (reader.IsSigned ()) - return (long)reader.ValueSigned; - } else if (t.Equals (typeof (ulong))) { - if (reader.IsUnsigned64 ()) - return reader.ValueUnsigned64; - if (reader.IsUnsigned ()) - return (ulong)reader.ValueUnsigned; - } else if (t.Equals (typeof (bool)) && reader.IsBoolean ()) return (reader.Type == TypePrefixes.True); - else if (t.Equals (typeof (byte)) && reader.IsUnsigned ()) return (byte)reader.ValueUnsigned; - else if (t.Equals (typeof (sbyte)) && reader.IsSigned ()) return (sbyte)reader.ValueSigned; - else if (t.Equals (typeof (short)) && reader.IsSigned ()) return (short)reader.ValueSigned; - else if (t.Equals (typeof (ushort)) && reader.IsUnsigned ()) return (ushort)reader.ValueUnsigned; - else if (t.Equals (typeof (char)) && reader.IsUnsigned ()) return (char)reader.ValueUnsigned; - else throw new NotSupportedException (); - } - - UnpackDelegate unpacker; - if (UnpackerMapping.TryGetValue (t, out unpacker)) - return unpacker (this, reader); - - if (t.IsArray) { - if (!reader.Read () || (!reader.IsArray () && reader.Type != TypePrefixes.Nil)) - throw new FormatException (); - if (reader.Type == TypePrefixes.Nil) - return null; - Type et = t.GetElementType (); - Array ary = Array.CreateInstance (et, (int)reader.Length); - for (int i = 0; i < ary.Length; i ++) - ary.SetValue (Unpack (reader, et), i); - return ary; - } - - if (!reader.Read ()) - throw new FormatException (); - if (reader.Type == TypePrefixes.Nil) - return null; - if (t.IsInterface) { - if (reader.Type != TypePrefixes.FixArray && reader.Length != 2) - throw new FormatException (); - if (!reader.Read () || !reader.IsRaw ()) - throw new FormatException (); - CheckBufferSize ((int)reader.Length); - reader.ReadValueRaw (_buf, 0, (int)reader.Length); - t = Type.GetType (Encoding.UTF8.GetString (_buf, 0, (int)reader.Length)); - if (!reader.Read () || reader.Type == TypePrefixes.Nil) - throw new FormatException (); - } - if (!reader.IsMap ()) - throw new FormatException (); - - object o = FormatterServices.GetUninitializedObject (t); - ReflectionCacheEntry entry = ReflectionCache.Lookup (t); - int members = (int)reader.Length; - for (int i = 0; i < members; i ++) { - if (!reader.Read () || !reader.IsRaw ()) - throw new FormatException (); - CheckBufferSize ((int)reader.Length); - reader.ReadValueRaw (_buf, 0, (int)reader.Length); - string name = Encoding.UTF8.GetString (_buf, 0, (int)reader.Length); - FieldInfo f; - if (!entry.FieldMap.TryGetValue (name, out f)) - throw new FormatException (); - f.SetValue (o, Unpack (reader, f.FieldType)); - } - - IDeserializationCallback callback = o as IDeserializationCallback; - if (callback != null) - callback.OnDeserialization (this); - return o; - } - - void CheckBufferSize (int size) - { - if (_buf.Length < size) - Array.Resize (ref _buf, size); - } - - static void StringPacker (ObjectPacker packer, MsgPackWriter writer, object o) - { - writer.Write (Encoding.UTF8.GetBytes ((string)o)); - } - - static object StringUnpacker (ObjectPacker packer, MsgPackReader reader) - { - if (!reader.Read ()) - throw new FormatException (); - if (reader.Type == TypePrefixes.Nil) - return null; - if (!reader.IsRaw ()) - throw new FormatException (); - packer.CheckBufferSize ((int)reader.Length); - reader.ReadValueRaw (packer._buf, 0, (int)reader.Length); - return Encoding.UTF8.GetString (packer._buf, 0, (int)reader.Length); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ObjectPacker.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ObjectPacker.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fcb2e3d8ff69d4778b35d6ed3e24e8d1 +timeCreated: 1478444958 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCache.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCache.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; - -namespace MsgPack -{ - public static class ReflectionCache - { - static Dictionary _cache; - - static ReflectionCache () - { - _cache = new Dictionary (); - } - - public static ReflectionCacheEntry Lookup (Type type) - { - ReflectionCacheEntry entry; - lock (_cache) { - if (_cache.TryGetValue (type, out entry)) - return entry; - } - - entry = new ReflectionCacheEntry (type); - lock (_cache) { - _cache[type] = entry; - } - return entry; - } - - public static void RemoveCache (Type type) - { - lock (_cache) { - _cache.Remove (type); - } - } - - public static void Clear () - { - lock (_cache) { - _cache.Clear (); - } - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCache.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCache.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1fdfaba421a794386b2c288f7d1463b6 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCacheEntry.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCacheEntry.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace MsgPack -{ - public class ReflectionCacheEntry - { - const BindingFlags FieldBindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField | BindingFlags.SetField; - - public ReflectionCacheEntry (Type t) - { - FieldInfo[] fields = t.GetFields (FieldBindingFlags); - IDictionary map = new Dictionary (fields.Length); - for (int i = 0; i < fields.Length; i ++) { - FieldInfo f = fields[i]; - string name = f.Name; - int pos; - if (name[0] == '<' && (pos = name.IndexOf ('>')) > 1) - name = name.Substring (1, pos - 1); // Auto-Property (\<.+\>) - map[name] = f; - } - FieldMap = map; - } - - public IDictionary FieldMap { get; private set; } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCacheEntry.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/ReflectionCacheEntry.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4628deba178dd4964aac2d1eb3e6f743 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/TypePrefixes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/TypePrefixes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace MsgPack -{ - public enum TypePrefixes : byte - { - PositiveFixNum = 0x00, // 0x00 - 0x7f - NegativeFixNum = 0xe0, // 0xe0 - 0xff - - Nil = 0xc0, - False = 0xc2, - True = 0xc3, - Float = 0xca, - Double = 0xcb, - UInt8 = 0xcc, - UInt16 = 0xcd, - UInt32 = 0xce, - UInt64 = 0xcf, - Int8 = 0xd0, - Int16 = 0xd1, - Int32 = 0xd2, - Int64 = 0xd3, - Raw16 = 0xda, - Raw32 = 0xdb, - Array16 = 0xdc, - Array32 = 0xdd, - Map16 = 0xde, - Map32 = 0xdf, - - FixRaw = 0xa0, // 0xa0 - 0xbf - FixArray = 0x90, // 0x90 - 0x9f - FixMap = 0x80, // 0x80 - 0x8f - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/TypePrefixes.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/persistent/msgpack/src/TypePrefixes.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2bc3d47c483e34d4690370c6e721bcd1 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 38c4ef21fdc324b0481da30123d77e23 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 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 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -public enum Command{ - APPEND_CHILD, - DELETE_CHILD, - PUT_ATTRIBUTE, - DELETE_ATTRIBUTE, - REPLACE_ROOT, - DEFAULT -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/Command.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/Command.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a0666134a47b7405188e41e964633ca9 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodeEditorError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodeEditorError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -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(); - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodeEditorError.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodeEditorError.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 856c0f8f7f7964d82a64d4cf2272f907 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodePath.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodePath.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using System.Collections.Generic; -public interface NodePath : IEnumerable { - NodePath add (int pos); - Pair pop(); - NodePath tail(); - int size(); - Pair last(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodePath.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/NodePath.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e50a3be3b5e5d4c85b14b975fd4c3a7c +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeContext.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeContext.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - -public interface TreeContext { - TreeNode getRoot(); - - TreeContext prev(); - - string getUuid(); - - string getTreeName(); - - long getRevision(); - - TreeMap>> getIndex(); - - // Iterable getOperations(); - - // ParentIndex getParentIndex(); do not use, in the game. - - InterfaceTraverser getTraverser(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeContext.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeContext.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 821ea32092b474bf38d9c400b9a8e1a8 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public interface TreeEditor { - Either edit (TreeNode root, NodePath path, NodeEditor transformer); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeEditor.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/TreeEditor.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e08673b16c39c4068b4ab7d90ae96306 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3f0697846967447d8b532e81c6d08619 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultNodePath.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultNodePath.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Collections; - -public class DefaultNodePath : NodePath { - private List path = new List(); - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return path.iterator (); - } - - public DefaultNodePath() { - path = new List ().addLast (-1); - } - - private DefaultNodePath(List path) { - this.path = path; - } - - /// - /// Listに追加します。 - /// path = path.add(0)を2回する - /// path = path.add(0).add(0)する - /// これは同じ - /// - /// Position. - - public NodePath add(int pos) { - List newPath = path.addLast(pos); - return new DefaultNodePath(newPath); - } - - public Pair pop() { - int head = path.headList(); - List tail = path.deleteHead(); - return new Pair(head, new DefaultNodePath(tail)); - } - - public Pair last() { - int last = path.headList(); - List list = path.deleteHead(); - return new Pair(last, new DefaultNodePath(list)); - } - - public override string ToString() { - string s = "List <"; - int list_count = this.path.length(); - int count = 0; - foreach(var i in this.path) { - if (count != list_count -1){ - s += i.ToString() + ","; - } else { - s += i.ToString(); - } - count++; - } - return s + ">"; - } - - public int size() { - return path.length(); - } - - public NodePath tail() { - List tail = path.deleteLast (); - return new DefaultNodePath (tail); - } - - public List inits() { - List paths = new List (); - List coursePath = new List (); - foreach (int tmpPath in path) { - List tmp = coursePath.addLast (tmpPath); - paths = paths.addLast (new DefaultNodePath (tmp)); - coursePath = tmp; - } - return paths; - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultNodePath.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultNodePath.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 80ce0f9de688f408d8d4c51cdd68515f +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultTreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultTreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -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 edit(TreeNode root,NodePath path, NodeEditor editor){ - DefaultEvaluator e = new DefaultEvaluator (path); - Either either = traverser.traverse (root, e); - - if (either.isA ()) { - return DefaultEither.newA (either.a ()); - } - Traversal t = either.b (); - return clone (t, editor); - } - - private Either clone(Traversal t, NodeEditor editor){ - List> path = new List> (); - - foreach (Direction direction in t) { - path = path.addLast (direction); - } - - Direction targetDirection = path.headList (); - TreeNode target = targetDirection.getTarget (); - Either either = editor.edit (target); - if (either.isA ()) { - return DefaultEither.newA (either.a ()); - } - - LoggingNode newWrap = either.b (); - - int pos = targetDirection.getPosition (); - TreeNode child = newWrap.getWrap (); - - foreach (Direction parentDirection in path.deleteHead()) { - TreeNodeChildren chs = parentDirection.getTarget ().getChildren (); - - Either ret = chs.replaceNode (pos, child); - if (ret.isA ()) { - return DefaultEither.newA (ret.a ()); - } - - child = ret.b (); - pos = parentDirection.getPosition (); - } - - TreeNode newRoot = child; - LoggingNode logNode = editor.wrap (newRoot, newWrap.getOperationLog ()); - return DefaultEither.newB (logNode); - - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultTreeEditor.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/DefaultTreeEditor.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0d8e4b9c99b6e47c2a2b9a50c3011804 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -using System.Collections.Generic; - -public interface TreeNode { - TreeNodeChildren getChildren(); - - TreeNodeAttributes getAttributes(); - - TreeNode createNewNode(); - - Either appendRootNode(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 33a3dce1c95da4870a7e08cdd95d9a9f +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeAttributes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeAttributes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -public interface TreeNodeAttributes : Attributes { - Either delete(string key); - Either put(string key, byte[] value); - TreeMap getAttributesAsRawMap(); - IEnumerator getKeys(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeAttributes.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeAttributes.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 49186df28218140b9bbcd16268d44296 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeChildren.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeChildren.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - -public interface TreeNodeChildren : Children { - Either addNewChildAt (int pos); - Either deleteChildAt(int pos); - Either addNewChildAt(int pos,TreeNode newChild); - Either replaceNode(int pos,TreeNode replacement); - List getChildrenAsRawList(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeChildren.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/TreeNodeChildren.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e516f432476ef4785aa1e27a7d371937 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0fe1ebbfa58a04d9f9dd31632803873b +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultOperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultOperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using System.Collections; -using System; - - -public class DefaultOperationLog : OperationLog { - private List log; - - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - private static List EMPTY = new List(); - - public DefaultOperationLog() - : this(EMPTY) - { - } - - private DefaultOperationLog(List _log) - { - log = _log; - } - - public IEnumerator iterator() - { - return log.iterator(); - } - - - public OperationLog add(NodeOperation _op) - { - return new DefaultOperationLog(log.addLast(_op)); - } - - public int length() - { - return log.length(); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultOperationLog.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultOperationLog.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4537bdd78c1d5496e801c13ca1bf2e85 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultTreeOperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultTreeOperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System; -using System.Collections; -using System.Linq; - - -public class DefaultTreeOperationLog : TreeOperationLog { - private IEnumerable list; - private int size; - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - foreach (var i in list) { - yield return i; - } - } - - - public DefaultTreeOperationLog() - { - list = new List(); - size = 0; - } - - public DefaultTreeOperationLog(IEnumerable _list,int _size) - { - list = _list; - size = _size; - } - -// public IEnumerator iterator() -// { -// return list.itetator(); -// } - - public TreeOperationLog add(NodePath _p, NodeOperation _op) - { - TreeOperation op = new DefaultTreeOperation(_p,_op); - List newList = new List(op); - // java write Iterables.concat ここは間違い - IEnumerable concat = list.Union(newList); - - return new DefaultTreeOperationLog(concat,size + 1); - } - - public TreeOperationLog append(TreeOperationLog _log) - { - int argumentLogSize = _log.length(); - // java write Iterables.concat - IEnumerable concat = list.Union(_log); - - return new DefaultTreeOperationLog(concat,argumentLogSize + size); - } - - - public int length(){ - return size; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultTreeOperationLog.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/DefaultTreeOperationLog.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 13eeac4a4df1640fdb639d78459dc86a +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingAttributes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingAttributes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -using UnityEngine; - -public class LoggingAttributes { - - private TreeNode wrap; - private OperationLog log; - - public LoggingAttributes(TreeNode _wrap,OperationLog _log) - { - wrap = _wrap; - log = _log; - } - - public byte[] get(string _key) - { - TreeNodeAttributes attributes = wrap.getAttributes(); - return attributes.get(_key); - } - - private Either edit(NodeOperation _op) - { - Either either = _op.invoke(wrap); - if(either.isA()){ - Debug.Log ("faild put"); - return DefaultEither.newA(either.a()); - } - - TreeNode newNode = either.b(); - OperationLog newLog = log.add(_op); - LoggingNode newLogNode = new LoggingNode(newNode,newLog); - - return DefaultEither.newB(newLogNode); - } - - public Either delete(string _key) - { - - DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key); - return edit(deleteAttribute); - } - - public Either put(string _key, byte[] _value) - { - PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value); - return edit(putAttribute); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingAttributes.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingAttributes.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 73fea44b68b8e4d11a7b5ff4dd4e7a5d +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingChildren.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingChildren.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -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 edit(NodeOperation _op) - { - Either either = _op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newWrap = either.b(); - OperationLog newLog = log.add(_op); - LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); - return DefaultEither.newB(newLoggingNode); - } - - public Either addNewChildAt(int _pos) - { - Debug.Log ("in addNewChild"); - NodeOperation addNewChildAt = new AppendChildAtOperation(_pos); - return edit(addNewChildAt); - } - - public Either deleteChildAt(int _pos) - { - NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos); - return edit(deleteChildAt); - } - - public Either at(int _pos) - { - Children children = wrap.getChildren(); - Either either = children.at(_pos); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode node = either.b(); - LoggingNode logNode = new LoggingNode(node); - return DefaultEither.newB(logNode); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingChildren.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingChildren.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f10786498db534045b21954937ad955f +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -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 replaceNewRootNode() { - NodeOperation replaceRootNode = new ReplaceRootNodeOperation(); - return edit(replaceRootNode); - } - - public Either edit(NodeOperation op){ - Either either = op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newWrap = either.b(); - OperationLog newLog = log.add(op); - LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); - return DefaultEither.newB(newLoggingNode); - } - - public TreeNode getWrap() - { - return wrap; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 13bad2e87a0f444449e240fa18366534 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/OperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/OperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -using System.Collections.Generic; - -public interface OperationLog : IEnumerable { - OperationLog add (NodeOperation _op); - int length(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/OperationLog.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/OperationLog.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a779bc9514e7a4ff8a8c3403bbd7e583 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/TreeOperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/TreeOperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -using System.Collections.Generic; -public interface TreeOperationLog : IEnumerable { - TreeOperationLog add (NodePath _p, NodeOperation _op); - TreeOperationLog append (TreeOperationLog _log); - int length(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/TreeOperationLog.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/TreeOperationLog.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 46c05e26eca8548cd872e7132fd1392f +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/index.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/index.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3fd1b8b0321254953a83aad193fd5228 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/index/ParentIndex.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/index/ParentIndex.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - -public class ParentIndex { - - - private TreeMap parentIndex; - - public ParentIndex() { - parentIndex = new TreeMap(); - } - - 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 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 childrenIterator = children.iterator(); -// for (; childrenIterator.hasNext();) { -// TreeNode child = childrenIterator.next(); -// parentIndex = parentIndex.put(child, parentNode); -// } - return this; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/index/ParentIndex.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/index/ParentIndex.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3ce4117c7458d4967a0f6d0bb1164b31 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f739241e1ffa04a8ea4a253049719311 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/AppendChildAtOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/AppendChildAtOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -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 invoke(TreeNode _target) - { - return _target.getChildren().addNewChildAt(pos); - } - - public int getPosition() - { - return pos; - } - - public string getKey() - { - return null; - } - - public byte[] getValue() - { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/AppendChildAtOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/AppendChildAtOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 18fccffbc360e4907b2ed6b6dfa59edc +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DefaultTreeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DefaultTreeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DefaultTreeOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DefaultTreeOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 55d0db567dc4c4341b434b7c74204ef7 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteAttributeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteAttributeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -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 invoke(TreeNode _target) { - return _target.getAttributes ().delete (key); - } - - public int getPosition() { - return -1; - } - - public string getKey() { - return key; - } - - public byte[] getValue() { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteAttributeOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteAttributeOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fa97ab7f879504a95b789daaf11d661a +timeCreated: 1478444958 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteChildAtOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteChildAtOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -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 invoke(TreeNode _target) - { - return _target.getChildren().deleteChildAt(pos); - } - - public int getPosition() - { - return pos; - } - - public string getKey() - { - return null; - } - - public byte[] getValue() - { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteChildAtOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/DeleteChildAtOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1c41f527a5c1f425bb60cc23a4016de9 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/NodeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/NodeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using UnityEngine; -public interface NodeOperation { - Command getCommand(); - Either invoke (TreeNode _target); - int getPosition(); - string getKey(); - byte[] getValue(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/NodeOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/NodeOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e2d3f5538f1a443c9bd748f5e9881500 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/PutAttributeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/PutAttributeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -using UnityEngine; - -public class PutAttributeOperation : NodeOperation { - private string key; - private byte[] value; - - public PutAttributeOperation(string _key, byte[] _value) - { - key = _key; - value = _value; - } - - - public Command getCommand() - { - return Command.PUT_ATTRIBUTE; - } - - public Either invoke(TreeNode _target) - { - return _target.getAttributes().put(key,value); - } - public int getPosition() - { - return -1; - } - - public string getKey() - { - return key; - } - - public byte[] getValue() - { - return value; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/PutAttributeOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/PutAttributeOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6b5119d57f9a54e3584043fb8e8b4e47 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/ReplaceRootNodeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/ReplaceRootNodeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class ReplaceRootNodeOperation : NodeOperation { - - public Command getCommand() { - return Command.REPLACE_ROOT; - } - - public Either invoke(TreeNode target) { - return target.appendRootNode(); - } - - public int getPosition() { - return -1; - } - - public string getKey() { - return null; - } - - public byte[] getValue() { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/ReplaceRootNodeOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/ReplaceRootNodeOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0c55ee2228a574f2ea79dceb69c50bbc +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/TreeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/TreeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface TreeOperation { - NodePath getNodePath(); - NodeOperation getNodeOperation(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/TreeOperation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/operations/TreeOperation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dc1ba9da41adf48458208893a44f7a94 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e0cfe5018f62c43a188817eda25119e2 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/AppendChildAt.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/AppendChildAt.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class AppendChildAt : NodeEditor { - private int pos; - - public AppendChildAt(int _pos){ - pos = _pos; - } - - public Either _edit(LoggingNode _e) - { - Either either = _e.getChildren().addNewChildAt(pos); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/AppendChildAt.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/AppendChildAt.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: db8d58db5ee654ab68bc3f56c9094b03 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteAttribute.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteAttribute.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class DeleteAttribute : NodeEditor { - private string key; - - public DeleteAttribute(string _key) - { - key = _key; - } - - public Either _edit(LoggingNode logNode) - { - Either either = logNode.getAttributes().delete(key); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteAttribute.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteAttribute.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bd2969a18dc814765bab3476ebc0b0bf +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteChildAt.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteChildAt.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class DeleteChildAt : NodeEditor { - private int pos; - - public DeleteChildAt(int _pos) - { - pos = _pos; - } - - public Either _edit(LoggingNode logNode) - { - Either either = logNode.getChildren().deleteChildAt(pos); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteChildAt.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/DeleteChildAt.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5dcd30e5cafc5434a869dd6990a5dcb2 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/NodeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/NodeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface NodeEditor { - Either edit (TreeNode _e); - LoggingNode wrap (TreeNode node, OperationLog op); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/NodeEditor.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/NodeEditor.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dbf602e28bbff4a0db51bf7a39ec2008 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/PutAttribute.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/PutAttribute.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class PutAttribute : NodeEditor { - private string key; - private byte[] value; - - public PutAttribute(string _key, byte[] _value) - { - key = _key; - value = _value; - } - - public Either _edit(LoggingNode _e) - { - Either either = _e.getAttributes().put(key,value); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/PutAttribute.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/PutAttribute.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b7e1222eff9a743e992aa37c2229ea56 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/replaceRootNodeAt.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/replaceRootNodeAt.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -using System.Collections; - -public class replaceRootNodeAt : NodeEditor { - public Either _edit(LoggingNode _e) - { - Either either = _e.replaceNewRootNode(); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/replaceRootNodeAt.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/replaceRootNodeAt.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7c9a1eb896193489b83ad86bafd91beb +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4486907fe54c940cb96f7ae6935b03fd +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/AtomicReference.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/AtomicReference.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -using System.Threading; - -public class AtomicReference where T : class { - private T value; - - public AtomicReference(T value) { - this.value = value; - } - - public bool CompareAndSet(T newValue, T prevValue) { - // change to compere exchange. - T oldValue = value; - return (oldValue != Interlocked.CompareExchange (ref value, newValue, prevValue)); - } - - - public T Get() { - return value; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/AtomicReference.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/AtomicReference.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 62c57659321ac4ae4afa2025b154de3f +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultJungleTreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultJungleTreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -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 _edit(NodePath _path,NodeEditor _e) - { - Either either = editor.edit (root, _path, _e); - if (either.isA ()) { - return DefaultEither.newA (either.a ()); - } - - LoggingNode newLogging = either.b (); - OperationLog newLog = newLogging.getOperationLog (); - TreeNode newNode = newLogging.getWrap (); - - IterableConverter.Converter converter = new InnerConverter (_path); - - - IEnumerable iterable = new IterableConverter (newLog, converter); - DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog (iterable, newLog.length ()); - TreeOperationLog newTreeOpLog = log.append (treeOperationLog); - - JungleTreeEditor newEditor = new DefaultJungleTreeEditor (newNode, txManager, editor, newTreeOpLog); - return DefaultEither.newB (newEditor); - - } - - - public Either replaceNewRootNode() { - replaceRootNodeAt appendChildAt = new replaceRootNodeAt (); - return _edit (new DefaultNodePath(), appendChildAt); - } - - public Either addNewChildAt(NodePath _path, int _pos) { - AppendChildAt appendChildAt = new AppendChildAt (_pos); - return _edit (_path, appendChildAt); - } - - public Either deleteChildAt(NodePath _path, int _pos) { - DeleteChildAt deleteChildAt = new DeleteChildAt(_pos); - return _edit(_path,deleteChildAt); - } - - public Either putAttribute(NodePath _path, string _key, byte[] _value) { - PutAttribute putAttribute = new PutAttribute (_key, _value); - return _edit (_path, putAttribute); - } - - public Either deleteAttribute(NodePath _path, string _key) { - DeleteAttribute deleteAttribute = new DeleteAttribute (_key); - return _edit (_path, deleteAttribute); - } - - public Either edit(NodePath _path,NodeEditor _editor) { - return _edit(_path,_editor); - } - - /// - /// Treeを変更したあとSuccess(push)を行う - /// - - public Either success() { - Either either = this.txManager.commit(this.root, this.log); - // このlogをサーバにpushする? - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TransactionManager newTxManager = either.b(); - JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(this.root, newTxManager, this.editor); - - return DefaultEither.newB(newTreeEditor); - } - - public Either flushSuccess() { - return success(); - } - - public class InnerConverter : IterableConverter.Converter{ - - NodePath path; - - public InnerConverter(NodePath _path) { - path = _path; - } - - - public TreeOperation conv(NodeOperation _b){ - return new DefaultTreeOperation(path,_b); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultJungleTreeEditor.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultJungleTreeEditor.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 21c28b35ceb8c4548922203d62986fa8 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTransactionManager.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTransactionManager.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -using System.Collections.Generic; -using System.Collections; -using System; - -public class DefaultTransactionManager : TransactionManager { - private AtomicReference repository; - private TreeContext tip; - private ChangeListWriter writer; - private string uuid; - - - public DefaultTransactionManager(ChangeListWriter _writer, TreeContext _tip, AtomicReference _repository, string _uuid) { - repository = _repository; - tip = _tip; - writer = _writer; - uuid = _uuid; - } - - public Either 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.CompareAndSet(newTreeContext, newTreeContext.prev())) { // CompareAndSetが成功した場合に処理を実行 - TransactionManager txManager = new DefaultTransactionManager(writer, newTreeContext, repository, uuid); - return DefaultEither.newB(txManager); - } - - return DefaultEither.newA((Error) new DefaultError()); - } - - public Either 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; - - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - - public InnerChangeList(TreeOperationLog _log, string _treeName, string _uuid){ - this.log = _log; - this.treeName = _treeName; - this.uuid = _uuid; - } - - public IEnumerator 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 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTransactionManager.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTransactionManager.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 76a2d3f12d7e442989c17f784ab7e058 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeContext.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeContext.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -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 getOperations() { - return changeList; - } - - public TreeMap>> getIndex() { - return traverser.getIndex (); - } - - // don't write parent Index. - - public InterfaceTraverser getTraverser() { - return traverser; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeContext.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeContext.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b1bdea0e0094b42b4967e33fd9780cd1 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -using UnityEngine; - -public class DefaultTreeNode : TreeNode { - - private List children; - private TreeMap attrs; - private static readonly List NIL_LIST = new List(); - - public DefaultTreeNode() - : this (NIL_LIST, new TreeMap ()) - { - } - - public DefaultTreeNode(List _children, TreeMap _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 appendRootNode() { - TreeNodeChildren newRootChildren = new DefaultTreeNodeChildren(NIL_LIST, new TreeMap()); - Either either = newRootChildren.addNewChildAt(0,this); - return either; - } - - public int compareTo(TreeNode o) { - return this.GetHashCode() - o.GetHashCode(); - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNode.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNode.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 69e9576c0269d469da28015e058925ec +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeAttribute.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeAttribute.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; -using System.Text; - -public class DefaultTreeNodeAttribute : TreeNodeAttributes { - public List children; - public TreeMap attrs; - - public DefaultTreeNodeAttribute(List _children, TreeMap _attrs){ - children = _children; // null? - attrs = _attrs; - } - - public TreeMap getAttributesAsRawMap(){ - return attrs; - } - - public Either delete(string _key) { - if (_key == null) { - return DefaultEither.newA (NodeEditorError.NULL_VALUE_NOT_ALLOWED); - } - - if (null == attrs.getRoot()) { - return DefaultEither.newA(NodeEditorError.DELETE_KEY_NOT_FOUND); - } - - TreeMap newMap = attrs.delete(_key); - TreeNode newNode = new DefaultTreeNode(children, newMap); - return DefaultEither.newB(newNode); - } - - public Either put(string _key, byte[] _value){ - if (_key == null || _value == null) { - return DefaultEither.newA (NodeEditorError.NULL_VALUE_NOT_ALLOWED); - } - - TreeMap newMap = attrs.put (_key, _value); - - TreeNode newNode = new DefaultTreeNode (children, newMap); - - return DefaultEither.newB (newNode); - } - - public byte[] get(string _key) { - if (_key == null) { - return new byte[1]{0}; - } - byte[] op = attrs.get(_key); //null - if (op != null) { - return op; - } - return new byte[1]{0}; - } - - 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 getKeys(){ - return attrs.keys (); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeAttribute.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeAttribute.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1de3414c3db414e87a6a813b53e6a69f +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeChildren.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeChildren.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class DefaultTreeNodeChildren : TreeNodeChildren { - - public List children; - public TreeMap attrs; - - public DefaultTreeNodeChildren(List _children, TreeMap _attrs){ - children = _children; - attrs = _attrs; - } - - private bool boundaryCheck(int _pos) { - int size = children.length (); - if (size < _pos) { - return false; - } - return true; - } - - public List getChildrenAsRawList() { - return children; - } - - public Either addNewChildAt(int _pos) { - if (!boundaryCheck(_pos) || _pos < 0) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - - List newChildren = children.add(_pos, new DefaultTreeNode()); - TreeNode newNode = new DefaultTreeNode(newChildren, attrs); - return DefaultEither.newB(newNode); - } - - - public Either deleteChildAt(int _pos) { - if (!boundaryCheck(_pos) || _pos < 0 || size() == 0) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - - List newChildren = children.delete(_pos); - TreeNode newNode = new DefaultTreeNode(newChildren, attrs); - - return DefaultEither.newB(newNode); - } - - - public int size() { - return children.length(); - } - - -// public Iterator iterator() { -// return children.iterator(); -// } - - - public Either replaceNode(int _pos, TreeNode _replacement) { - int size = children.length(); - if (!(0 <= _pos && _pos < size)) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - TreeNode replacement = _replacement; - - List newChildren = children.replace(_pos, replacement); - TreeNode node = new DefaultTreeNode(newChildren, attrs); - return DefaultEither.newB(node); - } - - - public Either at(int _pos) { - if (children.length() < _pos + 1) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - - TreeNode Node = children.index(_pos); - - return DefaultEither.newB(Node); - } - - - public Either addNewChildAt(int _pos, TreeNode _newChild) { - if (!boundaryCheck(_pos) || _pos < 0) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - List newChildren = children.add(_pos, _newChild); - TreeNode newNode = new DefaultTreeNode(newChildren, attrs); - - return DefaultEither.newB(newNode); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeChildren.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/DefaultTreeNodeChildren.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a2291a0cf1ec64c4d9ec9d0b44ddf397 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/TransactionManager.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/TransactionManager.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - -public interface TransactionManager { - Either commit(TreeNode _newRoot, TreeOperationLog _log); - Either firstcommit(TreeNode _newRoot, TreeOperationLog _log); - string getUUID(); - long getRevision(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/TransactionManager.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/transaction/TransactionManager.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: be9cc2f631a65419b81d97f3b85a25d6 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 149fee20ebfc447a1b76b29e35e0ae90 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 19a3b99c4d8e843e3a9201790f57ce4f +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluator.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluator.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -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 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); - - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluator.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultEvaluator.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: df8984c20d7eb41dea1f2c11b714ba89 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultTraverser.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultTraverser.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -using System.Collections.Generic; -using System.Collections; -using UnityEngine; -using System; -// yet write. -public class DefaultTraverser : Traverser { - - - public Either traverse(TreeNode _root, Evaluator _evaluator) { - // 無名クラスを書いてない - Children warper = new InnerChildren(_root, _evaluator); - - Children chs = warper; - Either>> ret = _traverse(chs, _evaluator, -1); - - if (ret.isA ()) { - return DefaultEither.newA (ret.a ()); - } - - List> list = ret.b (); - IEnumerator> iterable = list.iterator (); - TreeNode destination = ret.b ().headList ().getTarget (); - - Traversal traversal = new InnerTraversal (iterable, destination); - - return DefaultEither.newB (traversal); - - } - - - private Either>> _traverse(Children _chs, Evaluator _evaluator, int _pos) { - int pos = _pos; - TreeNode ch; - for (int i = 0; i < _chs.size(); i++) { - Either 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>>.newB(_goal(ch, pos)); - } - - if (r == Result.BREAK) { - break; - } - - if (r == Result.CONTINUE) { - pos++; - continue; - } - - return DefaultEither>>.newA (TraverserError.UNDEFINED_OPERATOR); - } - return DefaultEither>>.newA (TraverserError.PATH_NOT_FOUND); - } - - - private List> _goal( TreeNode _current, int _pos) { - Direction d = new InnerDirection (_pos, _current); - - List> list = new List> (); - List> newList = list.addLast (d); - - return newList; - } - - - private Either>> _accept(TreeNode _current, int _pos,Evaluator _evaluator) - { - Children chs = _current.getChildren (); - Either>> either = _traverse (chs, _evaluator, 0); - if (either.isA ()) { - return either; - } - List> list = either.b (); - Direction d = new InnerDirection (_pos, _current); - - List> newList = list.addLast (d); - return DefaultEither>>.newB (newList); - } - - public class InnerTraversal : Traversal{ - IEnumerator> iterable; - TreeNode destination; - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public IEnumerator> GetEnumerator() - { - return iterable; - } - - - public InnerTraversal(IEnumerator> _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 iterator() { - List list = new List (); - return list.addLast (root).iterator (); - } - - public int size() { - return 1; - } - - public Either at(int _pos) { - if (_pos != 0) { - return DefaultEither.newA (NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - return DefaultEither.newB (root); - } - } - - public class InnerDirection : Direction{ - 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 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultTraverser.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/DefaultTraverser.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 98d3cfdfa60784d269304353b7bdc285 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Direction.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Direction.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - -public interface Direction { - int getPosition(); - T getTarget(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Direction.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Direction.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b18ec9d7027894f42b598305b5f254c7 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - -public interface Evaluation { - Result results(); - Evaluator evaluators(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluation.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluation.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 09eee6ef9c9a846a3b9c1ad272088e89 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluator.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluator.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public interface Evaluator { - Evaluation evaluate (TreeNode _current, int _pos); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluator.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Evaluator.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d2940380c5b2b4722bc6ea6579d8cea2 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/InterfaceTraverser.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/InterfaceTraverser.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - -public class InterfaceTraverser { - TreeNode root; - TreeMap>> indexList; - ParentIndex parentIndex; - bool parentUpdateFlag; - bool useIndex; - - public InterfaceTraverser(TreeNode root, bool indexFlag) - : this (root, new TreeMap>> (), new ParentIndex (), indexFlag) - { - } - - public InterfaceTraverser(TreeNode root, TreeMap>> 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>> getIndex() { - return indexList; - } - - public void commit() { - parentUpdateFlag = false; - } - - public ParentIndex getParentIndex() { - return parentIndex; - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/InterfaceTraverser.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/InterfaceTraverser.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0f24d719e3700435cb07cb0aba3e6cee +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traversal.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traversal.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -using System.Collections.Generic; - -public interface Traversal : IEnumerable> { - TreeNode destinations(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traversal.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traversal.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4f8ff4426a9af491bb7d8c64b5599f11 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traverser.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traverser.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - -// jungle/ -public interface Traverser { - - Either traverse ( TreeNode _root, Evaluator _evaluator); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traverser.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/Traverser.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a8fe5cecd555449d0bded5d0ae066639 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/TraverserError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/TraverserError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public class TraverserError { - public static Error UNDEFINED_OPERATOR = new DefaultError(); - public static Error PATH_NOT_FOUND = new DefaultError(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/TraverserError.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/traverser/TraverserError.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5242977b74381484182bb9d93d957b8d +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c3641cd50e0104588bbcd38acb5dd7c4 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultEither.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultEither.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ - -public class DefaultEither : Either { - private A theA; - private B theB; - - private DefaultEither(A _theA, B _theB){ - theA = _theA; - theB = _theB; - } - - public static DefaultEither newA(A _theA) - { - return new DefaultEither(_theA,default(B)); - } - - public static DefaultEither newB(B _theB) - { - return new DefaultEither(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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultEither.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultEither.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5e08f5b4ed60842ff8b3e8b6219ec684 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - -public class DefaultError : Error { - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultError.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultError.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9624fac9ba03e43f1ab79f6dee3fb815 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Either.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Either.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - -public interface Either { - A a(); - bool isA(); - B b(); - bool isB(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Either.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Either.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 60a9b52900e3e4d21b93d8e191454d54 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Error.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Error.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public interface Error { - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Error.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Error.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f4a03d285089f49abbb2b517f10178b6 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/GetOldTreeError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/GetOldTreeError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public class GetOldTreeError : Error { - public static Error OLD_TREE_NOT_FOUND = new DefaultError(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/GetOldTreeError.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/GetOldTreeError.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0064182798ccf473993b8c0f2dc1abea +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/IterableConverter.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/IterableConverter.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Collections; -using System; - -public class IterableConverter : IEnumerable { - private IEnumerable iterable; - private Converter converter; - - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - public IterableConverter(IEnumerable _iterable,Converter _converter) - { - iterable = _iterable; - converter = _converter; - } - - public IEnumerator iterator() - { - return new IteratorConverter(iterable.GetEnumerator(),converter); - } - - private class IteratorConverter : IEnumerator - { - public List appLines { get; set; } - - private IEnumerator iterator; - private Converter converter; - - public IteratorConverter(IEnumerator _iterator,Converter _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; } - } - - public void Dispose() { - ((IEnumerator)this.appLines).Dispose (); - } - } - - - public interface Converter{ - A conv (B _b); - } - -} \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/IterableConverter.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/IterableConverter.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 165a6b5bdc0084d398aaad2500b88e16 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Pair.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Pair.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class Pair { - 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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Pair.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/Pair.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: af6f428f9cd194717a35c5cb4dac6462 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 580f07b7d15ad44bfb9ec0dfb9f7cf57 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/core.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/core.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d3c439c7e39dd4032b61bbf2db12bed6 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/core/NetworkDefaultJungle.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/core/NetworkDefaultJungle.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -public class NetworkDefaultJungle : Jungle { - - private Journal Journal; - private TreeMap Trees; - private string Uuid; - private TreeEditor Editor; - - public NetworkDefaultJungle(Journal jou, string uid, TreeEditor edit) { - this.Journal = jou; - this.Trees = new TreeMap(); - this.Uuid = uid; - this.Editor = edit; - } - - public JungleTree getTreeByName (string name) { - return Trees.get(name); - } - - public JungleTree createNewTree(string name) { - ChangeList list = new InnerChangeList(this.Uuid, name); - TreeNode root = new DefaultTreeNode(); - InterfaceTraverser traverser = new InterfaceTraverser(root, true); - TreeContext tc = new DefaultTreeContext(root, null, list, this.Uuid, name, 0, traverser); - JungleTree newTree = new NetworkDefaultJungleTree(name, tc, this.Uuid, Journal.getWriter(), this.Editor); - if (Trees.put(name, newTree) != null) { - return null; - } - return newTree; - } - - - public class InnerChangeList : ChangeList { - - string uuid; - string name; - - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - // construct - public InnerChangeList(string _uuid, string _name) { - this.uuid = _uuid; - this.name = _name; - } - - public IEnumerator iterator() { - List nil = new List(); - return nil.iterator(); - } - - public string uuids() { - return uuid; - } - - public string getTreeName() { - return name; - } - - public TreeOperationLog getLog() { - return new DefaultTreeOperationLog(); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/core/NetworkDefaultJungle.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/core/NetworkDefaultJungle.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b01764375d4434539a2d98fb815d991a +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7446ce7a30a3e48c2a2a18f2a000321c +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildAtOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildAtOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildAtOperation.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bb9a86bfbfa3e4d8198a2c53f8a09f60 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperation.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 853e131924ddb4230853f80c98d28e26 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperation.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6b1378c0362094e39b242dbc718edf6e +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperation.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a04dc14dbfd224fc1b6f4d354d9b1bda +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -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; - } - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - yield return this.Path.GetEnumerator().Current; - } - - 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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: abd10cc242df84da3a2c9fb74d8b426d +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperation.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6871b237bdc404d15912f89294fe9522 +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0ff42f9e2b04144aaa4575f2e54e4ca1 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLog.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 78f6ec28dab4944a2a2e4c9ddd37fc31 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: df9a55dec865d493585bb04c53a73c02 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 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 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTree.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTree.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1119fb7b43e2946eeb007cdfa15da51b +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; - -public class NetworkDefaultJungleTreeEditor : JungleTreeEditor { - private readonly TransactionManager TxManager; - private readonly TreeNode Root; - private readonly TreeEditor Editor; - private readonly string TreeName; - private readonly TreeOperationLog Log; - private bool ExportLog; - - public NetworkDefaultJungleTreeEditor(string tname, TreeNode root, TransactionManager txMan, TreeEditor edit) - { - this.TreeName = tname; - this.Root = root; - this.TxManager = txMan; - this.Editor = edit; - this.Log = new DefaultTreeOperationLog(); - this.ExportLog = true; - } - - public NetworkDefaultJungleTreeEditor(string tname, TreeNode root, TransactionManager txMan, TreeEditor edit, TreeOperationLog log) { - this.TreeName = tname; - this.Root = root; - this.TxManager = txMan; - this.Editor = edit; - this.Log = log; - this.ExportLog = true; - } - - public static NetworkDefaultJungleTreeEditor NewLocalTreeEditor(string tname, TreeNode root, TransactionManager txMan, TreeEditor edit) { - NetworkDefaultJungleTreeEditor treeEditor = new NetworkDefaultJungleTreeEditor(tname, root, txMan, edit, new DefaultTreeOperationLog()); - treeEditor.ExportLog = false; - return treeEditor; - } - - public static NetworkDefaultJungleTreeEditor NewLocalTreeEditor(string tname, TreeNode root, TransactionManager txMan, TreeEditor edit, TreeOperationLog log) { - NetworkDefaultJungleTreeEditor treeEditor = new NetworkDefaultJungleTreeEditor(tname, root, txMan, edit, log); - treeEditor.ExportLog = false; - return treeEditor; - } - - - private Either TreeEditor(NodePath path, NodeEditor editor) - { - //LoggingNodeHook hook = new LoggingNodeHook(_e); - Either either = this.Editor.edit(this.Root, path, editor); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newNode = either.b().getWrap(); - OperationLog newLog = either.b().getOperationLog(); - -// IterableConverter.Converter converter = new IterableConverter.Converter(){ -// public TreeOperation conv(NodeOperation _b){ -// return new DefaultTreeOperation(_path,_b); -// } -// }; - - // I must fix this code. - IterableConverter.Converter converter = new InnerConverter(path); - - IEnumerable iterable = new IterableConverter(newLog, converter); - DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); - TreeOperationLog newTreeOpLog = Log.append(treeOperationLog); - - JungleTreeEditor newEditor; - if(this.ExportLog) { - newEditor = new NetworkDefaultJungleTreeEditor(this.TreeName, newNode, this.TxManager, this.Editor, newTreeOpLog); - } else { - newEditor = NetworkDefaultJungleTreeEditor.NewLocalTreeEditor(this.TreeName, newNode, TxManager, this.Editor, newTreeOpLog); - } - return DefaultEither.newB(newEditor); - } - - - public Either addNewChildAt(NodePath _path, int _pos) - { - AppendChildAt appendChildAt = new AppendChildAt(_pos); - return this.TreeEditor(_path,appendChildAt); - } - - public Either deleteChildAt(NodePath _path, int _pos) - { - DeleteChildAt deleteChildAt = new DeleteChildAt(_pos); - return this.TreeEditor(_path,deleteChildAt); - } - - public Either putAttribute(NodePath _path, string _key, byte[] _value) - { - PutAttribute putAttribute = new PutAttribute(_key,_value); - return this.TreeEditor(_path,putAttribute); - } - - public Either deleteAttribute(NodePath _path, string _key) - { - DeleteAttribute deleteAttribute = new DeleteAttribute(_key); - return this.TreeEditor(_path,deleteAttribute); - } - - public Either edit(NodePath _path, NodeEditor _editor) - { - return this.TreeEditor(_path,_editor); - } - - public Either success() - { - Either either = TxManager.commit(this.Root, this.Log); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } -// if(this.ExportLog) { -// try { -// putTreeOperationLog(this.Log); -// } catch (IOException e) { -// return DefaultEither.newA(either.a()); -// } -// } - - TransactionManager newTxManager = either.b(); - JungleTreeEditor newTreeEditor = new NetworkDefaultJungleTreeEditor(this.TreeName, this.Root, newTxManager, this.Editor); - - return DefaultEither.newB(newTreeEditor); - } - - private string getID() - { - return this.TxManager.getUUID(); - } - - private string getRevision() - { - return this.TxManager.getRevision().ToString(); - } - - public string getTreeName() { - return this.TreeName; - } - - public TreeOperationLog getTreeOperationLog() { - return this.Log; - } - - public void putTreeOperationLog(IEnumerable newLog) { - string uuid = getID(); - string treeName = getTreeName(); - string updaterName = getID(); - string revision = getRevision(); - putDataSegment(uuid, treeName, updaterName, newLog, revision); - } - - public void putDataSegment(string _uuid, string _treeName, string _updaterName, IEnumerable newLog, string nextRevision) { - // NetworkTreeOperationLog netLog = new NetworkTreeOperationLog(_uuid, _treeName,newLog); -// CodeSegment cs = new LogPutCodeSegment(netLog); -// cs.execute(); - } - - public Either replaceNewRootNode() { - // TODO Auto-generated method stub - return null; - } - - public Either flushSuccess() { - // TODO Auto-generated method stub - return null; - } - - public class InnerConverter : IterableConverter.Converter{ - NodePath path; - - public InnerConverter(NodePath _path) { - path = _path; - } - - - public TreeOperation conv(NodeOperation _b){ - return new DefaultTreeOperation(path,_b); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTreeEditor.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkDefaultJungleTreeEditor.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 01973acd07ebe46158d7b1c182b1d3c5 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkTransactionManager.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkTransactionManager.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; - -public class NetworkTransactionManager : TransactionManager { - - private readonly AtomicReference Repository; - private readonly TreeContext TContext; - private readonly ChangeListWriter Writer; - private readonly string Uuid; - private readonly string TreeName; - - public NetworkTransactionManager (string name, ChangeListWriter writer, TreeContext tcon, AtomicReference repo, string uid) { - this.Repository = repo; - this.TContext = tcon; - this.Writer = writer; - this.Uuid = uid; - this.TreeName = name; - } - - public Either commit (TreeNode newRoot, TreeOperationLog log) { - long currentRevision = this.TContext.getRevision(); - long nextRevision = currentRevision + 1; - - ChangeList list = new InnerChangeList(this.Uuid, this.TreeName); - - InterfaceTraverser traverser = new InterfaceTraverser(newRoot, true); - // not create index. - TreeContext newTreeContext = new DefaultTreeContext(newRoot, this.TContext, list, this.Uuid, this.TreeName, nextRevision, traverser); - if (this.Repository.CompareAndSet(newTreeContext.prev(), newTreeContext)) { - TransactionManager txmanager = new NetworkTransactionManager(this.TreeName, this.Writer, newTreeContext, this.Repository, this.Uuid); - return DefaultEither.newB(txmanager); - } - - return DefaultEither.newA((Error) new DefaultError()); - } - - public long getRevision () { - return this.TContext.getRevision(); - } - - public string getUUID () { - return this.Uuid; - } - - public Either firstcommit(TreeNode _newRoot, TreeOperationLog _log) { - return null; - } - - public class InnerChangeList : ChangeList { - string uuid; - string name; - - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - // construct - public InnerChangeList(string _uuid, string _name) { - this.uuid = _uuid; - this.name = _name; - } - - public IEnumerator iterator() { - List nil = new List(); - return nil.iterator(); - } - - public string uuids() { - return uuid; - } - - public string getTreeName() { - return name; - } - - public TreeOperationLog getLog() { - return new DefaultTreeOperationLog(); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkTransactionManager.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/transaction/NetworkTransactionManager.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 84df57b577c4b4a4c9ef7d483e6f0bc1 +timeCreated: 1478444955 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungle.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungle.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System; -using UnityEngine; - -public class DefaultJungle : Jungle { - private Journal journal; - private TreeMap 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 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 TreeMap (); - this.uuid = uuid; - this.editor = editor; - } - - public JungleTree getTreeByName(string name) { - - JungleTree jungle_tree = trees.get(name); - if (jungle_tree != null) { - return jungle_tree; - } else { - Debug.Log ("そのTreeは無いようですね。"); - return null; - } - } - - public JungleTree createNewTree(string name) { - ChangeList list = new InnerChangeList(uuid,name); - 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); - if (newTree != null) { - trees = trees.put (name, newTree); - } else { - Debug.Log ("こんばんは、nullです。"); - } - return newTree; - } - - public class InnerChangeList : ChangeList { - - string uuid; - string name; - - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - // construct - public InnerChangeList(string _uuid, string _name) { - this.uuid = _uuid; - this.name = _name; - } - - public IEnumerator iterator() { - List nil = new List(); - 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 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungleTree.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/DefaultJungleTree.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ - - - -public class DefaultJungleTree : JungleTree { - - private AtomicReference repository; - private string uuid; - private ChangeListWriter writer; - private TreeEditor treeEditor; - - - public DefaultJungleTree(TreeContext tc, string uuid, ChangeListWriter writer, TreeEditor editor) { - this.repository = new AtomicReference(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>> getIndex() { - TreeContext tc = repository.Get(); - return tc.getIndex(); - } - - public long revision() { - TreeContext tc = repository.Get(); // 確かにnull どこから来てる? repositoryのインスタンスを生成してないからかも - return tc.getRevision(); - } - - public Either getOldTree(long revision) { - TreeContext tc = repository.Get(); - - for (; tc.getRevision() != revision; ) { - tc = tc.prev(); - if (tc == null) - return DefaultEither.newA(GetOldTreeError.OLD_TREE_NOT_FOUND); - } - - - string oldTreeUuid = uuid + revision; - JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, writer, treeEditor); - return DefaultEither.newB(oldTree); - } - - public Either getNodeOfPath(NodePath path) { //eitherはどちらのインターフェースをつかうか、みたいな - TreeNode node = repository.Get().getRoot(); - foreach (int 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 _bufferSize) { - // not use - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/Jungle.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/Jungle.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface Jungle { - JungleTree getTreeByName (string name); - JungleTree createNewTree (string name); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTree.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTree.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ - -public interface JungleTree { - - JungleTreeEditor getTreeEditor(); - - JungleTreeEditor getLocalTreeEditor(); - - TreeNode getRootNode(); - - long revision(); - - Either getOldTree(long revision); - - TreeMap>> getIndex(); - - InterfaceTraverser getTraverser(bool useIndex); - - Either getNodeOfPath(NodePath path); - - void setBufferSize(int _bufferSize); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/JungleTreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - -public interface JungleTreeEditor { - Either addNewChildAt(NodePath path,int pos); - Either deleteChildAt(NodePath path,int pos); - Either putAttribute(NodePath path,string key, byte[] value); - Either deleteAttribute(NodePath path,string key); - Either replaceNewRootNode(); - Either edit(NodePath path,NodeEditor editor); - Either success(); - Either flushSuccess(); - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Attributes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Attributes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -using UnityEngine; -public interface Attributes{ - byte[] get (string key); - string getString (string key); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Children.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/Children.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface Children { - Either at (int pos); - int size(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class DefaultNode : Node { - private readonly T attribute; - private readonly Node next; - //private TailNode tailNode; - - public DefaultNode(T attribute, Node next) { - this.attribute = attribute; - this.next = next; - } - - public Node getNext() { - return next; - } - - public T getAttribute() { - return attribute; - } - - public Node addLast(T attribute) { - Node node = next.addLast(attribute); - return new DefaultNode(this.attribute, node); - } - - public Node add(int currentNum, int num, T attribute) { - if (currentNum == num) { - Node newNode = new DefaultNode(attribute, this.next); - return new DefaultNode(this.attribute, newNode); - } - - Node newNodes = next.add(currentNum + 1, num, attribute); - if (newNodes == null) - return null; - - return new DefaultNode(this.attribute, newNodes); - } - - public Node delete(int currentNum, int deleteNum) { - if (currentNum == deleteNum) { - return new DefaultNode (this.attribute, this.next.getNext ()); - } - - Node newNode = next.delete (currentNum + 1, deleteNum); - if (newNode == null) { - return null; - } - return new DefaultNode(this.attribute, newNode); - } - - public Node replaceNode(int currentNum, int num, T attribute) { - if (currentNum == num) { - return new DefaultNode(attribute, this.getNext()); - } - - Node newNode = next.replaceNode(currentNum + 1, num, attribute); - if (newNode == null) { - return null; - } - return new DefaultNode(this.attribute, newNode); - } - - - public int length() { - return next.length() + 1; - } - - public T getAttribure() - { - throw new NotImplementedException(); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/List.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/List.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -public class List : IEnumerable { - private readonly Node head; - - public List() { - this.head = new headNode(); - } - - // T...はC#だとparamsらしい 可変引数型というみたいだ - public List(params T[] attributes) { - List list = new List (); - foreach (T attribute_local in attributes) { - list = list.addLast (attribute_local); - } - this.head = list.getHead (); - } - - private List(Node head) { - this.head = head; - } - - public Node getHead() { - return head; - } - - public List add(int num, T attribute) { - Node newHead = head.add(0, num, attribute); - if (newHead == null) - return this; - return new List(newHead); - } - - public List addLast(T attribute) { - Node newHead = head.addLast(attribute); - return new List(newHead); - } - - - public T index(int num) { - int count = 0; - Node currentNode = head.getNext(); - while (currentNode != null) { - if (count == num) { - return currentNode.getAttribute (); - } - currentNode = currentNode.getNext(); - count++; - } - return default(T); - } - - public IEnumerator iterator() { - Node currentNode = head.getNext(); - while (currentNode != null) { - yield return (T)currentNode.getAttribute(); - currentNode = currentNode.getNext (); - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - - public List delete(int num) { - Node newNode = head.delete(0, num); - if (newNode == null) - return this; - return new List(newNode); - } - - public List replace(int num, T attribute) { - Node newHead = head.replaceNode(0, num, attribute); - if (newHead == null) - return this; - return new List(newHead); - } - - public T tail() { - return index(length() - 1); - } - - // java code head. - public T headList() { - return index(0); - } - - public List deleteLast() { - return delete(head.length() - 1); - } - - public List deleteHead() { - return delete(0); - } - - public int length() { - return head.length(); - } - - public List append(List list) { - IEnumerator iterator = list.iterator(); - List newList = this; - while (iterator.MoveNext()) { - T attribute = iterator.Current; - newList = newList.addLast(attribute); - } - return newList; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/Node.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/Node.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - -public interface Node { - - Node getNext(); - - Node add(int currentNum, int num, T attribute); - - Node addLast(T attribute); - - Node delete(int currentNum, int num); - - Node replaceNode(int currentNum, int num, T attribute); - - int length(); - - T getAttribute(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/TailNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/TailNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class TailNode : Node { - - public Node getNext() { - return null; - } - - public T getAttribute() { - return default(T); - } - - public Node add(int currentNum, int num, T attribute) { - return null; - } - - public Node delete(int currentNum, int num) { - return null; - } - - public Node replaceNode(int currentNum, int num, T attribute) { - return null; - } - - public Node addLast(T attribute) { - return new DefaultNode (attribute, this); - } - - public T getAttribure() - { - throw new NotImplementedException(); - } - - public int length() - { - return 0; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/headNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/headNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class headNode : Node{ - private readonly Node next; - - public headNode(){ - this.next = new TailNode (); - } - - public headNode(Node next){ - this.next = next; - } - - public Node getNext(){ - return next; - } - - public T getAttribute(){ - return default(T); - } - - public Node add(int currentNum, int num, T attribute) { - if (num == 0) { - Node newNode = new DefaultNode(attribute, next); - return new headNode(newNode); - } - Node newNodes = next.add(currentNum + 1, num, attribute); - if (newNodes == null) { - return this; - } - return new headNode(newNodes); - } - - public Node addLast(T attribute) { - Node node = next.addLast(attribute); - return new headNode(node); - } - - public Node delete(int currentNum, int deleteNum) { - if (currentNum == deleteNum) { - return new headNode(this.next.getNext()); - } - - Node newNode = next.delete(currentNum + 1, deleteNum); - if (newNode == null) { - return this; - } - return new headNode(newNode); - } - - public Node replaceNode(int currentNum, int num, T attribute) { - Node nextNode = getNext(); - Node newNode = nextNode.replaceNode(currentNum, num, attribute); - if (newNode == null) - return this; - return new headNode(newNode); - } - - public int length() { - return next.length(); - } - - public T getAttribure() - { - throw new NotImplementedException(); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/BlackNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/BlackNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Collections; -using System; - -public class BlackNode - :TreeMapNode -{ - - public BlackNode (K key, V value, TreeMapNode left, TreeMapNode right) - : base (key, value, left, right) - { - } - - public override rebuildNode deleteNode () - { - EmptyNode emptyNode = new EmptyNode (key); - return new rebuildNode (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 createNode (K key, V value, TreeMapNode left, TreeMapNode right) - { - return new BlackNode (key, value, left, right); - } - - public override TreeMapNode insBalance () - { - Rotate spin = left.checkRotate (Rotate.L); - - if (spin == Rotate.R) { - TreeMapNode leftChild = new BlackNode (left.lefts ().getKey (), left.lefts ().getValue (), left.lefts ().lefts (), left.lefts ().rights ()); - TreeMapNode rightChild = new BlackNode (getKey (), getValue (), left.rights (), right); - return new RedNode (left.getKey (), left.getValue (), leftChild, rightChild); - - } else if (spin == Rotate.LR) { - TreeMapNode leftChild = new BlackNode (left.getKey (), left.getValue (), left.lefts (), left.rights ().lefts ()); - TreeMapNode rightChild = new BlackNode (getKey (), getValue (), left.rights ().rights (), right); - return new RedNode (left.rights ().getKey (), left.rights ().getValue (), leftChild, rightChild); - - } - - spin = right.checkRotate (Rotate.R); - if (spin == Rotate.L) { - TreeMapNode leftChild = new BlackNode (getKey (), getValue (), left, right.lefts ()); - TreeMapNode rightChild = new BlackNode (right.rights ().getKey (), right.rights ().getValue (), right.rights ().lefts (), right.rights ().rights ()); - return new RedNode (right.getKey (), right.getValue (), leftChild, rightChild); - - } else if (spin == Rotate.RL) { - TreeMapNode leftChild = new BlackNode (getKey (), getValue (), left, right.lefts ().lefts ()); - TreeMapNode rightChild = new BlackNode (right.getKey (), right.getValue (), right.lefts ().rights (), right.rights ()); - return new RedNode (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 replaceNode (TreeMapNode parent, Comparer ctr) - { - TreeMapNode 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 (true, newNode); - return new rebuildNode (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 (true, newNode); - return new rebuildNode (false, newNode); - } else {//子ノードが左右にある場合 二回目はここには入らない - //左の部分木の最大の値を持つNodeと自身を置き換える - TreeMapNode cur = this.lefts (); - while (cur.rights ().isNotEmpty ()) { //左の部分期の最大値を持つNodeを取得する - cur = cur.rights (); - } - if (this.lefts ().rights ().isNotEmpty ()) { //左の部分木が右の子を持っているか - rebuildNode leftSubTreeNodeRebuildNode = this.lefts ().deleteSubTreeMaxNode (null, ctr, Rotate.L);//最大値を削除した左の部分木を返す。rootはthisと同じ。 - if (leftSubTreeNodeRebuildNode.rebuilds ()) { - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode (); - TreeMapNode newParent = createNode (cur.getKey (), cur.getValue (), leftSubTreeNode, this.rights ()); - return leftSubTreeNode.deleteBalance (newParent, ctr); - } - //same name onece used. - TreeMapNode leftSubTreeNodes = leftSubTreeNodeRebuildNode.getNode (); - newNode = createNode (cur.getKey (), cur.getValue (), leftSubTreeNodes, this.rights ()); //rootをcurと入れ替えることでNodeの削除は完了する - return new rebuildNode (false, newNode); - } else { - rebuildNode leftSubTreeNodeRebuildNode = this.lefts ().replaceNode (this, ctr);//右の子がいなかった場合、左の子を昇格させるだけで良い。 - if (leftSubTreeNodeRebuildNode.rebuilds ()) { - TreeMapNode node = leftSubTreeNodeRebuildNode.getNode (); - TreeMapNode newParent = createNode (this.lefts ().getKey (), this.lefts ().getValue (), node, this.rights ()); - return node.deleteBalance (newParent, ctr); - } - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode (); - newNode = createNode (this.lefts ().getKey (), this.lefts ().getValue (), leftSubTreeNode, this.rights ()); - return new rebuildNode (false, newNode); - } - } - } -} \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyClass.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyClass.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -using System; - -namespace AssemblyCSharpfirstpass -{ - public class NULL - { - public NULL () - { - } - } -} - diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -public class EmptyNode : TreeMapNode{ - //static V values; - // Use this for initialization - public EmptyNode () - : base (default(K),default(V)) - { - } - - public EmptyNode (K key) - : base (key,default(V)) - { - } - - public override TreeMapNode lefts(){ - return new EmptyNode(); - } - - public override TreeMapNode rights(){ - return new EmptyNode(); - } - - public override bool isNotEmpty(){ - return false; - } - - public override TreeMapNode createNode(K key,V value,TreeMapNode left, TreeMapNode right){ - return new RedNode (key, value, new EmptyNode (), new EmptyNode ()); - } - - public TreeMapNode put(K k,V value){ - return new RedNode (k, value, new EmptyNode (), new EmptyNode ()); - } - - //I don't know only Comparator method. - public override rebuildNode replaceNode(TreeMapNode parent, Comparer ctr) { // not use method - return new rebuildNode(false, this); - } - - public override rebuildNode deleteNode(){ - return new rebuildNode (false, this); - } - - public override TreeMapNode 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; - } - //c# is there assert?? - //Assert.assertTrue(count <= 2 * minCount); - return minCount; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/RedNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/RedNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; -using System.Collections.Generic; - -public class RedNode : TreeMapNode{ - - // Use this for initialization - public RedNode (K key, V value, TreeMapNode left, TreeMapNode right) - : base (key, value, left, right) - { - } - - // Update is called once per frame - public override bool isNotEmpty () - { - return true; - } - - public override rebuildNode deleteNode() { - TreeMapNode emptyNode = new EmptyNode(this.getKey()); - return new rebuildNode(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 replaceNode(TreeMapNode parent, Comparer ctr) { - TreeMapNode 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(false, newNode); - } else if (!this.lefts().isNotEmpty() && this.rights().isNotEmpty()) { //右の部分木を昇格させる - newNode = rights().createNode(rights().getKey(), rights().getValue(), rights().lefts(), rights().rights()); - return new rebuildNode(false, newNode); - } else {//子ノードが左右にある場合 - //左の部分木の最大の値を持つNodeと自身を置き換える - TreeMapNode cur = this.lefts(); - - while (cur.rights().isNotEmpty()) { - cur = cur.rights(); - } - if (this.lefts().rights().isNotEmpty()) { - rebuildNode leftSubTreeNodeRebuildNode = this.lefts().deleteSubTreeMaxNode(null, ctr, Rotate.L); - if (leftSubTreeNodeRebuildNode.rebuilds()) { - TreeMapNode node = leftSubTreeNodeRebuildNode.getNode(); - TreeMapNode newParent = createNode(cur.getKey(), cur.getValue(), node, this.rights()); - return node.deleteBalance(newParent, ctr); - } - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode(); - newNode = createNode(cur.getKey(), cur.getValue(), leftSubTreeNode, this.rights()); - return new rebuildNode(false, newNode); - } else { - rebuildNode leftSubTreeNodeRebuildNode = this.lefts().replaceNode(this, ctr); - if (leftSubTreeNodeRebuildNode.rebuilds()) { - TreeMapNode node = leftSubTreeNodeRebuildNode.getNode(); - TreeMapNode newParent = createNode(this.lefts().getKey(), this.lefts().getValue(), node, this.rights()); - return node.deleteBalance(newParent, ctr); - } - TreeMapNode leftSubTreeNode = leftSubTreeNodeRebuildNode.getNode(); - newNode = createNode(cur.getKey(), cur.getValue(), leftSubTreeNode, this.rights()); - return new rebuildNode(false, newNode); - } - - } - } - - public override bool isRed() { - return true; - } - - public override TreeMapNode createNode(K key, V value, TreeMapNode left, TreeMapNode right) { - return new RedNode(key, value, left, right); - } - - public override TreeMapNode 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; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/Rotate.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/Rotate.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -using UnityEngine; -using System.Collections; - -public enum Rotate{ - R,L,RL,LR,N -} - diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMap.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMap.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -public class TreeMap { - TreeMapNode root; - Comparer comparator; - - - public TreeMap(IComparer icompere) { - this.root = new EmptyNode (); - } - - public TreeMap() { - this.root = new EmptyNode (); - this.comparator = Comparer.Default; - } - - public TreeMap(TreeMapNode root) { - this.root = root; - } - - public TreeMap(TreeMapNode root, Comparer comparator) { - this.root = root; - this.comparator = comparator; - } - - public TreeMapNode getRoot() { - return root; - } - - public V get(K key) { - return root.get(key, this.comparator); - } - - public TreeMap put(K key, V value) { - if(isEmpty()) { - TreeMapNode newRoot = new BlackNode (key, value, new EmptyNode (), new EmptyNode ()); - return new TreeMap (newRoot, this.comparator); - } - - TreeMapNode newEntry = root.put (key, value, this.comparator); - TreeMapNode newRoots = new BlackNode (newEntry.getKey (), newEntry.getValue (), newEntry.lefts (), newEntry.rights ()); - return new TreeMap (newRoots, this.comparator); - } - - public bool isEmpty() { - return !root.isNotEmpty (); - } - - public TreeMap delete(K key) { - if (key.Equals(default(K))) { - return this; - } - rebuildNode rootRebuildNode = root.delete (key, null, this.comparator, Rotate.N); - if (!rootRebuildNode.notEmpty ()) { - return this; - } - TreeMapNode roots = rootRebuildNode.getNode (); - if (!root.isNotEmpty ()) { - return new TreeMap (new EmptyNode (), this.comparator); - } - TreeMapNode newRoot = new BlackNode (roots.getKey (), roots.getValue (), roots.lefts (), roots.rights ()); - return new TreeMap (newRoot, this.comparator); - } - // like to iterator and IEmurator. - public IEnumerator keys() { - return new iterators (); - } - - - public void checkDepth() { - root.checkDepth (0, 0); - Debug.Log ("-----------------------------------"); - } - - public class iterators : IEnumerator { - Stack> nodeStack = new Stack>(); - TreeMapNode currentNode = new TreeMap().getRoot(); - public List 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; } - } - - public void Dispose() { - ((IEnumerator)this.appLines).Dispose (); - } - - public void Reset() { - ((IEnumerator)this.appLines).Reset(); - } - - } -} - - diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMapNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/TreeMapNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,332 +0,0 @@ -using System.Collections; -using System; -using UnityEngine; -using System.Collections.Generic; - - -public abstract class TreeMapNode -{ - - protected K key = default(K); - protected V value = default(V); - - public TreeMapNode right; - public TreeMapNode left; - - - // Use this for initialization - public TreeMapNode (K key, V value) - { - this.key = key; - this.value = value; - } - - public TreeMapNode (K key, V value, TreeMapNode left, TreeMapNode right) - { - this.key = key; - this.value = value; - this.right = right; - this.left = left; - } - - public virtual TreeMapNode lefts () - { - return left; - } - - - public int compare(K compareKey, Comparer ctr) { - return ctr.Compare (compareKey, this.getKey ()); - } - - public V get (K key, Comparer ctr){ - TreeMapNode cur = this; - while (cur.isNotEmpty ()) { // getでEmpty nodeを返している ? compareでKeyが0になっている - int result = cur.compare (key, ctr); - if (result > 0) { - cur = cur.rights (); - } else if (result < 0) { - cur = cur.lefts (); - } else if (result == 0) { - if (cur != null) { - return cur.getValue (); - } - } - } - return default(V); - } - - - - public virtual TreeMapNode rights () { - return right; - } - - public K getKey () { - return key; - } - - public V getValue () { - return value; - } - - public TreeMapNode put (K k, V v,Comparer ctr) { - - if (!isNotEmpty ()) { - return createNode (k, v, left, right); - } - - int result = compare (k, ctr); - if (result > 0) { - TreeMapNode node = right.put (k, v, ctr); - node = createNode (key, this.value, left, node); - return node.insBalance (); - } else if (result < 0) { - TreeMapNode node = left.put (k, v,ctr); - return createNode (key, this.value, node, right).insBalance (); - } - return createNode (key, v, left, right); - } - - public rebuildNode delete (K key, TreeMapNode parent, Comparer ctr, Rotate side) - { - if (this.isNotEmpty ()) { - rebuildNode rebuildNode = null; - 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 if (result == 0){ - rebuildNode = replaceNode (parent, ctr); - } - if (parent == null) { - return rebuildNode; - } - TreeMapNode node = rebuildNode.getNode (); - if (rebuildNode.rebuilds ()) { - // ここのエラーは後で - return node.deleteBalance (parent, ctr); - } - TreeMapNode 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 (false, newParent); - } - return null; - } - - public rebuildNode deleteSubTreeMaxNode (TreeMapNode parent, Comparer ctr, Rotate side) - { - rebuildNode rebuildNode; - TreeMapNode 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 (false, node); - } - - - public rebuildNode deleteBalance (TreeMapNode parent, Comparer ctr) - { - TreeMapNode 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 (true, newNode); - } - if (rightChild) { - newNode = rebuildfive (parent, Rotate.R); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildsix (parent, Rotate.R); - return new rebuildNode (false, newNode); - } - } else { // 左の子が赤 - newNode = rebuildTwo (parent, ctr, Rotate.R); - return new rebuildNode (false, newNode); - } - } else { // 親が赤 - if (!rightChild && !leftChild) { - newNode = rebuildFour (parent, Rotate.R); - return new rebuildNode (false, newNode); - } - if (rightChild) { - newNode = rebuildfive (parent, Rotate.R); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildsix (parent, Rotate.R); - return new rebuildNode (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 (true, newNode); - } - if (rightChild) { - newNode = rebuildsix (parent, Rotate.L); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildfive (parent, Rotate.L); - return new rebuildNode (false, newNode); - } - } else { // 左の子が赤 - newNode = rebuildTwo (parent, ctr, Rotate.L); - return new rebuildNode (false, newNode); - } - } else { // 親が赤 - if (!rightChild && !leftChild) { - newNode = rebuildFour (parent, Rotate.L); - return new rebuildNode (false, newNode); - } - if (rightChild) { - newNode = rebuildsix (parent, Rotate.L); - return new rebuildNode (false, newNode); - } else { - newNode = rebuildfive (parent, Rotate.L); - return new rebuildNode (false, newNode); - } - } - } - } - if (0 > (compare (parent.getKey (), ctr))) { - newNode = parent.createNode (parent.getKey (), parent.getValue (), parent.lefts (), this); - return new rebuildNode (false, newNode); - } else { - newNode = parent.createNode (parent.getKey (), parent.getValue (), this, parent.rights ()); - return new rebuildNode (false, newNode); - } - } - - protected TreeMapNode rebuildTwo (TreeMapNode parent, Comparer ctr, Rotate side) - { // case2 - if (side == Rotate.L) { // rotate Left - TreeMapNode node = parent.rights (); - TreeMapNode leftSubTreeRoot = node.createNode (parent.getKey (), parent.getValue (), this, node.lefts ()); // check - rebuildNode rebuildNode = new rebuildNode (false, leftSubTreeRoot); - rebuildNode leftNodeRebuildNode = this.deleteBalance (rebuildNode.getNode (), ctr); - TreeMapNode rightNode = node.rights (); - return parent.createNode (node.getKey (), node.getValue (), leftNodeRebuildNode.getNode (), rightNode); - } else { // rotate Right - TreeMapNode node = parent.lefts (); - TreeMapNode rightSubTreeRoot = node.createNode (parent.getKey (), parent.getValue (), node.rights (), this); - rebuildNode rightSubTreeRebuildNode = new rebuildNode (false, rightSubTreeRoot); - rebuildNode rightNodeRebuildNode = this.deleteBalance (rightSubTreeRebuildNode.getNode (), ctr); - TreeMapNode leftNode = node.lefts (); - return parent.createNode (node.getKey (), node.getValue (), leftNode, rightNodeRebuildNode.getNode ()); - } - } - - protected TreeMapNode rebuildThree (TreeMapNode parent, Rotate side) - { // case3 再帰 - if (side == Rotate.L) { - TreeMapNode rightNode; - if (parent.rights ().isNotEmpty ()) - rightNode = new RedNode (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts (), parent.rights ().rights ()); // check - else - rightNode = new EmptyNode (); - return parent.createNode (parent.getKey (), parent.getValue (), this, rightNode); - } else { - TreeMapNode leftNode; - if (parent.lefts ().isNotEmpty ()) - leftNode = new RedNode (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ()); // check - else - leftNode = new EmptyNode (); - return parent.createNode (parent.getKey (), parent.getValue (), leftNode, this); - } - } - - protected TreeMapNode rebuildFour (TreeMapNode parent, Rotate side) - { // case 4 - if (side == Rotate.R) { - TreeMapNode leftNode = new RedNode (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ()); - return new BlackNode (parent.getKey (), parent.getValue (), leftNode, this); - } else { - TreeMapNode rightNode = new RedNode (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts (), parent.rights ().rights ()); - return new BlackNode (parent.getKey (), parent.getValue (), this, rightNode); - } - } - - protected TreeMapNode rebuildfive (TreeMapNode parent, Rotate side) - { // case5 - if (side == Rotate.R) { // rotate Left - TreeMapNode leftChild = new RedNode (parent.lefts ().getKey (), parent.lefts ().getValue (), parent.lefts ().lefts (), parent.lefts ().rights ().lefts ()); - TreeMapNode rightChild = parent.lefts ().rights ().rights (); - TreeMapNode leftSubTreeRoot = new BlackNode (parent.lefts ().rights ().getKey (), parent.lefts ().rights ().getValue (), leftChild, rightChild); - TreeMapNode newParent = parent.createNode (parent.getKey (), parent.getValue (), leftSubTreeRoot, this); - return this.rebuildsix (newParent, Rotate.R); - } else { // rotate Right 修正済み - TreeMapNode leftChild = parent.rights ().lefts ().lefts (); - TreeMapNode rightChild = new RedNode (parent.rights ().getKey (), parent.rights ().getValue (), parent.rights ().lefts ().rights (), parent.rights ().rights ()); - TreeMapNode rightSubTreeRoot = new BlackNode (parent.rights ().lefts ().getKey (), parent.rights ().lefts ().getValue (), leftChild, rightChild); - TreeMapNode newParent = parent.createNode (parent.getKey (), parent.getValue (), this, rightSubTreeRoot); - return this.rebuildsix (newParent, Rotate.L); - } - } - - protected TreeMapNode rebuildsix (TreeMapNode parent, Rotate side) - { // case6 - if (side == Rotate.L) { // rotate Left - TreeMapNode leftChild = parent.rights ().createNode (parent.getKey (), parent.getValue (), this, parent.rights ().lefts ()); // check - TreeMapNode rightChild = new BlackNode (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 leftChild = new BlackNode (parent.lefts ().lefts ().getKey (), parent.lefts ().lefts ().getValue (), parent.lefts ().lefts ().lefts (), parent.lefts ().lefts ().rights ()); - TreeMapNode 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 createNode (K key, V value, TreeMapNode left, TreeMapNode right); - - public abstract TreeMapNode insBalance (); - - - public abstract Rotate checkRotate (Rotate side); - - public abstract bool isRed (); - - public abstract rebuildNode replaceNode (TreeMapNode parent, Comparer ctr); - - public abstract rebuildNode deleteNode (); - - // test method - public abstract int checkDepth (int count, int minCount); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/rebuildNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/rebuildNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class rebuildNode { - private bool rebuild; - TreeMapNode node; - - public rebuildNode(bool l,TreeMapNode node){ - this.rebuild = l; - this.node = node; - } - //don't same name. - public bool rebuilds(){ - return rebuild; - } - - public TreeMapNode getNode(){ - return node; - } - - public bool notEmpty(){ - return node != null; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeList.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeList.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; - -public interface ChangeList : IEnumerable { - string uuids(); - string getTreeName(); - TreeOperationLog getLog(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListReader.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListReader.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface ChangeListReader{ - ChangeListReader newReader(); - ChangeList read(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListWriter.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/ChangeListWriter.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -using UnityEngine; -using System.Collections; - -public interface ChangeListWriter { - Result write (ChangeList operations); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Journal.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Journal.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface Journal { - ChangeListReader getReader(); - ChangeListWriter getWriter(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/NullJournal.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/NullJournal.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -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 iterator() { - return null; - } - - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Result.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/Result.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - -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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/SingletonMessage.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/SingletonMessage.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class SingletonMessage : MonoBehaviour { - - public static MsgPack.ObjectPacker getInstance () { - return new MsgPack.ObjectPacker(); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -ref: refs/heads/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/config --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/config Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = false - bare = false - logallrefupdates = true - symlinks = false - ignorecase = true -[remote "origin"] - url = https://github.com/masharada/msgpack-unity.git - fetch = +refs/heads/*:refs/remotes/origin/* -[branch "master"] - remote = origin - merge = refs/heads/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/description --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/description Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/applypatch-msg.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/applypatch-msg.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh -# -# An example hook script to check the commit log message taken by -# applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. The hook is -# allowed to edit the commit message file. -# -# To enable this hook, rename this file to "applypatch-msg". - -. git-sh-setup -commitmsg="$(git rev-parse --git-path hooks/commit-msg)" -test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} -: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/commit-msg.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/commit-msg.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -#!/bin/sh -# -# An example hook script to check the commit log message. -# Called by "git commit" with one argument, the name of the file -# that has the commit message. The hook should exit with non-zero -# status after issuing an appropriate message if it wants to stop the -# commit. The hook is allowed to edit the commit message file. -# -# To enable this hook, rename this file to "commit-msg". - -# Uncomment the below to add a Signed-off-by line to the message. -# Doing this in a hook is a bad idea in general, but the prepare-commit-msg -# hook is more suited to it. -# -# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" - -# This example catches duplicate Signed-off-by lines. - -test "" = "$(grep '^Signed-off-by: ' "$1" | - sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { - echo >&2 Duplicate Signed-off-by lines. - exit 1 -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/post-update.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/post-update.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#!/bin/sh -# -# An example hook script to prepare a packed repository for use over -# dumb transports. -# -# To enable this hook, rename this file to "post-update". - -exec git update-server-info diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-applypatch.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-applypatch.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed -# by applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-applypatch". - -. git-sh-setup -precommit="$(git rev-parse --git-path hooks/pre-commit)" -test -x "$precommit" && exec "$precommit" ${1+"$@"} -: diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-commit.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-commit.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed. -# Called by "git commit" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message if -# it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-commit". - -if git rev-parse --verify HEAD >/dev/null 2>&1 -then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 -fi - -# If you want to allow non-ASCII filenames set this variable to true. -allownonascii=$(git config --bool hooks.allownonascii) - -# Redirect output to stderr. -exec 1>&2 - -# Cross platform projects tend to avoid non-ASCII filenames; prevent -# them from being added to the repository. We exploit the fact that the -# printable range starts at the space character and ends with tilde. -if [ "$allownonascii" != "true" ] && - # Note that the use of brackets around a tr range is ok here, (it's - # even required, for portability to Solaris 10's /usr/bin/tr), since - # the square bracket bytes happen to fall in the designated range. - test $(git diff --cached --name-only --diff-filter=A -z $against | - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 -then - cat <<\EOF -Error: Attempt to add a non-ASCII file name. - -This can cause problems if you want to work with people on other platforms. - -To be portable it is advisable to rename the file. - -If you know what you are doing you can disable this check using: - - git config hooks.allownonascii true -EOF - exit 1 -fi - -# If there are whitespace errors, print the offending file names and fail. -exec git diff-index --check --cached $against -- diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-push.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-push.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#!/bin/sh - -# An example hook script to verify what is about to be pushed. Called by "git -# push" after it has checked the remote status, but before anything has been -# pushed. If this script exits with a non-zero status nothing will be pushed. -# -# This hook is called with the following parameters: -# -# $1 -- Name of the remote to which the push is being done -# $2 -- URL to which the push is being done -# -# If pushing without using a named remote those arguments will be equal. -# -# Information about the commits which are being pushed is supplied as lines to -# the standard input in the form: -# -# -# -# This sample shows how to prevent push of commits where the log message starts -# with "WIP" (work in progress). - -remote="$1" -url="$2" - -z40=0000000000000000000000000000000000000000 - -while read local_ref local_sha remote_ref remote_sha -do - if [ "$local_sha" = $z40 ] - then - # Handle delete - : - else - if [ "$remote_sha" = $z40 ] - then - # New branch, examine all commits - range="$local_sha" - else - # Update to existing branch, examine new commits - range="$remote_sha..$local_sha" - fi - - # Check for WIP commit - commit=`git rev-list -n 1 --grep '^WIP' "$range"` - if [ -n "$commit" ] - then - echo >&2 "Found WIP commit in $local_ref, not pushing" - exit 1 - fi - fi -done - -exit 0 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-rebase.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/pre-rebase.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2006, 2008 Junio C Hamano -# -# The "pre-rebase" hook is run just before "git rebase" starts doing -# its job, and can prevent the command from running by exiting with -# non-zero status. -# -# The hook is called with the following parameters: -# -# $1 -- the upstream the series was forked from. -# $2 -- the branch being rebased (or empty when rebasing the current branch). -# -# This sample shows how to prevent topic branches that are already -# merged to 'next' branch from getting rebased, because allowing it -# would result in rebasing already published history. - -publish=next -basebranch="$1" -if test "$#" = 2 -then - topic="refs/heads/$2" -else - topic=`git symbolic-ref HEAD` || - exit 0 ;# we do not interrupt rebasing detached HEAD -fi - -case "$topic" in -refs/heads/??/*) - ;; -*) - exit 0 ;# we do not interrupt others. - ;; -esac - -# Now we are dealing with a topic branch being rebased -# on top of master. Is it OK to rebase it? - -# Does the topic really exist? -git show-ref -q "$topic" || { - echo >&2 "No such branch $topic" - exit 1 -} - -# Is topic fully merged to master? -not_in_master=`git rev-list --pretty=oneline ^master "$topic"` -if test -z "$not_in_master" -then - echo >&2 "$topic is fully merged to master; better remove it." - exit 1 ;# we could allow it, but there is no point. -fi - -# Is topic ever merged to next? If so you should not be rebasing it. -only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` -only_next_2=`git rev-list ^master ${publish} | sort` -if test "$only_next_1" = "$only_next_2" -then - not_in_topic=`git rev-list "^$topic" master` - if test -z "$not_in_topic" - then - echo >&2 "$topic is already up-to-date with master" - exit 1 ;# we could allow it, but there is no point. - else - exit 0 - fi -else - not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` - /usr/bin/perl -e ' - my $topic = $ARGV[0]; - my $msg = "* $topic has commits already merged to public branch:\n"; - my (%not_in_next) = map { - /^([0-9a-f]+) /; - ($1 => 1); - } split(/\n/, $ARGV[1]); - for my $elem (map { - /^([0-9a-f]+) (.*)$/; - [$1 => $2]; - } split(/\n/, $ARGV[2])) { - if (!exists $not_in_next{$elem->[0]}) { - if ($msg) { - print STDERR $msg; - undef $msg; - } - print STDERR " $elem->[1]\n"; - } - } - ' "$topic" "$not_in_next" "$not_in_master" - exit 1 -fi - -exit 0 - -################################################################ - -This sample hook safeguards topic branches that have been -published from being rewound. - -The workflow assumed here is: - - * Once a topic branch forks from "master", "master" is never - merged into it again (either directly or indirectly). - - * Once a topic branch is fully cooked and merged into "master", - it is deleted. If you need to build on top of it to correct - earlier mistakes, a new topic branch is created by forking at - the tip of the "master". This is not strictly necessary, but - it makes it easier to keep your history simple. - - * Whenever you need to test or publish your changes to topic - branches, merge them into "next" branch. - -The script, being an example, hardcodes the publish branch name -to be "next", but it is trivial to make it configurable via -$GIT_DIR/config mechanism. - -With this workflow, you would want to know: - -(1) ... if a topic branch has ever been merged to "next". Young - topic branches can have stupid mistakes you would rather - clean up before publishing, and things that have not been - merged into other branches can be easily rebased without - affecting other people. But once it is published, you would - not want to rewind it. - -(2) ... if a topic branch has been fully merged to "master". - Then you can delete it. More importantly, you should not - build on top of it -- other people may already want to - change things related to the topic as patches against your - "master", so if you need further changes, it is better to - fork the topic (perhaps with the same name) afresh from the - tip of "master". - -Let's look at this example: - - o---o---o---o---o---o---o---o---o---o "next" - / / / / - / a---a---b A / / - / / / / - / / c---c---c---c B / - / / / \ / - / / / b---b C \ / - / / / / \ / - ---o---o---o---o---o---o---o---o---o---o---o "master" - - -A, B and C are topic branches. - - * A has one fix since it was merged up to "next". - - * B has finished. It has been fully merged up to "master" and "next", - and is ready to be deleted. - - * C has not merged to "next" at all. - -We would want to allow C to be rebased, refuse A, and encourage -B to be deleted. - -To compute (1): - - git rev-list ^master ^topic next - git rev-list ^master next - - if these match, topic has not merged in next at all. - -To compute (2): - - git rev-list master..topic - - if this is empty, it is fully merged to "master". diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/prepare-commit-msg.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/prepare-commit-msg.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#!/bin/sh -# -# An example hook script to prepare the commit log message. -# Called by "git commit" with the name of the file that has the -# commit message, followed by the description of the commit -# message's source. The hook's purpose is to edit the commit -# message file. If the hook fails with a non-zero status, -# the commit is aborted. -# -# To enable this hook, rename this file to "prepare-commit-msg". - -# This hook includes three examples. The first comments out the -# "Conflicts:" part of a merge commit. -# -# The second includes the output of "git diff --name-status -r" -# into the message, just before the "git status" output. It is -# commented because it doesn't cope with --amend or with squashed -# commits. -# -# The third example adds a Signed-off-by line to the message, that can -# still be edited. This is rarely a good idea. - -case "$2,$3" in - merge,) - /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; - -# ,|template,) -# /usr/bin/perl -i.bak -pe ' -# print "\n" . `git diff --cached --name-status -r` -# if /^#/ && $first++ == 0' "$1" ;; - - *) ;; -esac - -# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/update.sample --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/hooks/update.sample Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -#!/bin/sh -# -# An example hook script to block unannotated tags from entering. -# Called by "git receive-pack" with arguments: refname sha1-old sha1-new -# -# To enable this hook, rename this file to "update". -# -# Config -# ------ -# hooks.allowunannotated -# This boolean sets whether unannotated tags will be allowed into the -# repository. By default they won't be. -# hooks.allowdeletetag -# This boolean sets whether deleting tags will be allowed in the -# repository. By default they won't be. -# hooks.allowmodifytag -# This boolean sets whether a tag may be modified after creation. By default -# it won't be. -# hooks.allowdeletebranch -# This boolean sets whether deleting branches will be allowed in the -# repository. By default they won't be. -# hooks.denycreatebranch -# This boolean sets whether remotely creating branches will be denied -# in the repository. By default this is allowed. -# - -# --- Command line -refname="$1" -oldrev="$2" -newrev="$3" - -# --- Safety check -if [ -z "$GIT_DIR" ]; then - echo "Don't run this script from the command line." >&2 - echo " (if you want, you could supply GIT_DIR then run" >&2 - echo " $0 )" >&2 - exit 1 -fi - -if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then - echo "usage: $0 " >&2 - exit 1 -fi - -# --- Config -allowunannotated=$(git config --bool hooks.allowunannotated) -allowdeletebranch=$(git config --bool hooks.allowdeletebranch) -denycreatebranch=$(git config --bool hooks.denycreatebranch) -allowdeletetag=$(git config --bool hooks.allowdeletetag) -allowmodifytag=$(git config --bool hooks.allowmodifytag) - -# check for no description -projectdesc=$(sed -e '1q' "$GIT_DIR/description") -case "$projectdesc" in -"Unnamed repository"* | "") - echo "*** Project description file hasn't been set" >&2 - exit 1 - ;; -esac - -# --- Check types -# if $newrev is 0000...0000, it's a commit to delete a ref. -zero="0000000000000000000000000000000000000000" -if [ "$newrev" = "$zero" ]; then - newrev_type=delete -else - newrev_type=$(git cat-file -t $newrev) -fi - -case "$refname","$newrev_type" in - refs/tags/*,commit) - # un-annotated tag - short_refname=${refname##refs/tags/} - if [ "$allowunannotated" != "true" ]; then - echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 - echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 - exit 1 - fi - ;; - refs/tags/*,delete) - # delete tag - if [ "$allowdeletetag" != "true" ]; then - echo "*** Deleting a tag is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/tags/*,tag) - # annotated tag - if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 - then - echo "*** Tag '$refname' already exists." >&2 - echo "*** Modifying a tag is not allowed in this repository." >&2 - exit 1 - fi - ;; - refs/heads/*,commit) - # branch - if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then - echo "*** Creating a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/heads/*,delete) - # delete branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/remotes/*,commit) - # tracking branch - ;; - refs/remotes/*,delete) - # delete tracking branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a tracking branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - *) - # Anything else (is there anything else?) - echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 - exit 1 - ;; -esac - -# --- Finished -exit 0 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/index Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/index has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/info/exclude --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/info/exclude Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/logs/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/logs/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000000000000000000000000000000000000000 e7c80cc200584b818c491a184cfc6f2b5f9e17a8 Kazuma Takeda 1477164441 +0900 clone: from https://github.com/masharada/msgpack-unity.git diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/logs/refs/heads/master --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/logs/refs/heads/master Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000000000000000000000000000000000000000 e7c80cc200584b818c491a184cfc6f2b5f9e17a8 Kazuma Takeda 1477164441 +0900 clone: from https://github.com/masharada/msgpack-unity.git diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/logs/refs/remotes/origin/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/logs/refs/remotes/origin/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000000000000000000000000000000000000000 e7c80cc200584b818c491a184cfc6f2b5f9e17a8 Kazuma Takeda 1477164441 +0900 clone: from https://github.com/masharada/msgpack-unity.git diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/00/c8e51cd16ac10c74dd2f9974e6261ae72dfe4c --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/00/c8e51cd16ac10c74dd2f9974e6261ae72dfe4c Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -xSn0 5 -"촇[Ѓf.E8Bɓ^/a_8Iv-|QJ -w~/`|bt~7g0Q 3V,fP 5BX>]dh -. B1ht[р*TCZXR,Hޖ*E[}*>xj J(Ы@# vu]k^ ntO.Nh-^ICrDIRBԠ ŜfʵN|V\- 2LZgdRWuJtgBA?!pQ<"n bΖ4&u3}p7zH~d4hJָ`EqS)ISy%r\@HhL-̘R! n‹ y^e97níU))e=O-ZWƟUB^CZp/d۽Ez ˦$Q i|}2|:#${||B6>G } -UPɓ8,J5jѱ|DӻL'u~M6OV*\,%}P< ~WGI&" *2C3Ìj#TV\- uSiqV MПon:߄qnxϣm`}: :7̣'܆Nrn\J2)uTk[R"αLUL!XJ2>uDӎZ. yW/[t \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/05/4668352f9f1e28268bc74604ad4c73a3a24e74 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/05/4668352f9f1e28268bc74604ad4c73a3a24e74 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/18/17b354ce3301394fc5af5f8a2a17b690812ec1 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/18/17b354ce3301394fc5af5f8a2a17b690812ec1 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/1f/116ad7ca93823183d33d8223139c717df069c3 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/1f/116ad7ca93823183d33d8223139c717df069c3 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/2d/f9bb3e0866da49532c79177f5a2febd5b8973e Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/2d/f9bb3e0866da49532c79177f5a2febd5b8973e has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/30/6b516bef3bf54505433f44b53d4fc99311ecd6 --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/30/6b516bef3bf54505433f44b53d4fc99311ecd6 Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -xUR͎0<Ũ'JESmIQ'45 h+0.|ߏVpů?$JXj3Zn../G q@Ț+RjUM 5X2! 'X+/eOջ@1:Ai#`{n "T3-=K8']zqf?hm Inm̸d-Wyz-#w%җ-G@#*,Ehh X yY5 pzt%69}> yZ@V}Zd"@?m,$/i D&,>WPo[<읡\54+Y%؅N;OHaGN&X㥔*5{43})a{bݍ]Gjh=G75 \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/34/d46e7bef952bd8fabb5f2847d7a283855b83fe --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/34/d46e7bef952bd8fabb5f2847d7a283855b83fe Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -x}Sn06y^RIbT25ݦ !产,=<m]UVs3_|ϯq1 UQk,QLĚUr.8J (5 `J.Q$EuN[EJذP$a`)rXX`#T®N9C-#8i8*bntM'8='m˅k`YlNFsV2TYBf}0ji+\c$@43&3H!I;~&iߑ\%\ xRLa8$d2,i^-K@6%.Rt,Φ@.S4,C jI@ԐG7akCaXכ)4BG5G4Xx +iktӃ? J0Xy Gk6zby$%KOC|iG-lyNo:6^ϧʼn~%GwNvWtϠnX6t Mg_F8j:ԍK'/aLom?vVw_ \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/46/d080685b602b8ccec7a343da7c62256c35ad0c Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/46/d080685b602b8ccec7a343da7c62256c35ad0c has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/50/bcb39015be539af4a654036cef49a5f08c0321 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/50/bcb39015be539af4a654036cef49a5f08c0321 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/57/543770118822a5eb91efa7cac5037297df169d Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/57/543770118822a5eb91efa7cac5037297df169d has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/5e/618130994ffb0591f53545cf84a89f552df84f Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/5e/618130994ffb0591f53545cf84a89f552df84f has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/5e/cbb52610087bad1c48572c99c998a4928013d5 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/5e/cbb52610087bad1c48572c99c998a4928013d5 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/61/c2225fc4a2b7742c3b8d3ec6cb6f78aac73868 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/61/c2225fc4a2b7742c3b8d3ec6cb6f78aac73868 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/6c/4d4e0b98bd4200dea587f867232aaf94fb7efa Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/6c/4d4e0b98bd4200dea587f867232aaf94fb7efa has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/79/4aff4f6de364bc022a7653c2cde3116f184e8f Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/79/4aff4f6de364bc022a7653c2cde3116f184e8f has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/79/a31fc6b0d5d061f5151d9e1ada8e54346e2c98 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/79/a31fc6b0d5d061f5151d9e1ada8e54346e2c98 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/8c/c971fe5e16554747f616b1f65e26103b5f71ec Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/8c/c971fe5e16554747f616b1f65e26103b5f71ec has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/9a/c0ec3d0fb15a1b74cb749b1d25189f5bab7ff1 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/9a/c0ec3d0fb15a1b74cb749b1d25189f5bab7ff1 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/9c/6d483546704aaa1453f57ca14c6471830c91ac Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/9c/6d483546704aaa1453f57ca14c6471830c91ac has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/a7/c97a61698cdf1839fcdcd447b37ecdd4ffd88e Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/a7/c97a61698cdf1839fcdcd447b37ecdd4ffd88e has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/ae/899d9608dcb968d6073329c2cd45a4b9b825de Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/ae/899d9608dcb968d6073329c2cd45a4b9b825de has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/be/c4d4c4558d625539410a5b3a2e69f48ec48f48 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/be/c4d4c4558d625539410a5b3a2e69f48ec48f48 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/d5/40b060aeccc5b4e1ab26aec45267e8ae7393c2 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/d5/40b060aeccc5b4e1ab26aec45267e8ae7393c2 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/e7/c80cc200584b818c491a184cfc6f2b5f9e17a8 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/e7/c80cc200584b818c491a184cfc6f2b5f9e17a8 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/e9/8430e1f9a9d93e5971d6e65d0d70a771e6a070 Binary file src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/objects/e9/8430e1f9a9d93e5971d6e65d0d70a771e6a070 has changed diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/packed-refs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/packed-refs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# pack-refs with: peeled fully-peeled -e7c80cc200584b818c491a184cfc6f2b5f9e17a8 refs/remotes/origin/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/refs/heads/master --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/refs/heads/master Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -e7c80cc200584b818c491a184cfc6f2b5f9e17a8 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/refs/remotes/origin/HEAD --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.git/refs/remotes/origin/HEAD Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -ref: refs/remotes/origin/master diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.gitignore --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/.gitignore Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) -bin -obj - -# mstest test results -TestResults \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/README.md --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/README.md Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -# MessagePack for Unity - -## What is it? - -This is MessagePack serialization/deserialization for Unity (or Unity Pro.) - -This library is based on Kazuki's MessagePack for C# -(not the current official for CLI, because it depends on .NET framework 4.0.) - -## Install - -To install this, copy files in src to Assets folder in your project. - -## See also - - Official Library : https://github.com/msgpack/msgpack - - Original C# Implementation : https://github.com/kazuki/msgpack - -## License - - Copyright (C) 2011-2012 Kazuki Oikawa, Kazunari Kida - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/BoxingPacker.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/BoxingPacker.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Reflection; - -namespace MsgPack -{ - public class BoxingPacker - { - static Type KeyValuePairDefinitionType; - - static BoxingPacker () - { - KeyValuePairDefinitionType = typeof (KeyValuePair).GetGenericTypeDefinition (); - } - - public void Pack (Stream strm, object o) - { - MsgPackWriter writer = new MsgPackWriter (strm); - Pack (writer, o); - } - - public byte[] Pack (object o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - void Pack (MsgPackWriter writer, object o) - { - if (o == null) { - writer.WriteNil (); - return; - } - - Type t = o.GetType (); - if (t.IsPrimitive) { - if (t.Equals (typeof (int))) writer.Write ((int)o); - else if (t.Equals (typeof (uint))) writer.Write ((uint)o); - else if (t.Equals (typeof (float))) writer.Write ((float)o); - else if (t.Equals (typeof (double))) writer.Write ((double)o); - else if (t.Equals (typeof (long))) writer.Write ((long)o); - else if (t.Equals (typeof (ulong))) writer.Write ((ulong)o); - else if (t.Equals (typeof (bool))) writer.Write ((bool)o); - else if (t.Equals (typeof (byte))) writer.Write ((byte)o); - else if (t.Equals (typeof (sbyte))) writer.Write ((sbyte)o); - else if (t.Equals (typeof (short))) writer.Write ((short)o); - else if (t.Equals (typeof (ushort))) writer.Write ((ushort)o); - else throw new NotSupportedException (); // char? - return; - } - - IDictionary dic = o as IDictionary; - if (dic != null) { - writer.WriteMapHeader (dic.Count); - foreach (System.Collections.DictionaryEntry e in dic) { - Pack (writer, e.Key); - Pack (writer, e.Value); - } - return; - } - - if (t.IsArray) { - Array ary = (Array)o; - Type et = t.GetElementType (); - - // KeyValuePair[] (Map Type) - if (et.IsGenericType && et.GetGenericTypeDefinition ().Equals (KeyValuePairDefinitionType)) { - PropertyInfo propKey = et.GetProperty ("Key"); - PropertyInfo propValue = et.GetProperty ("Value"); - writer.WriteMapHeader (ary.Length); - for (int i = 0; i < ary.Length; i ++) { - object e = ary.GetValue (i); - Pack (writer, propKey.GetValue (e, null)); - Pack (writer, propValue.GetValue (e, null)); - } - return; - } - - // Array - writer.WriteArrayHeader (ary.Length); - for (int i = 0; i < ary.Length; i ++) - Pack (writer, ary.GetValue (i)); - return; - } - } - - public object Unpack (Stream strm) - { - MsgPackReader reader = new MsgPackReader (strm); - return Unpack (reader); - } - - public object Unpack (byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (ms); - } - } - - public object Unpack (byte[] buf) - { - return Unpack (buf, 0, buf.Length); - } - - object Unpack (MsgPackReader reader) - { - if (!reader.Read ()) - throw new FormatException (); - - switch (reader.Type) { - case TypePrefixes.PositiveFixNum: - case TypePrefixes.NegativeFixNum: - case TypePrefixes.Int8: - case TypePrefixes.Int16: - case TypePrefixes.Int32: - return reader.ValueSigned; - case TypePrefixes.Int64: - return reader.ValueSigned64; - case TypePrefixes.UInt8: - case TypePrefixes.UInt16: - case TypePrefixes.UInt32: - return reader.ValueUnsigned; - case TypePrefixes.UInt64: - return reader.ValueUnsigned64; - case TypePrefixes.True: - return true; - case TypePrefixes.False: - return false; - case TypePrefixes.Float: - return reader.ValueFloat; - case TypePrefixes.Double: - return reader.ValueDouble; - case TypePrefixes.Nil: - return null; - case TypePrefixes.FixRaw: - case TypePrefixes.Raw16: - case TypePrefixes.Raw32: - byte[] raw = new byte[reader.Length]; - reader.ReadValueRaw (raw, 0, raw.Length); - return raw; - case TypePrefixes.FixArray: - case TypePrefixes.Array16: - case TypePrefixes.Array32: - object[] ary = new object[reader.Length]; - for (int i = 0; i < ary.Length; i ++) - ary[i] = Unpack (reader); - return ary; - case TypePrefixes.FixMap: - case TypePrefixes.Map16: - case TypePrefixes.Map32: - IDictionary dic = new Dictionary ((int)reader.Length); - int count = (int)reader.Length; - for (int i = 0; i < count; i ++) { - object k = Unpack (reader); - object v = Unpack (reader); - dic.Add (k, v); - } - return dic; - default: - throw new FormatException (); - } - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/CompiledPacker.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/CompiledPacker.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,549 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Reflection.Emit; -using System.Threading; -using MsgPack.Compiler; - -namespace MsgPack -{ - public class CompiledPacker - { - static PackerBase _publicFieldPacker, _allFieldPacker; - PackerBase _packer; - - static CompiledPacker () - { - _publicFieldPacker = new MethodBuilderPacker (); - _allFieldPacker = new DynamicMethodPacker (); - } - - public CompiledPacker () : this (false) {} - public CompiledPacker (bool packPrivateField) - { - _packer = (packPrivateField ? _allFieldPacker : _publicFieldPacker); - } - - public void Prepare () - { - _packer.CreatePacker (); - _packer.CreateUnpacker (); - } - - #region Generics Pack/Unpack Methods - public byte[] Pack (T o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - public void Pack (Stream strm, T o) - { - _packer.CreatePacker () (new MsgPackWriter (strm), o); - } - - public T Unpack (byte[] buf) - { - return Unpack (buf, 0, buf.Length); - } - - public T Unpack (byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (ms); - } - } - - public T Unpack (Stream strm) - { - return _packer.CreateUnpacker () (new MsgPackReader (strm)); - } - #endregion - - #region Non-generics Pack/Unpack Methods - public byte[] Pack (object o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - public void Pack (Stream strm, object o) - { - throw new NotImplementedException (); - } - - public object Unpack (Type t, byte[] buf) - { - return Unpack (t, buf, 0, buf.Length); - } - - public object Unpack (Type t, byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (t, ms); - } - } - - public object Unpack (Type t, Stream strm) - { - throw new NotImplementedException (); - } - #endregion - - #region Compiled Packer Implementations - public abstract class PackerBase - { - Dictionary _packers = new Dictionary (); - Dictionary _unpackers = new Dictionary (); - - protected Dictionary _packMethods = new Dictionary (); - protected Dictionary _unpackMethods = new Dictionary (); - - protected PackerBase () - { - DefaultPackMethods.Register (_packMethods, _unpackMethods); - } - - public Action CreatePacker () - { - Delegate d; - lock (_packers) { - if (!_packers.TryGetValue (typeof (T), out d)) { - d = CreatePacker_Internal (); - _packers.Add (typeof (T), d); - } - } - return (Action)d; - } - - public Func CreateUnpacker () - { - Delegate d; - lock (_unpackers) { - if (!_unpackers.TryGetValue (typeof (T), out d)) { - d = CreateUnpacker_Internal (); - _unpackers.Add (typeof (T), d); - } - } - return (Func)d; - } - - protected abstract Action CreatePacker_Internal (); - protected abstract Func CreateUnpacker_Internal (); - } - public sealed class DynamicMethodPacker : PackerBase - { - private static MethodInfo LookupMemberMappingMethod; - static Dictionary> UnpackMemberMappings; - - static DynamicMethodPacker () - { - UnpackMemberMappings = new Dictionary> (); - LookupMemberMappingMethod = typeof (DynamicMethodPacker).GetMethod ("LookupMemberMapping", BindingFlags.Static | BindingFlags.NonPublic); - } - - public DynamicMethodPacker () : base () - { - } - - protected override Action CreatePacker_Internal () - { - DynamicMethod dm = CreatePacker (typeof (T), CreatePackDynamicMethod (typeof (T))); - return (Action)dm.CreateDelegate (typeof (Action)); - } - - protected override Func CreateUnpacker_Internal () - { - DynamicMethod dm = CreateUnpacker (typeof (T), CreateUnpackDynamicMethod (typeof (T))); - return (Func)dm.CreateDelegate (typeof (Func)); - } - - DynamicMethod CreatePacker (Type t, DynamicMethod dm) - { - ILGenerator il = dm.GetILGenerator (); - _packMethods.Add (t, dm); - PackILGenerator.EmitPackCode (t, dm, il, LookupMembers, FormatMemberName, LookupPackMethod); - return dm; - } - - DynamicMethod CreateUnpacker (Type t, DynamicMethod dm) - { - ILGenerator il = dm.GetILGenerator (); - _unpackMethods.Add (t, dm); - PackILGenerator.EmitUnpackCode (t, dm, il, LookupMembers, FormatMemberName, LookupUnpackMethod, - LookupMemberMapping, LookupMemberMappingMethod); - return dm; - } - - static DynamicMethod CreatePackDynamicMethod (Type t) - { - return CreateDynamicMethod (typeof (void), new Type[] {typeof (MsgPackWriter), t}); - } - - static DynamicMethod CreateUnpackDynamicMethod (Type t) - { - return CreateDynamicMethod (t, new Type[] {typeof (MsgPackReader)}); - } - - static MemberInfo[] LookupMembers (Type t) - { - BindingFlags baseFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; - System.Collections.Generic.List list = new System.Collections.Generic.List (); - list.AddRange (t.GetFields (baseFlags)); - // TODO: Add NonSerialized Attribute Filter ? - return list.ToArray (); - } - - MethodInfo LookupPackMethod (Type t) - { - MethodInfo mi; - DynamicMethod dm; - if (_packMethods.TryGetValue (t, out mi)) - return mi; - dm = CreatePackDynamicMethod (t); - return CreatePacker (t, dm); - } - - MethodInfo LookupUnpackMethod (Type t) - { - MethodInfo mi; - if (_unpackMethods.TryGetValue (t, out mi)) - return mi; - DynamicMethod dm = CreateUnpackDynamicMethod (t); - return CreateUnpacker (t, dm); - } - - static string FormatMemberName (MemberInfo m) - { - if (m.MemberType != MemberTypes.Field) - return m.Name; - - int pos; - string name = m.Name; - if (name[0] == '<' && (pos = name.IndexOf ('>')) > 1) - name = name.Substring (1, pos - 1); // Auto-Property (\<.+\>) - return name; - } - - static int _dynamicMethodIdx = 0; - static DynamicMethod CreateDynamicMethod (Type returnType, Type[] parameterTypes) - { - string name = "_" + Interlocked.Increment (ref _dynamicMethodIdx).ToString (); - return new DynamicMethod (name, returnType, parameterTypes, true); - } - - internal static IDictionary LookupMemberMapping (Type t) - { - IDictionary mapping; - lock (UnpackMemberMappings) { - if (!UnpackMemberMappings.TryGetValue (t, out mapping)) { - mapping = new Dictionary (); - UnpackMemberMappings.Add (t, mapping); - } - } - return mapping; - } - } - public sealed class MethodBuilderPacker : PackerBase - { - public const string AssemblyName = "MessagePackInternalAssembly"; - static AssemblyName DynamicAsmName; - static AssemblyBuilder DynamicAsmBuilder; - static ModuleBuilder DynamicModuleBuilder; - - private static MethodInfo LookupMemberMappingMethod; - static Dictionary> UnpackMemberMappings; - - static MethodBuilderPacker () - { - UnpackMemberMappings = new Dictionary> (); - LookupMemberMappingMethod = typeof (MethodBuilderPacker).GetMethod ("LookupMemberMapping", BindingFlags.Static | BindingFlags.NonPublic); - - DynamicAsmName = new AssemblyName (AssemblyName); - DynamicAsmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (DynamicAsmName, AssemblyBuilderAccess.Run); - DynamicModuleBuilder = DynamicAsmBuilder.DefineDynamicModule (DynamicAsmName.Name); - } - - public MethodBuilderPacker () : base () - { - } - - protected override Action CreatePacker_Internal () - { - TypeBuilder tb; - MethodBuilder mb; - CreatePackMethodBuilder (typeof (T), out tb, out mb); - _packMethods.Add (typeof (T), mb); - CreatePacker (typeof (T), mb); - MethodInfo mi = ToCallableMethodInfo (typeof (T), tb, true); - return (Action)Delegate.CreateDelegate (typeof (Action), mi); - } - - protected override Func CreateUnpacker_Internal () - { - TypeBuilder tb; - MethodBuilder mb; - CreateUnpackMethodBuilder (typeof (T), out tb, out mb); - _unpackMethods.Add (typeof (T), mb); - CreateUnpacker (typeof (T), mb); - MethodInfo mi = ToCallableMethodInfo (typeof (T), tb, false); - return (Func)Delegate.CreateDelegate (typeof (Func), mi); - } - - void CreatePacker (Type t, MethodBuilder mb) - { - ILGenerator il = mb.GetILGenerator (); - PackILGenerator.EmitPackCode (t, mb, il, LookupMembers, FormatMemberName, LookupPackMethod); - } - - void CreateUnpacker (Type t, MethodBuilder mb) - { - ILGenerator il = mb.GetILGenerator (); - PackILGenerator.EmitUnpackCode (t, mb, il, LookupMembers, FormatMemberName, LookupUnpackMethod, - LookupMemberMapping, LookupMemberMappingMethod); - } - - MethodInfo ToCallableMethodInfo (Type t, TypeBuilder tb, bool isPacker) - { - Type type = tb.CreateType (); - MethodInfo mi = type.GetMethod (isPacker ? "Pack" : "Unpack", BindingFlags.Static | BindingFlags.Public); - if (isPacker) { - _packMethods[t] = mi; - } else { - _unpackMethods[t] = mi; - } - return mi; - } - - MethodInfo LookupPackMethod (Type t) - { - MethodInfo mi; - TypeBuilder tb; - MethodBuilder mb; - if (_packMethods.TryGetValue (t, out mi)) - return mi; - CreatePackMethodBuilder (t, out tb, out mb); - _packMethods.Add (t, mb); - CreatePacker (t, mb); - return ToCallableMethodInfo (t, tb, true); - } - - MethodInfo LookupUnpackMethod (Type t) - { - MethodInfo mi; - TypeBuilder tb; - MethodBuilder mb; - if (_unpackMethods.TryGetValue (t, out mi)) - return mi; - CreateUnpackMethodBuilder (t, out tb, out mb); - _unpackMethods.Add (t, mb); - CreateUnpacker (t, mb); - return ToCallableMethodInfo (t, tb, false); - } - - static string FormatMemberName (MemberInfo m) - { - return m.Name; - } - - static MemberInfo[] LookupMembers (Type t) - { - BindingFlags baseFlags = BindingFlags.Instance | BindingFlags.Public; - System.Collections.Generic.List list = new System.Collections.Generic.List (); - list.AddRange (t.GetFields (baseFlags)); - // TODO: Add NonSerialized Attribute Filter ? - return list.ToArray (); - } - - static void CreatePackMethodBuilder (Type t, out TypeBuilder tb, out MethodBuilder mb) - { - tb = DynamicModuleBuilder.DefineType (t.Name + "PackerType", TypeAttributes.Public); - mb = tb.DefineMethod ("Pack", MethodAttributes.Static | MethodAttributes.Public, typeof (void), new Type[] {typeof (MsgPackWriter), t}); - } - - static void CreateUnpackMethodBuilder (Type t, out TypeBuilder tb, out MethodBuilder mb) - { - tb = DynamicModuleBuilder.DefineType (t.Name + "UnpackerType", TypeAttributes.Public); - mb = tb.DefineMethod ("Unpack", MethodAttributes.Static | MethodAttributes.Public, t, new Type[] {typeof (MsgPackReader)}); - } - - internal static IDictionary LookupMemberMapping (Type t) - { - IDictionary mapping; - lock (UnpackMemberMappings) { - if (!UnpackMemberMappings.TryGetValue (t, out mapping)) { - mapping = new Dictionary (); - UnpackMemberMappings.Add (t, mapping); - } - } - return mapping; - } - } - #endregion - - #region default pack/unpack methods - internal static class DefaultPackMethods - { - public static void Register (Dictionary packMethods, Dictionary unpackMethods) - { - RegisterPackMethods (packMethods); - RegisterUnpackMethods (unpackMethods); - } - - #region Pack - static void RegisterPackMethods (Dictionary packMethods) - { - Type type = typeof (DefaultPackMethods); - MethodInfo[] methods = type.GetMethods (BindingFlags.Static | BindingFlags.NonPublic); - string methodName = "Pack"; - for (int i = 0; i < methods.Length; i ++) { - if (!methodName.Equals (methods[i].Name)) - continue; - ParameterInfo[] parameters = methods[i].GetParameters (); - if (parameters.Length != 2 || parameters[0].ParameterType != typeof (MsgPackWriter)) - continue; - packMethods.Add (parameters[1].ParameterType, methods[i]); - } - } - - internal static void Pack (MsgPackWriter writer, string x) - { - if (x == null) { - writer.WriteNil (); - } else { - writer.Write (x, false); - } - } - #endregion - - #region Unpack - static void RegisterUnpackMethods (Dictionary unpackMethods) - { - BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic; - Type type = typeof (DefaultPackMethods); - MethodInfo mi = type.GetMethod ("Unpack_Signed", flags); - unpackMethods.Add (typeof (sbyte), mi); - unpackMethods.Add (typeof (short), mi); - unpackMethods.Add (typeof (int), mi); - - mi = type.GetMethod ("Unpack_Signed64", flags); - unpackMethods.Add (typeof (long), mi); - - mi = type.GetMethod ("Unpack_Unsigned", flags); - unpackMethods.Add (typeof (byte), mi); - unpackMethods.Add (typeof (ushort), mi); - unpackMethods.Add (typeof (char), mi); - unpackMethods.Add (typeof (uint), mi); - - mi = type.GetMethod ("Unpack_Unsigned64", flags); - unpackMethods.Add (typeof (ulong), mi); - - mi = type.GetMethod ("Unpack_Boolean", flags); - unpackMethods.Add (typeof (bool), mi); - - mi = type.GetMethod ("Unpack_Float", flags); - unpackMethods.Add (typeof (float), mi); - - mi = type.GetMethod ("Unpack_Double", flags); - unpackMethods.Add (typeof (double), mi); - - mi = type.GetMethod ("Unpack_String", flags); - unpackMethods.Add (typeof (string), mi); - } - - internal static int Unpack_Signed (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsSigned ()) - UnpackFailed (); - return reader.ValueSigned; - } - - internal static long Unpack_Signed64 (MsgPackReader reader) - { - if (!reader.Read ()) - UnpackFailed (); - if (reader.IsSigned ()) - return reader.ValueSigned; - if (reader.IsSigned64 ()) - return reader.ValueSigned64; - UnpackFailed (); - return 0; // unused - } - - internal static uint Unpack_Unsigned (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsUnsigned ()) - UnpackFailed (); - return reader.ValueUnsigned; - } - - internal static ulong Unpack_Unsigned64 (MsgPackReader reader) - { - if (!reader.Read ()) - UnpackFailed (); - if (reader.IsUnsigned ()) - return reader.ValueUnsigned; - if (reader.IsUnsigned64 ()) - return reader.ValueUnsigned64; - UnpackFailed (); - return 0; // unused - } - - internal static bool Unpack_Boolean (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsBoolean ()) - UnpackFailed (); - return reader.ValueBoolean; - } - - internal static float Unpack_Float (MsgPackReader reader) - { - if (!reader.Read () || reader.Type != TypePrefixes.Float) - UnpackFailed (); - return reader.ValueFloat; - } - - internal static double Unpack_Double (MsgPackReader reader) - { - if (!reader.Read () || reader.Type != TypePrefixes.Double) - UnpackFailed (); - return reader.ValueDouble; - } - - internal static string Unpack_String (MsgPackReader reader) - { - if (!reader.Read () || !reader.IsRaw ()) - UnpackFailed (); - return reader.ReadRawString (); - } - - internal static void UnpackFailed () - { - throw new FormatException (); - } - #endregion - } - #endregion - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/EmitExtensions.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/EmitExtensions.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Reflection; -using System.Reflection.Emit; - -namespace MsgPack.Compiler -{ - public static class EmitExtensions - { - public static void EmitLd (this ILGenerator il, Variable v) - { - switch (v.VarType) { - case VariableType.Arg: - EmitLdarg (il, v); - break; - case VariableType.Local: - EmitLdloc (il, v); - break; - default: - throw new ArgumentException (); - } - } - - public static void EmitLd (this ILGenerator il, params Variable[] list) - { - for (int i = 0; i < list.Length; i ++) - EmitLd (il, list[i]); - } - - public static void EmitLdarg (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Arg) - throw new ArgumentException (); - - switch (v.Index) { - case 0: il.Emit (OpCodes.Ldarg_0); return; - case 1: il.Emit (OpCodes.Ldarg_1); return; - case 2: il.Emit (OpCodes.Ldarg_2); return; - case 3: il.Emit (OpCodes.Ldarg_3); return; - } - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Ldarg_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Ldarg, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitLdloc (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Local) - throw new ArgumentException (); - - switch (v.Index) { - case 0: il.Emit (OpCodes.Ldloc_0); return; - case 1: il.Emit (OpCodes.Ldloc_1); return; - case 2: il.Emit (OpCodes.Ldloc_2); return; - case 3: il.Emit (OpCodes.Ldloc_3); return; - } - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Ldloc_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Ldloc, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitSt (this ILGenerator il, Variable v) - { - switch (v.VarType) { - case VariableType.Arg: - EmitStarg (il, v); - break; - case VariableType.Local: - EmitStloc (il, v); - break; - default: - throw new ArgumentException (); - } - } - - public static void EmitStarg (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Arg) - throw new ArgumentException (); - - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Starg_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Starg, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitStloc (this ILGenerator il, Variable v) - { - if (v.VarType != VariableType.Local) - throw new ArgumentException (); - - switch (v.Index) { - case 0: il.Emit (OpCodes.Stloc_0); return; - case 1: il.Emit (OpCodes.Stloc_1); return; - case 2: il.Emit (OpCodes.Stloc_2); return; - case 3: il.Emit (OpCodes.Stloc_3); return; - } - if (v.Index <= byte.MaxValue) { - il.Emit (OpCodes.Stloc_S, (byte)v.Index); - } else if (v.Index <= short.MaxValue) { - il.Emit (OpCodes.Stloc, v.Index); - } else { - throw new FormatException (); - } - } - - public static void EmitLdc (this ILGenerator il, int v) - { - switch (v) { - case 0: il.Emit (OpCodes.Ldc_I4_0); return; - case 1: il.Emit (OpCodes.Ldc_I4_1); return; - case 2: il.Emit (OpCodes.Ldc_I4_2); return; - case 3: il.Emit (OpCodes.Ldc_I4_3); return; - case 4: il.Emit (OpCodes.Ldc_I4_4); return; - case 5: il.Emit (OpCodes.Ldc_I4_5); return; - case 6: il.Emit (OpCodes.Ldc_I4_6); return; - case 7: il.Emit (OpCodes.Ldc_I4_7); return; - case 8: il.Emit (OpCodes.Ldc_I4_8); return; - case -1: il.Emit (OpCodes.Ldc_I4_M1); return; - } - if (v <= sbyte.MaxValue && v >= sbyte.MinValue) { - il.Emit (OpCodes.Ldc_I4_S, (sbyte)v); - } else { - il.Emit (OpCodes.Ldc_I4, v); - } - } - - public static void EmitLd_False (this ILGenerator il) - { - il.Emit (OpCodes.Ldc_I4_1); - } - - public static void EmitLd_True (this ILGenerator il) - { - il.Emit (OpCodes.Ldc_I4_1); - } - - public static void EmitLdstr (this ILGenerator il, string v) - { - il.Emit (OpCodes.Ldstr, v); - } - - public static void EmitLdMember (this ILGenerator il, MemberInfo m) - { - if (m.MemberType == MemberTypes.Field) { - il.Emit (OpCodes.Ldfld, (FieldInfo)m); - } else if (m.MemberType == MemberTypes.Property) { - il.Emit (OpCodes.Callvirt, ((PropertyInfo)m).GetGetMethod (true)); - } else { - throw new ArgumentException (); - } - } - - public static void EmitStMember (this ILGenerator il, MemberInfo m) - { - if (m.MemberType == MemberTypes.Field) { - il.Emit (OpCodes.Stfld, (FieldInfo)m); - } else if (m.MemberType == MemberTypes.Property) { - il.Emit (OpCodes.Callvirt, ((PropertyInfo)m).GetSetMethod (true)); - } else { - throw new ArgumentException (); - } - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/PackILGenerator.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/PackILGenerator.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,386 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.Serialization; - -namespace MsgPack.Compiler -{ - static class PackILGenerator - { - #region Pack IL Generator - public static void EmitPackCode (Type type, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupPackMethod) - { - if (type.IsPrimitive || type.IsInterface) - throw new NotSupportedException (); - - Variable arg_writer = Variable.CreateArg (0); - Variable arg_obj = Variable.CreateArg (1); - Variable local_i = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - - if (!type.IsValueType) { // null check - Label notNullLabel = il.DefineLabel (); - il.EmitLd (arg_obj); - il.Emit (OpCodes.Brtrue_S, notNullLabel); - il.EmitLd (arg_writer); - il.Emit (OpCodes.Call, typeof(MsgPackWriter).GetMethod("WriteNil", new Type[0])); - il.Emit (OpCodes.Ret); - il.MarkLabel (notNullLabel); - } - - if (type.IsArray) { - EmitPackArrayCode (mi, il, type, arg_writer, arg_obj, local_i, lookupPackMethod); - goto FinallyProcess; - } - - // MsgPackWriter.WriteMapHeader - MemberInfo[] members = targetMemberSelector (type); - il.EmitLd (arg_writer); - il.EmitLdc (members.Length); - il.Emit (OpCodes.Callvirt, typeof (MsgPackWriter).GetMethod("WriteMapHeader", new Type[]{typeof (int)})); - - for (int i = 0; i < members.Length; i ++) { - MemberInfo m = members[i]; - Type mt = m.GetMemberType (); - - // write field-name - il.EmitLd (arg_writer); - il.EmitLdstr (memberNameFormatter (m)); - il.EmitLd_True (); - il.Emit (OpCodes.Call, typeof (MsgPackWriter).GetMethod("Write", new Type[]{typeof (string), typeof (bool)})); - - // write value - EmitPackMemberValueCode (mt, il, arg_writer, arg_obj, m, null, type, mi, lookupPackMethod); - } - -FinallyProcess: - il.Emit (OpCodes.Ret); - } - - static void EmitPackArrayCode (MethodInfo mi, ILGenerator il, Type t, Variable var_writer, Variable var_obj, Variable var_loop, Func lookupPackMethod) - { - Type et = t.GetElementType (); - il.EmitLd (var_writer, var_obj); - il.Emit (OpCodes.Ldlen); - il.Emit (OpCodes.Call, typeof(MsgPackWriter).GetMethod("WriteArrayHeader", new Type[]{ typeof(int) })); - - Label beginLabel = il.DefineLabel (); - Label exprLabel = il.DefineLabel (); - - // for-loop: init loop counter - il.EmitLdc (0); - il.EmitSt (var_loop); - - // jump - il.Emit (OpCodes.Br_S, exprLabel); - - // mark begin-label - il.MarkLabel (beginLabel); - - // write element - EmitPackMemberValueCode (et, il, var_writer, var_obj, null, var_loop, t, mi, lookupPackMethod); - - // increment loop-counter - il.EmitLd (var_loop); - il.Emit (OpCodes.Ldc_I4_1); - il.Emit (OpCodes.Add); - il.EmitSt (var_loop); - - // mark expression label - il.MarkLabel (exprLabel); - - // expression - il.EmitLd (var_loop, var_obj); - il.Emit (OpCodes.Ldlen); - il.Emit (OpCodes.Blt_S, beginLabel); - } - - /// (optional) - /// (optional) - static void EmitPackMemberValueCode (Type type, ILGenerator il, Variable var_writer, Variable var_obj, - MemberInfo m, Variable elementIdx, Type currentType, MethodInfo currentMethod, Func lookupPackMethod) - { - MethodInfo mi; - il.EmitLd (var_writer, var_obj); - if (m != null) - il.EmitLdMember (m); - if (elementIdx != null) { - il.EmitLd (elementIdx); - il.Emit (OpCodes.Ldelem, type); - } - if (type.IsPrimitive) { - mi = typeof(MsgPackWriter).GetMethod("Write", new Type[]{type}); - } else { - if (currentType == type) { - mi = currentMethod; - } else { - mi = lookupPackMethod (type); - } - } - il.Emit (OpCodes.Call, mi); - } - #endregion - - #region Unpack IL Generator - public static void EmitUnpackCode (Type type, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupUnpackMethod, - Func> lookupMemberMapping, - MethodInfo lookupMemberMappingMethod) - { - if (type.IsArray) { - EmitUnpackArrayCode (type, mi, il, targetMemberSelector, memberNameFormatter, lookupUnpackMethod); - } else { - EmitUnpackMapCode (type, mi, il, targetMemberSelector, memberNameFormatter, lookupUnpackMethod, lookupMemberMapping, lookupMemberMappingMethod); - } - } - - static void EmitUnpackMapCode (Type type, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupUnpackMethod, - Func> lookupMemberMapping, - MethodInfo lookupMemberMappingMethod) - { - MethodInfo failedMethod = typeof (PackILGenerator).GetMethod ("UnpackFailed", BindingFlags.Static | BindingFlags.NonPublic); - MemberInfo[] members = targetMemberSelector (type); - IDictionary member_mapping = lookupMemberMapping (type); - for (int i = 0; i < members.Length; i ++) - member_mapping.Add (memberNameFormatter (members[i]), i); - - Variable msgpackReader = Variable.CreateArg (0); - Variable obj = Variable.CreateLocal (il.DeclareLocal (type)); - Variable num_of_fields = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable loop_idx = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable mapping = Variable.CreateLocal (il.DeclareLocal (typeof (IDictionary))); - Variable switch_idx = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable var_type = Variable.CreateLocal (il.DeclareLocal (typeof (Type))); - - // if (!MsgPackReader.Read()) UnpackFailed (); - // if (MsgPackReader.Type == TypePrefixes.Nil) return null; - // if (!MsgPackReader.IsMap ()) UnpackFailed (); - EmitUnpackReadAndTypeCheckCode (il, msgpackReader, typeof (MsgPackReader).GetMethod ("IsMap"), failedMethod, true); - - // type = typeof (T) - il.Emit (OpCodes.Ldtoken, type); - il.Emit (OpCodes.Call, typeof(Type).GetMethod ("GetTypeFromHandle")); - il.EmitSt (var_type); - - // mapping = LookupMemberMapping (typeof (T)) - il.EmitLd (var_type); - il.Emit (OpCodes.Call, lookupMemberMappingMethod); - il.EmitSt (mapping); - - // object o = FormatterServices.GetUninitializedObject (Type); - il.EmitLd (var_type); - il.Emit (OpCodes.Call, typeof (FormatterServices).GetMethod ("GetUninitializedObject")); - il.Emit (OpCodes.Castclass, type); - il.EmitSt (obj); - - // num_of_fields = (int)reader.Length - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetProperty ("Length").GetGetMethod ()); - il.EmitSt (num_of_fields); - - // Loop labels - Label lblLoopStart = il.DefineLabel (); - Label lblLoopExpr = il.DefineLabel (); - - // i = 0; - il.EmitLdc (0); - il.EmitSt (loop_idx); - il.Emit (OpCodes.Br, lblLoopExpr); - il.MarkLabel (lblLoopStart); - - /* process */ - // if (!MsgPackReader.Read() || !MsgPackReader.IsRaw()) UnpackFailed(); - EmitUnpackReadAndTypeCheckCode (il, msgpackReader, typeof (MsgPackReader).GetMethod ("IsRaw"), failedMethod, false); - - // MsgPackReader.ReadRawString () - // if (!Dictionary.TryGetValue (,)) UnpackFailed(); - Label lbl3 = il.DefineLabel (); - il.EmitLd (mapping); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetMethod ("ReadRawString", new Type[0])); - il.Emit (OpCodes.Ldloca_S, (byte)switch_idx.Index); - il.Emit (OpCodes.Callvirt, typeof (IDictionary).GetMethod ("TryGetValue")); - il.Emit (OpCodes.Brtrue, lbl3); - il.Emit (OpCodes.Call, failedMethod); - il.MarkLabel (lbl3); - - // switch - Label[] switchCases = new Label[members.Length]; - for (int i = 0; i < switchCases.Length; i ++) - switchCases[i] = il.DefineLabel (); - Label switchCaseEndLabel = il.DefineLabel (); - il.EmitLd (switch_idx); - il.Emit (OpCodes.Switch, switchCases); - il.Emit (OpCodes.Call, failedMethod); - - for (int i = 0; i < switchCases.Length; i ++) { - il.MarkLabel (switchCases[i]); - MemberInfo minfo = members[i]; - Type mt = minfo.GetMemberType (); - MethodInfo unpack_method = lookupUnpackMethod (mt); - il.EmitLd (obj); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, unpack_method); - il.EmitStMember (minfo); - il.Emit (OpCodes.Br, switchCaseEndLabel); - } - il.MarkLabel (switchCaseEndLabel); - - // i ++ - il.EmitLd (loop_idx); - il.EmitLdc (1); - il.Emit (OpCodes.Add); - il.EmitSt (loop_idx); - - // i < num_of_fields; - il.MarkLabel (lblLoopExpr); - il.EmitLd (loop_idx); - il.EmitLd (num_of_fields); - il.Emit (OpCodes.Blt, lblLoopStart); - - // return - il.EmitLd (obj); - il.Emit (OpCodes.Ret); - } - - static void EmitUnpackArrayCode (Type arrayType, MethodInfo mi, ILGenerator il, - Func targetMemberSelector, - Func memberNameFormatter, - Func lookupUnpackMethod) - { - Type elementType = arrayType.GetElementType (); - MethodInfo failedMethod = typeof (PackILGenerator).GetMethod ("UnpackFailed", BindingFlags.Static | BindingFlags.NonPublic); - - Variable msgpackReader = Variable.CreateArg (0); - Variable obj = Variable.CreateLocal (il.DeclareLocal (arrayType)); - Variable num_of_elements = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable loop_idx = Variable.CreateLocal (il.DeclareLocal (typeof (int))); - Variable type = Variable.CreateLocal (il.DeclareLocal (typeof (Type))); - - // if (!MsgPackReader.Read() || !MsgPackReader.IsArray ()) UnpackFailed (); - EmitUnpackReadAndTypeCheckCode (il, msgpackReader, typeof (MsgPackReader).GetMethod ("IsArray"), failedMethod, true); - - // type = typeof (T) - il.Emit (OpCodes.Ldtoken, elementType); - il.Emit (OpCodes.Call, typeof(Type).GetMethod ("GetTypeFromHandle")); - il.EmitSt (type); - - // num_of_elements = (int)reader.Length - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetProperty ("Length").GetGetMethod ()); - il.EmitSt (num_of_elements); - - // object o = Array.CreateInstance (Type, Length); - il.EmitLd (type); - il.EmitLd (num_of_elements); - il.Emit (OpCodes.Call, typeof (Array).GetMethod ("CreateInstance", new Type[] {typeof (Type), typeof (int)})); - il.Emit (OpCodes.Castclass, arrayType); - il.EmitSt (obj); - - // Unpack element method - MethodInfo unpack_method = lookupUnpackMethod (elementType); - - // Loop labels - Label lblLoopStart = il.DefineLabel (); - Label lblLoopExpr = il.DefineLabel (); - - // i = 0; - il.EmitLdc (0); - il.EmitSt (loop_idx); - il.Emit (OpCodes.Br, lblLoopExpr); - il.MarkLabel (lblLoopStart); - - /* process */ - il.EmitLd (obj, loop_idx); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, unpack_method); - il.Emit (OpCodes.Stelem, elementType); - - // i ++ - il.EmitLd (loop_idx); - il.EmitLdc (1); - il.Emit (OpCodes.Add); - il.EmitSt (loop_idx); - - // i < num_of_fields; - il.MarkLabel (lblLoopExpr); - il.EmitLd (loop_idx); - il.EmitLd (num_of_elements); - il.Emit (OpCodes.Blt, lblLoopStart); - - // return - il.EmitLd (obj); - il.Emit (OpCodes.Ret); - } - - static void EmitUnpackReadAndTypeCheckCode (ILGenerator il, Variable msgpackReader, MethodInfo typeCheckMethod, MethodInfo failedMethod, bool nullCheckAndReturn) - { - Label lblFailed = il.DefineLabel (); - Label lblNullReturn = nullCheckAndReturn ? il.DefineLabel () : default(Label); - Label lblPassed = il.DefineLabel (); - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetMethod ("Read")); - il.Emit (OpCodes.Brfalse_S, lblFailed); - if (nullCheckAndReturn) { - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeof (MsgPackReader).GetProperty ("Type").GetGetMethod ()); - il.EmitLdc ((int)TypePrefixes.Nil); - il.Emit (OpCodes.Beq_S, lblNullReturn); - } - il.EmitLd (msgpackReader); - il.Emit (OpCodes.Call, typeCheckMethod); - il.Emit (OpCodes.Brtrue_S, lblPassed); - il.Emit (OpCodes.Br, lblFailed); - if (nullCheckAndReturn) { - il.MarkLabel (lblNullReturn); - il.Emit (OpCodes.Ldnull); - il.Emit (OpCodes.Ret); - } - il.MarkLabel (lblFailed); - il.Emit (OpCodes.Call, failedMethod); - il.MarkLabel (lblPassed); - } - - /// Exception Helper - internal static void UnpackFailed () - { - throw new FormatException (); - } - #endregion - - #region Misc - static Type GetMemberType (this MemberInfo mi) - { - if (mi.MemberType == MemberTypes.Field) - return ((FieldInfo)mi).FieldType; - if (mi.MemberType == MemberTypes.Property) - return ((PropertyInfo)mi).PropertyType; - throw new ArgumentException (); - } - #endregion - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/Variable.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/Variable.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System.Reflection.Emit; - -namespace MsgPack.Compiler -{ - public class Variable - { - Variable (VariableType type, int index) - { - this.VarType = type; - this.Index = index; - } - - public static Variable CreateLocal (LocalBuilder local) - { - return new Variable (VariableType.Local, local.LocalIndex); - } - - public static Variable CreateArg (int idx) - { - return new Variable (VariableType.Arg, idx); - } - - public VariableType VarType { get; set; } - public int Index { get; set; } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/VariableType.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/Compiler/VariableType.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace MsgPack.Compiler -{ - public enum VariableType - { - Local, - Arg - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/MsgPackReader.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/MsgPackReader.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.IO; -using System.Text; - -namespace MsgPack -{ - public class MsgPackReader - { - Stream _strm; - byte[] _tmp0 = new byte[8]; - byte[] _tmp1 = new byte[8]; - - Encoding _encoding = Encoding.UTF8; - //Decoder _decoder = Encoding.UTF8.GetDecoder (); - byte[] _buf = new byte[64]; - - public MsgPackReader (Stream strm) - { - _strm = strm; - } - - public TypePrefixes Type { get; private set; } - - public bool ValueBoolean { get; private set; } - public uint Length { get; private set; } - - public uint ValueUnsigned { get; private set; } - public ulong ValueUnsigned64 { get; private set; } - - public int ValueSigned { get; private set; } - public long ValueSigned64 { get; private set; } - - public float ValueFloat { get; private set; } - public double ValueDouble { get; private set; } - - public bool IsSigned () - { - return this.Type == TypePrefixes.NegativeFixNum || - this.Type == TypePrefixes.PositiveFixNum || - this.Type == TypePrefixes.Int8 || - this.Type == TypePrefixes.Int16 || - this.Type == TypePrefixes.Int32; - } - - public bool IsBoolean () - { - return this.Type == TypePrefixes.True || this.Type == TypePrefixes.False; - } - - public bool IsSigned64 () - { - return this.Type == TypePrefixes.Int64; - } - - public bool IsUnsigned () - { - return this.Type == TypePrefixes.PositiveFixNum || - this.Type == TypePrefixes.UInt8 || - this.Type == TypePrefixes.UInt16 || - this.Type == TypePrefixes.UInt32; - } - - public bool IsUnsigned64 () - { - return this.Type == TypePrefixes.UInt64; - } - - public bool IsRaw () - { - return this.Type == TypePrefixes.FixRaw || this.Type == TypePrefixes.Raw16 || this.Type == TypePrefixes.Raw32; - } - - public bool IsArray () - { - return this.Type == TypePrefixes.FixArray || this.Type == TypePrefixes.Array16 || this.Type == TypePrefixes.Array32; - } - - public bool IsMap () - { - return this.Type == TypePrefixes.FixMap || this.Type == TypePrefixes.Map16 || this.Type == TypePrefixes.Map32; - } - - public bool Read () - { - byte[] tmp0 = _tmp0, tmp1 = _tmp1; - int x = _strm.ReadByte (); - if (x < 0) - return false; // EOS - - if (x >= 0x00 && x <= 0x7f) { - this.Type = TypePrefixes.PositiveFixNum; - } else if (x >= 0xe0 && x <= 0xff) { - this.Type = TypePrefixes.NegativeFixNum; - } else if (x >= 0xa0 && x <= 0xbf) { - this.Type = TypePrefixes.FixRaw; - } else if (x >= 0x90 && x <= 0x9f) { - this.Type = TypePrefixes.FixArray; - } else if (x >= 0x80 && x <= 0x8f) { - this.Type = TypePrefixes.FixMap; - } else { - this.Type = (TypePrefixes)x; - } - - switch (this.Type) { - case TypePrefixes.Nil: - break; - case TypePrefixes.False: - ValueBoolean = false; - break; - case TypePrefixes.True: - ValueBoolean = true; - break; - case TypePrefixes.Float: - _strm.Read (tmp0, 0, 4); - if (BitConverter.IsLittleEndian) { - tmp1[0] = tmp0[3]; - tmp1[1] = tmp0[2]; - tmp1[2] = tmp0[1]; - tmp1[3] = tmp0[0]; - ValueFloat = BitConverter.ToSingle (tmp1, 0); - } else { - ValueFloat = BitConverter.ToSingle (tmp0, 0); - } - break; - case TypePrefixes.Double: - _strm.Read (tmp0, 0, 8); - if (BitConverter.IsLittleEndian) { - tmp1[0] = tmp0[7]; - tmp1[1] = tmp0[6]; - tmp1[2] = tmp0[5]; - tmp1[3] = tmp0[4]; - tmp1[4] = tmp0[3]; - tmp1[5] = tmp0[2]; - tmp1[6] = tmp0[1]; - tmp1[7] = tmp0[0]; - ValueDouble = BitConverter.ToDouble (tmp1, 0); - } else { - ValueDouble = BitConverter.ToDouble (tmp0, 0); - } - break; - case TypePrefixes.NegativeFixNum: - ValueSigned = (x & 0x1f) - 0x20; - break; - case TypePrefixes.PositiveFixNum: - ValueSigned = x & 0x7f; - ValueUnsigned = (uint)ValueSigned; - break; - case TypePrefixes.UInt8: - x = _strm.ReadByte (); - if (x < 0) - throw new FormatException (); - ValueUnsigned = (uint)x; - break; - case TypePrefixes.UInt16: - if (_strm.Read (tmp0, 0, 2) != 2) - throw new FormatException (); - ValueUnsigned = ((uint)tmp0[0] << 8) | (uint)tmp0[1]; - break; - case TypePrefixes.UInt32: - if (_strm.Read (tmp0, 0, 4) != 4) - throw new FormatException (); - ValueUnsigned = ((uint)tmp0[0] << 24) | ((uint)tmp0[1] << 16) | ((uint)tmp0[2] << 8) | (uint)tmp0[3]; - break; - case TypePrefixes.UInt64: - if (_strm.Read (tmp0, 0, 8) != 8) - throw new FormatException (); - ValueUnsigned64 = ((ulong)tmp0[0] << 56) | ((ulong)tmp0[1] << 48) | ((ulong)tmp0[2] << 40) | ((ulong)tmp0[3] << 32) | ((ulong)tmp0[4] << 24) | ((ulong)tmp0[5] << 16) | ((ulong)tmp0[6] << 8) | (ulong)tmp0[7]; - break; - case TypePrefixes.Int8: - x = _strm.ReadByte (); - if (x < 0) - throw new FormatException (); - ValueSigned = (sbyte)x; - break; - case TypePrefixes.Int16: - if (_strm.Read (tmp0, 0, 2) != 2) - throw new FormatException (); - ValueSigned = (short)((tmp0[0] << 8) | tmp0[1]); - break; - case TypePrefixes.Int32: - if (_strm.Read (tmp0, 0, 4) != 4) - throw new FormatException (); - ValueSigned = (tmp0[0] << 24) | (tmp0[1] << 16) | (tmp0[2] << 8) | tmp0[3]; - break; - case TypePrefixes.Int64: - if (_strm.Read (tmp0, 0, 8) != 8) - throw new FormatException (); - ValueSigned64 = ((long)tmp0[0] << 56) | ((long)tmp0[1] << 48) | ((long)tmp0[2] << 40) | ((long)tmp0[3] << 32) | ((long)tmp0[4] << 24) | ((long)tmp0[5] << 16) | ((long)tmp0[6] << 8) | (long)tmp0[7]; - break; - case TypePrefixes.FixRaw: - Length = (uint)(x & 0x1f); - break; - case TypePrefixes.FixArray: - case TypePrefixes.FixMap: - Length = (uint)(x & 0xf); - break; - case TypePrefixes.Raw16: - case TypePrefixes.Array16: - case TypePrefixes.Map16: - if (_strm.Read (tmp0, 0, 2) != 2) - throw new FormatException (); - Length = ((uint)tmp0[0] << 8) | (uint)tmp0[1]; - break; - case TypePrefixes.Raw32: - case TypePrefixes.Array32: - case TypePrefixes.Map32: - if (_strm.Read (tmp0, 0, 4) != 4) - throw new FormatException (); - Length = ((uint)tmp0[0] << 24) | ((uint)tmp0[1] << 16) | ((uint)tmp0[2] << 8) | (uint)tmp0[3]; - break; - default: - throw new FormatException (); - } - return true; - } - - public int ReadValueRaw (byte[] buf, int offset, int count) - { - return _strm.Read (buf, offset, count); - } - - public string ReadRawString () - { - return ReadRawString (_buf); - } - - public string ReadRawString (byte[] buf) - { - if (this.Length < buf.Length) { - if (ReadValueRaw (buf, 0, (int)this.Length) != this.Length) - throw new FormatException (); - return _encoding.GetString (buf, 0, (int)this.Length); - } - - // Poor implementation - byte[] tmp = new byte[(int)this.Length]; - if (ReadValueRaw (tmp, 0, tmp.Length) != tmp.Length) - throw new FormatException (); - return _encoding.GetString (tmp); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/MsgPackWriter.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/MsgPackWriter.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,321 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa, Kazunari Kida -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.IO; -using System.Text; - -namespace MsgPack -{ - public class MsgPackWriter - { - Stream _strm; - //Encoding _encoding = Encoding.UTF8; - Encoder _encoder = Encoding.UTF8.GetEncoder (); - byte[] _tmp = new byte[9]; - byte[] _buf = new byte[64]; - - public MsgPackWriter (Stream strm) - { - _strm = strm; - } - - public void Write (byte x) - { - if (x < 128) { - _strm.WriteByte (x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xcc; - tmp[1] = x; - _strm.Write (tmp, 0, 2); - } - } - - public void Write (ushort x) - { - if (x < 0x100) { - Write ((byte)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xcd; - tmp[1] = (byte)(x >> 8); - tmp[2] = (byte)x; - _strm.Write (tmp, 0, 3); - } - } - - public void Write (char x) - { - Write ((ushort)x); - } - - public void Write (uint x) - { - if (x < 0x10000) { - Write ((ushort)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xce; - tmp[1] = (byte)(x >> 24); - tmp[2] = (byte)(x >> 16); - tmp[3] = (byte)(x >> 8); - tmp[4] = (byte)x; - _strm.Write (tmp, 0, 5); - } - } - - public void Write (ulong x) - { - if (x < 0x100000000) { - Write ((uint)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xcf; - tmp[1] = (byte)(x >> 56); - tmp[2] = (byte)(x >> 48); - tmp[3] = (byte)(x >> 40); - tmp[4] = (byte)(x >> 32); - tmp[5] = (byte)(x >> 24); - tmp[6] = (byte)(x >> 16); - tmp[7] = (byte)(x >> 8); - tmp[8] = (byte)x; - _strm.Write (tmp, 0, 9); - } - } - - public void Write (sbyte x) - { - if (x >= -32 && x <= -1) { - _strm.WriteByte ((byte)(0xe0 | (byte)x)); - } else if (x >= 0 && x <= 127) { - _strm.WriteByte ((byte)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd0; - tmp[1] = (byte)x; - _strm.Write (tmp, 0, 2); - } - } - - public void Write (short x) - { - if (x >= sbyte.MinValue && x <= sbyte.MaxValue) { - Write ((sbyte)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd1; - tmp[1] = (byte)(x >> 8); - tmp[2] = (byte)x; - _strm.Write (tmp, 0, 3); - } - } - - public void Write (int x) - { - if (x >= short.MinValue && x <= short.MaxValue) { - Write ((short)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd2; - tmp[1] = (byte)(x >> 24); - tmp[2] = (byte)(x >> 16); - tmp[3] = (byte)(x >> 8); - tmp[4] = (byte)x; - _strm.Write (tmp, 0, 5); - } - } - - public void Write (long x) - { - if (x >= int.MinValue && x <= int.MaxValue) { - Write ((int)x); - } else { - byte[] tmp = _tmp; - tmp[0] = 0xd3; - tmp[1] = (byte)(x >> 56); - tmp[2] = (byte)(x >> 48); - tmp[3] = (byte)(x >> 40); - tmp[4] = (byte)(x >> 32); - tmp[5] = (byte)(x >> 24); - tmp[6] = (byte)(x >> 16); - tmp[7] = (byte)(x >> 8); - tmp[8] = (byte)x; - _strm.Write (tmp, 0, 9); - } - } - - public void WriteNil () - { - _strm.WriteByte (0xc0); - } - - public void Write (bool x) - { - _strm.WriteByte ((byte)(x ? 0xc3 : 0xc2)); - } - - public void Write (float x) - { - byte[] raw = BitConverter.GetBytes (x); // unsafeコードを使う? - byte[] tmp = _tmp; - - tmp[0] = 0xca; - if (BitConverter.IsLittleEndian) { - tmp[1] = raw[3]; - tmp[2] = raw[2]; - tmp[3] = raw[1]; - tmp[4] = raw[0]; - } else { - tmp[1] = raw[0]; - tmp[2] = raw[1]; - tmp[3] = raw[2]; - tmp[4] = raw[3]; - } - _strm.Write (tmp, 0, 5); - } - - public void Write (double x) - { - byte[] raw = BitConverter.GetBytes (x); // unsafeコードを使う? - byte[] tmp = _tmp; - - tmp[0] = 0xcb; - if (BitConverter.IsLittleEndian) { - tmp[1] = raw[7]; - tmp[2] = raw[6]; - tmp[3] = raw[5]; - tmp[4] = raw[4]; - tmp[5] = raw[3]; - tmp[6] = raw[2]; - tmp[7] = raw[1]; - tmp[8] = raw[0]; - } else { - tmp[1] = raw[0]; - tmp[2] = raw[1]; - tmp[3] = raw[2]; - tmp[4] = raw[3]; - tmp[5] = raw[4]; - tmp[6] = raw[5]; - tmp[7] = raw[6]; - tmp[8] = raw[7]; - } - _strm.Write (tmp, 0, 9); - } - - public void Write (byte[] bytes) - { - WriteRawHeader (bytes.Length); - _strm.Write (bytes, 0, bytes.Length); - } - - public void WriteRawHeader (int N) - { - WriteLengthHeader (N, 32, 0xa0, 0xda, 0xdb); - } - - public void WriteArrayHeader (int N) - { - WriteLengthHeader (N, 16, 0x90, 0xdc, 0xdd); - } - - public void WriteMapHeader (int N) - { - WriteLengthHeader (N, 16, 0x80, 0xde, 0xdf); - } - - void WriteLengthHeader (int N, int fix_length, byte fix_prefix, byte len16bit_prefix, byte len32bit_prefix) - { - if (N < fix_length) { - _strm.WriteByte ((byte)(fix_prefix | N)); - } else { - byte[] tmp = _tmp; - int header_len; - if (N < 0x10000) { - tmp[0] = len16bit_prefix; - tmp[1] = (byte)(N >> 8); - tmp[2] = (byte)N; - header_len = 3; - } else { - tmp[0] = len32bit_prefix; - tmp[1] = (byte)(N >> 24); - tmp[2] = (byte)(N >> 16); - tmp[3] = (byte)(N >> 8); - tmp[4] = (byte)N; - header_len = 5; - } - _strm.Write (tmp, 0, header_len); - } - } - - public void Write (string x) - { - Write (x, false); - } - - public void Write (string x, bool highProbAscii) - { - Write (x, _buf, highProbAscii); - } - - public void Write (string x, byte[] buf) - { - Write (x, buf, false); - } - - public void Write (string x, byte[] buf, bool highProbAscii) - { - Encoder encoder = _encoder; - //fixed (char *pstr = x) - //fixed (byte *pbuf = buf) { - char[] str = x.ToCharArray(); - if (highProbAscii && x.Length <= buf.Length) { - bool isAsciiFullCompatible = true; - for (int i = 0; i < x.Length; i ++) { - //int v = (int)pstr[i]; - int v = (int)(x[i]); - if (v > 0x7f) { - isAsciiFullCompatible = false; - break; - } - buf[i] = (byte)v; - } - if (isAsciiFullCompatible) { - WriteRawHeader (x.Length); - _strm.Write (buf, 0, x.Length); - return; - } - } - - //WriteRawHeader (encoder.GetByteCount (pstr, x.Length, true)); - WriteRawHeader (encoder.GetByteCount (str, 0, x.Length, true)); - int str_len = x.Length; - //char *p = pstr; - int convertedChars, bytesUsed; - bool completed = true; - int j = 0; - while (str_len > 0 || !completed) { - //encoder.Convert (p, str_len, pbuf, buf.Length, false, out convertedChars, out bytesUsed, out completed); - encoder.Convert (str, j, str_len, buf, 0, buf.Length, false, out convertedChars, out bytesUsed, out completed); - _strm.Write (buf, 0, bytesUsed); - str_len -= convertedChars; - //p += convertedChars; - j += convertedChars; - } - //} - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/ObjectPacker.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/ObjectPacker.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,259 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Runtime.Serialization; -using System.Text; - -namespace MsgPack -{ - public class ObjectPacker - { - byte[] _buf = new byte[64]; - //Encoding _encoding = Encoding.UTF8; - static Dictionary PackerMapping; - static Dictionary UnpackerMapping; - - delegate void PackDelegate (ObjectPacker packer, MsgPackWriter writer, object o); - delegate object UnpackDelegate (ObjectPacker packer, MsgPackReader reader); - - static ObjectPacker () - { - PackerMapping = new Dictionary (); - UnpackerMapping = new Dictionary (); - - PackerMapping.Add (typeof (string), StringPacker); - UnpackerMapping.Add (typeof (string), StringUnpacker); - } - - public byte[] Pack (object o) - { - using (MemoryStream ms = new MemoryStream ()) { - Pack (ms, o); - return ms.ToArray (); - } - } - - public void Pack (Stream strm, object o) - { - if (o != null && o.GetType ().IsPrimitive) - throw new NotSupportedException (); - MsgPackWriter writer = new MsgPackWriter (strm); - Pack (writer, o); - } - - void Pack (MsgPackWriter writer, object o) - { - if (o == null) { - writer.WriteNil (); - return; - } - - Type t = o.GetType (); - if (t.IsPrimitive) { - if (t.Equals (typeof (int))) writer.Write ((int)o); - else if (t.Equals (typeof (uint))) writer.Write ((uint)o); - else if (t.Equals (typeof (float))) writer.Write ((float)o); - else if (t.Equals (typeof (double))) writer.Write ((double)o); - else if (t.Equals (typeof (long))) writer.Write ((long)o); - else if (t.Equals (typeof (ulong))) writer.Write ((ulong)o); - else if (t.Equals (typeof (bool))) writer.Write ((bool)o); - else if (t.Equals (typeof (byte))) writer.Write ((byte)o); - else if (t.Equals (typeof (sbyte))) writer.Write ((sbyte)o); - else if (t.Equals (typeof (short))) writer.Write ((short)o); - else if (t.Equals (typeof (ushort))) writer.Write ((ushort)o); - else if (t.Equals (typeof (char))) writer.Write ((ushort)(char)o); - else throw new NotSupportedException (); - return; - } - - PackDelegate packer; - if (PackerMapping.TryGetValue (t, out packer)) { - packer (this, writer, o); - return; - } - - if (t.IsArray) { - Array ary = (Array)o; - writer.WriteArrayHeader (ary.Length); - for (int i = 0; i < ary.Length; i ++) - Pack (writer, ary.GetValue (i)); - return; - } - - ReflectionCacheEntry entry = ReflectionCache.Lookup (t); - writer.WriteMapHeader (entry.FieldMap.Count); - foreach (KeyValuePair pair in entry.FieldMap) { - writer.Write (pair.Key, _buf); - object v = pair.Value.GetValue (o); - if (pair.Value.FieldType.IsInterface && v != null) { - writer.WriteArrayHeader (2); - writer.Write (v.GetType().FullName); - } - Pack (writer, v); - } - } - - public T Unpack (byte[] buf) - { - return Unpack (buf, 0, buf.Length); - } - - public T Unpack (byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (ms); - } - } - - public T Unpack (Stream strm) - { - if (typeof (T).IsPrimitive) - throw new NotSupportedException (); - MsgPackReader reader = new MsgPackReader (strm); - return (T)Unpack (reader, typeof (T)); - } - - public object Unpack (Type type, byte[] buf) - { - return Unpack (type, buf, 0, buf.Length); - } - - public object Unpack (Type type, byte[] buf, int offset, int size) - { - using (MemoryStream ms = new MemoryStream (buf, offset, size)) { - return Unpack (type, ms); - } - } - - public object Unpack (Type type, Stream strm) - { - if (type.IsPrimitive) - throw new NotSupportedException (); - MsgPackReader reader = new MsgPackReader (strm); - return Unpack (reader, type); - } - - object Unpack (MsgPackReader reader, Type t) - { - if (t.IsPrimitive) { - if (!reader.Read ()) throw new FormatException (); - if (t.Equals (typeof (int)) && reader.IsSigned ()) return reader.ValueSigned; - else if (t.Equals (typeof (uint)) && reader.IsUnsigned ()) return reader.ValueUnsigned; - else if (t.Equals (typeof (float)) && reader.Type == TypePrefixes.Float) return reader.ValueFloat; - else if (t.Equals (typeof (double)) && reader.Type == TypePrefixes.Double) return reader.ValueDouble; - else if (t.Equals (typeof (long))) { - if (reader.IsSigned64 ()) - return reader.ValueSigned64; - if (reader.IsSigned ()) - return (long)reader.ValueSigned; - } else if (t.Equals (typeof (ulong))) { - if (reader.IsUnsigned64 ()) - return reader.ValueUnsigned64; - if (reader.IsUnsigned ()) - return (ulong)reader.ValueUnsigned; - } else if (t.Equals (typeof (bool)) && reader.IsBoolean ()) return (reader.Type == TypePrefixes.True); - else if (t.Equals (typeof (byte)) && reader.IsUnsigned ()) return (byte)reader.ValueUnsigned; - else if (t.Equals (typeof (sbyte)) && reader.IsSigned ()) return (sbyte)reader.ValueSigned; - else if (t.Equals (typeof (short)) && reader.IsSigned ()) return (short)reader.ValueSigned; - else if (t.Equals (typeof (ushort)) && reader.IsUnsigned ()) return (ushort)reader.ValueUnsigned; - else if (t.Equals (typeof (char)) && reader.IsUnsigned ()) return (char)reader.ValueUnsigned; - else throw new NotSupportedException (); - } - - UnpackDelegate unpacker; - if (UnpackerMapping.TryGetValue (t, out unpacker)) - return unpacker (this, reader); - - if (t.IsArray) { - if (!reader.Read () || (!reader.IsArray () && reader.Type != TypePrefixes.Nil)) - throw new FormatException (); - if (reader.Type == TypePrefixes.Nil) - return null; - Type et = t.GetElementType (); - Array ary = Array.CreateInstance (et, (int)reader.Length); - for (int i = 0; i < ary.Length; i ++) - ary.SetValue (Unpack (reader, et), i); - return ary; - } - - if (!reader.Read ()) - throw new FormatException (); - if (reader.Type == TypePrefixes.Nil) - return null; - if (t.IsInterface) { - if (reader.Type != TypePrefixes.FixArray && reader.Length != 2) - throw new FormatException (); - if (!reader.Read () || !reader.IsRaw ()) - throw new FormatException (); - CheckBufferSize ((int)reader.Length); - reader.ReadValueRaw (_buf, 0, (int)reader.Length); - t = Type.GetType (Encoding.UTF8.GetString (_buf, 0, (int)reader.Length)); - if (!reader.Read () || reader.Type == TypePrefixes.Nil) - throw new FormatException (); - } - if (!reader.IsMap ()) - throw new FormatException (); - - object o = FormatterServices.GetUninitializedObject (t); - ReflectionCacheEntry entry = ReflectionCache.Lookup (t); - int members = (int)reader.Length; - for (int i = 0; i < members; i ++) { - if (!reader.Read () || !reader.IsRaw ()) - throw new FormatException (); - CheckBufferSize ((int)reader.Length); - reader.ReadValueRaw (_buf, 0, (int)reader.Length); - string name = Encoding.UTF8.GetString (_buf, 0, (int)reader.Length); - FieldInfo f; - if (!entry.FieldMap.TryGetValue (name, out f)) - throw new FormatException (); - f.SetValue (o, Unpack (reader, f.FieldType)); - } - - IDeserializationCallback callback = o as IDeserializationCallback; - if (callback != null) - callback.OnDeserialization (this); - return o; - } - - void CheckBufferSize (int size) - { - if (_buf.Length < size) - Array.Resize (ref _buf, size); - } - - static void StringPacker (ObjectPacker packer, MsgPackWriter writer, object o) - { - writer.Write (Encoding.UTF8.GetBytes ((string)o)); - } - - static object StringUnpacker (ObjectPacker packer, MsgPackReader reader) - { - if (!reader.Read ()) - throw new FormatException (); - if (reader.Type == TypePrefixes.Nil) - return null; - if (!reader.IsRaw ()) - throw new FormatException (); - packer.CheckBufferSize ((int)reader.Length); - reader.ReadValueRaw (packer._buf, 0, (int)reader.Length); - return Encoding.UTF8.GetString (packer._buf, 0, (int)reader.Length); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/ReflectionCache.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/ReflectionCache.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; - -namespace MsgPack -{ - public static class ReflectionCache - { - static Dictionary _cache; - - static ReflectionCache () - { - _cache = new Dictionary (); - } - - public static ReflectionCacheEntry Lookup (Type type) - { - ReflectionCacheEntry entry; - lock (_cache) { - if (_cache.TryGetValue (type, out entry)) - return entry; - } - - entry = new ReflectionCacheEntry (type); - lock (_cache) { - _cache[type] = entry; - } - return entry; - } - - public static void RemoveCache (Type type) - { - lock (_cache) { - _cache.Remove (type); - } - } - - public static void Clear () - { - lock (_cache) { - _cache.Clear (); - } - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/ReflectionCacheEntry.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/ReflectionCacheEntry.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace MsgPack -{ - public class ReflectionCacheEntry - { - const BindingFlags FieldBindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField | BindingFlags.SetField; - - public ReflectionCacheEntry (Type t) - { - FieldInfo[] fields = t.GetFields (FieldBindingFlags); - IDictionary map = new Dictionary (fields.Length); - for (int i = 0; i < fields.Length; i ++) { - FieldInfo f = fields[i]; - string name = f.Name; - int pos; - if (name[0] == '<' && (pos = name.IndexOf ('>')) > 1) - name = name.Substring (1, pos - 1); // Auto-Property (\<.+\>) - map[name] = f; - } - FieldMap = map; - } - - public IDictionary FieldMap { get; private set; } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/TypePrefixes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/persistent/msgpack/src/TypePrefixes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -// -// Copyright 2011 Kazuki Oikawa -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace MsgPack -{ - public enum TypePrefixes : byte - { - PositiveFixNum = 0x00, // 0x00 - 0x7f - NegativeFixNum = 0xe0, // 0xe0 - 0xff - - Nil = 0xc0, - False = 0xc2, - True = 0xc3, - Float = 0xca, - Double = 0xcb, - UInt8 = 0xcc, - UInt16 = 0xcd, - UInt32 = 0xce, - UInt64 = 0xcf, - Int8 = 0xd0, - Int16 = 0xd1, - Int32 = 0xd2, - Int64 = 0xd3, - Raw16 = 0xda, - Raw32 = 0xdb, - Array16 = 0xdc, - Array32 = 0xdd, - Map16 = 0xde, - Map32 = 0xdf, - - FixRaw = 0xa0, // 0xa0 - 0xbf - FixArray = 0x90, // 0x90 - 0x9f - FixMap = 0x80, // 0x80 - 0x8f - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/Command.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/Command.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -public enum Command{ - APPEND_CHILD, - DELETE_CHILD, - PUT_ATTRIBUTE, - DELETE_ATTRIBUTE, - REPLACE_ROOT -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodeEditorError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodeEditorError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -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(); - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodePath.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/NodePath.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using System.Collections.Generic; -public interface NodePath : IEnumerable { - NodePath add (int pos); - Pair pop(); - NodePath tail(); - int size(); - Pair last(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeContext.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeContext.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - -public interface TreeContext { - TreeNode getRoot(); - - TreeContext prev(); - - string getUuid(); - - string getTreeName(); - - long getRevision(); - - TreeMap>> getIndex(); - - // Iterable getOperations(); - - // ParentIndex getParentIndex(); - - InterfaceTraverser getTraverser(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/TreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public interface TreeEditor { - Either edit (TreeNode root, NodePath path, NodeEditor transformer); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultNodePath.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultNodePath.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Collections; - -public class DefaultNodePath : NodePath { - private List path = new List(); - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return path.iterator (); - } - - public DefaultNodePath() { - path = new List ().addLast (-1); - } - - private DefaultNodePath(List path) { - this.path = path; - } - - /// - /// Listに追加します。 - /// path = path.add(0)を2回する - /// path = path.add(0).add(0)する - /// これは同じ - /// - /// Position. - - public NodePath add(int pos) { - List newPath = path.addLast(pos); - return new DefaultNodePath(newPath); - } - - public Pair pop() { - int head = path.headList(); - List tail = path.deleteHead(); - return new Pair(head, new DefaultNodePath(tail)); - } - - public Pair last() { - int last = path.headList(); - List list = path.deleteHead(); - return new Pair(last, new DefaultNodePath(list)); - } - - public override string ToString() { - string s = "List <"; - int list_count = this.path.length(); - int count = 0; - foreach(var i in this.path) { - if (count != list_count -1){ - s += i.ToString() + ","; - } else { - s += i.ToString(); - } - count++; - } - return s + ">"; - } - - public int size() { - return path.length(); - } - - public NodePath tail() { - List tail = path.deleteLast (); - return new DefaultNodePath (tail); - } - - public List inits() { - List paths = new List (); - List coursePath = new List (); - foreach (int tmpPath in path) { - List tmp = coursePath.addLast (tmpPath); - paths = paths.addLast (new DefaultNodePath (tmp)); - coursePath = tmp; - } - return paths; - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultTreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/DefaultTreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -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 edit(TreeNode root,NodePath path, NodeEditor editor){ - DefaultEvaluator e = new DefaultEvaluator (path); - Either either = traverser.traverse (root, e); - - if (either.isA ()) { - return DefaultEither.newA (either.a ()); - } - Traversal t = either.b (); - return clone (t, editor); - } - - private Either clone(Traversal t, NodeEditor editor){ - List> path = new List> (); - - foreach (Direction direction in t) { - path = path.addLast (direction); - } - - Direction targetDirection = path.headList (); - TreeNode target = targetDirection.getTarget (); - Either either = editor.edit (target); - if (either.isA ()) { - return DefaultEither.newA (either.a ()); - } - - LoggingNode newWrap = either.b (); - - int pos = targetDirection.getPosition (); - TreeNode child = newWrap.getWrap (); - - foreach (Direction parentDirection in path.deleteHead()) { - TreeNodeChildren chs = parentDirection.getTarget ().getChildren (); - - Either ret = chs.replaceNode (pos, child); - if (ret.isA ()) { - return DefaultEither.newA (ret.a ()); - } - - child = ret.b (); - pos = parentDirection.getPosition (); - } - - TreeNode newRoot = child; - LoggingNode logNode = editor.wrap (newRoot, newWrap.getOperationLog ()); - return DefaultEither.newB (logNode); - - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -using System.Collections.Generic; - -public interface TreeNode { - TreeNodeChildren getChildren(); - - TreeNodeAttributes getAttributes(); - - TreeNode createNewNode(); - - Either appendRootNode(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeAttributes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeAttributes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -public interface TreeNodeAttributes : Attributes { - Either delete(string key); - Either put(string key, byte[] value); - TreeMap getAttributesAsRawMap(); - IEnumerator getKeys(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeChildren.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/TreeNodeChildren.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - -public interface TreeNodeChildren : Children { - Either addNewChildAt (int pos); - Either deleteChildAt(int pos); - Either addNewChildAt(int pos,TreeNode newChild); - Either replaceNode(int pos,TreeNode replacement); - List getChildrenAsRawList(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultOperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultOperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using System.Collections; -using System; - - -public class DefaultOperationLog : OperationLog { - private List log; - - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - private static List EMPTY = new List(); - - public DefaultOperationLog() - : this(EMPTY) - { - } - - private DefaultOperationLog(List _log) - { - log = _log; - } - - public IEnumerator iterator() - { - return log.iterator(); - } - - - public OperationLog add(NodeOperation _op) - { - return new DefaultOperationLog(log.addLast(_op)); - } - - public int length() - { - return log.length(); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultTreeOperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultTreeOperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System; -using System.Collections; -using System.Linq; - - -public class DefaultTreeOperationLog : TreeOperationLog { - private IEnumerable list; - private int size; - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - foreach (var i in list) { - yield return i; - } - } - - - public DefaultTreeOperationLog() - { - list = new List(); - size = 0; - } - - public DefaultTreeOperationLog(IEnumerable _list,int _size) - { - list = _list; - size = _size; - } - -// public IEnumerator iterator() -// { -// return list.itetator(); -// } - - public TreeOperationLog add(NodePath _p, NodeOperation _op) - { - TreeOperation op = new DefaultTreeOperation(_p,_op); - List newList = new List(op); - // java write Iterables.concat ここは間違い - IEnumerable concat = list.Union(newList); - - return new DefaultTreeOperationLog(concat,size + 1); - } - - public TreeOperationLog append(TreeOperationLog _log) - { - int argumentLogSize = _log.length(); - // java write Iterables.concat - IEnumerable concat = list.Union(_log); - - return new DefaultTreeOperationLog(concat,argumentLogSize + size); - } - - - public int length(){ - return size; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingAttributes.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingAttributes.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -using UnityEngine; - -public class LoggingAttributes { - - private TreeNode wrap; - private OperationLog log; - - public LoggingAttributes(TreeNode _wrap,OperationLog _log) - { - wrap = _wrap; - log = _log; - } - - public byte[] get(string _key) - { - TreeNodeAttributes attributes = wrap.getAttributes(); - return attributes.get(_key); - } - - private Either edit(NodeOperation _op) - { - Either either = _op.invoke(wrap); - if(either.isA()){ - Debug.Log ("faild put"); - return DefaultEither.newA(either.a()); - } - - TreeNode newNode = either.b(); - OperationLog newLog = log.add(_op); - LoggingNode newLogNode = new LoggingNode(newNode,newLog); - - return DefaultEither.newB(newLogNode); - } - - public Either delete(string _key) - { - - DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key); - return edit(deleteAttribute); - } - - public Either put(string _key, byte[] _value) - { - PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value); - return edit(putAttribute); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingChildren.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingChildren.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -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 edit(NodeOperation _op) - { - Either either = _op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newWrap = either.b(); - OperationLog newLog = log.add(_op); - LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); - return DefaultEither.newB(newLoggingNode); - } - - public Either addNewChildAt(int _pos) - { - Debug.Log ("in addNewChild"); - NodeOperation addNewChildAt = new AppendChildAtOperation(_pos); - return edit(addNewChildAt); - } - - public Either deleteChildAt(int _pos) - { - NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos); - return edit(deleteChildAt); - } - - public Either at(int _pos) - { - Children children = wrap.getChildren(); - Either either = children.at(_pos); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode node = either.b(); - LoggingNode logNode = new LoggingNode(node); - return DefaultEither.newB(logNode); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/LoggingNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -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 replaceNewRootNode() { - NodeOperation replaceRootNode = new ReplaceRootNodeOperation(); - return edit(replaceRootNode); - } - - public Either edit(NodeOperation op){ - Either either = op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newWrap = either.b(); - OperationLog newLog = log.add(op); - LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); - return DefaultEither.newB(newLoggingNode); - } - - public TreeNode getWrap() - { - return wrap; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/OperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/OperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -using System.Collections.Generic; - -public interface OperationLog : IEnumerable { - OperationLog add (NodeOperation _op); - int length(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/TreeOperationLog.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/TreeOperationLog.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -using System.Collections.Generic; -public interface TreeOperationLog : IEnumerable { - TreeOperationLog add (NodePath _p, NodeOperation _op); - TreeOperationLog append (TreeOperationLog _log); - int length(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/index/ParentIndex.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/index/ParentIndex.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - -public class ParentIndex { - - - private TreeMap parentIndex; - - public ParentIndex() { - parentIndex = new TreeMap(); - } - - 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 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 childrenIterator = children.iterator(); -// for (; childrenIterator.hasNext();) { -// TreeNode child = childrenIterator.next(); -// parentIndex = parentIndex.put(child, parentNode); -// } - return this; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/AppendChildAtOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/AppendChildAtOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -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 invoke(TreeNode _target) - { - return _target.getChildren().addNewChildAt(pos); - } - - public int getPosition() - { - return pos; - } - - public string getKey() - { - return null; - } - - public byte[] getValue() - { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DefaultTreeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DefaultTreeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteAttributeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteAttributeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -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 invoke(TreeNode _target) { - return _target.getAttributes ().delete (key); - } - - public int getPosition() { - return -1; - } - - public string getKey() { - return key; - } - - public byte[] getValue() { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteChildAtOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/DeleteChildAtOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -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 invoke(TreeNode _target) - { - return _target.getChildren().deleteChildAt(pos); - } - - public int getPosition() - { - return pos; - } - - public string getKey() - { - return null; - } - - public byte[] getValue() - { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/NodeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/NodeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -using UnityEngine; -public interface NodeOperation { - Command getCommand(); - Either invoke (TreeNode _target); - int getPosition(); - string getKey(); - byte[] getValue(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/PutAttributeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/PutAttributeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -using UnityEngine; - -public class PutAttributeOperation : NodeOperation { - private string key; - private byte[] value; - - public PutAttributeOperation(string _key, byte[] _value) - { - key = _key; - value = _value; - } - - - public Command getCommand() - { - return Command.PUT_ATTRIBUTE; - } - - public Either invoke(TreeNode _target) - { - return _target.getAttributes().put(key,value); - } - public int getPosition() - { - return -1; - } - - public string getKey() - { - return key; - } - - public byte[] getValue() - { - return value; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/ReplaceRootNodeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/ReplaceRootNodeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -public class ReplaceRootNodeOperation : NodeOperation { - - public Command getCommand() { - return Command.REPLACE_ROOT; - } - - public Either invoke(TreeNode target) { - return target.appendRootNode(); - } - - public int getPosition() { - return -1; - } - - public string getKey() { - return null; - } - - public byte[] getValue() { - return new byte[1]{0}; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/TreeOperation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/operations/TreeOperation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface TreeOperation { - NodePath getNodePath(); - NodeOperation getNodeOperation(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/AppendChildAt.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/AppendChildAt.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class AppendChildAt : NodeEditor { - private int pos; - - public AppendChildAt(int _pos){ - pos = _pos; - } - - public Either _edit(LoggingNode _e) - { - Either either = _e.getChildren().addNewChildAt(pos); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteAttribute.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteAttribute.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class DeleteAttribute : NodeEditor { - private string key; - - public DeleteAttribute(string _key) - { - key = _key; - } - - public Either _edit(LoggingNode logNode) - { - Either either = logNode.getAttributes().delete(key); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteChildAt.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/DeleteChildAt.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class DeleteChildAt : NodeEditor { - private int pos; - - public DeleteChildAt(int _pos) - { - pos = _pos; - } - - public Either _edit(LoggingNode logNode) - { - Either either = logNode.getChildren().deleteChildAt(pos); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/NodeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/NodeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public interface NodeEditor { - Either edit (TreeNode _e); - LoggingNode wrap (TreeNode node, OperationLog op); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/PutAttribute.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/PutAttribute.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class PutAttribute : NodeEditor { - private string key; - private byte[] value; - - public PutAttribute(string _key, byte[] _value) - { - key = _key; - value = _value; - } - - public Either _edit(LoggingNode _e) - { - Either either = _e.getAttributes().put(key,value); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/replaceRootNodeAt.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/replaceRootNodeAt.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -using System.Collections; - -public class replaceRootNodeAt : NodeEditor { - public Either _edit(LoggingNode _e) - { - Either either = _e.replaceNewRootNode(); - if(either.isA()){ - // error - return either; - } - return DefaultEither.newB(either.b()); - } - - public Either 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); - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/AtomicReference.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/AtomicReference.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -using System.Threading; - -public class AtomicReference where T : class { - private T value; - - public AtomicReference(T value) { - this.value = value; - } - - public bool CompareAndSet(T newValue, T prevValue) { - // change to compere exchange. - T oldValue = value; - return (oldValue != Interlocked.CompareExchange (ref value, newValue, prevValue)); - } - - - public T Get() { - return value; - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultJungleTreeEditor.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultJungleTreeEditor.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -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 _edit(NodePath _path,NodeEditor _e) - { - Either either = editor.edit (root, _path, _e); - if (either.isA ()) { - return DefaultEither.newA (either.a ()); - } - - LoggingNode newLogging = either.b (); - OperationLog newLog = newLogging.getOperationLog (); - TreeNode newNode = newLogging.getWrap (); - - IterableConverter.Converter converter = new InnerConverter (_path); - - - IEnumerable iterable = new IterableConverter (newLog, converter); - DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog (iterable, newLog.length ()); - TreeOperationLog newTreeOpLog = log.append (treeOperationLog); - - JungleTreeEditor newEditor = new DefaultJungleTreeEditor (newNode, txManager, editor, newTreeOpLog); - return DefaultEither.newB (newEditor); - - } - - - public Either replaceNewRootNode() { - replaceRootNodeAt appendChildAt = new replaceRootNodeAt (); - return _edit (new DefaultNodePath(), appendChildAt); - } - - public Either addNewChildAt(NodePath _path, int _pos) { - AppendChildAt appendChildAt = new AppendChildAt (_pos); - return _edit (_path, appendChildAt); - } - - public Either deleteChildAt(NodePath _path, int _pos) { - DeleteChildAt deleteChildAt = new DeleteChildAt(_pos); - return _edit(_path,deleteChildAt); - } - - public Either putAttribute(NodePath _path, string _key, byte[] _value) { - PutAttribute putAttribute = new PutAttribute (_key, _value); - return _edit (_path, putAttribute); - } - - public Either deleteAttribute(NodePath _path, string _key) { - DeleteAttribute deleteAttribute = new DeleteAttribute (_key); - return _edit (_path, deleteAttribute); - } - - public Either edit(NodePath _path,NodeEditor _editor) { - return _edit(_path,_editor); - } - - /// - /// Treeを変更したあとSuccess(push)を行う - /// - - public Either success() { - Either either = this.txManager.commit(this.root, this.log); - // このlogをサーバにpushする? - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TransactionManager newTxManager = either.b(); - JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(this.root, newTxManager, this.editor); - - return DefaultEither.newB(newTreeEditor); - } - - public Either flushSuccess() { - return success(); - } - - public class InnerConverter : IterableConverter.Converter{ - - NodePath path; - - public InnerConverter(NodePath _path) { - path = _path; - } - - - public TreeOperation conv(NodeOperation _b){ - return new DefaultTreeOperation(path,_b); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTransactionManager.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTransactionManager.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -using System.Collections.Generic; -using System.Collections; -using System; - -public class DefaultTransactionManager : TransactionManager { - private AtomicReference repository; - private TreeContext tip; - private ChangeListWriter writer; - private string uuid; - - - public DefaultTransactionManager(ChangeListWriter _writer, TreeContext _tip, AtomicReference _repository, string _uuid) { - repository = _repository; - tip = _tip; - writer = _writer; - uuid = _uuid; - } - - public Either 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.CompareAndSet(newTreeContext, newTreeContext.prev())) { // CompareAndSetが成功した場合に処理を実行 - TransactionManager txManager = new DefaultTransactionManager(writer, newTreeContext, repository, uuid); - return DefaultEither.newB(txManager); - } - - return DefaultEither.newA((Error) new DefaultError()); - } - - public Either 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; - - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - - public InnerChangeList(TreeOperationLog _log, string _treeName, string _uuid){ - this.log = _log; - this.treeName = _treeName; - this.uuid = _uuid; - } - - public IEnumerator 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 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeContext.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeContext.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -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 getOperations() { - return changeList; - } - - public TreeMap>> getIndex() { - return traverser.getIndex (); - } - - // don't write parent Index. - - public InterfaceTraverser getTraverser() { - return traverser; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNode.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNode.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -using UnityEngine; -public class DefaultTreeNode : TreeNode { - private List children; - private TreeMap attrs; - // string nodeId = new VMID().toString(); - - private static readonly List NIL_LIST = new List(); - - public DefaultTreeNode() - : this (NIL_LIST, new TreeMap ()) - { - } - - public DefaultTreeNode(List _children, TreeMap _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 appendRootNode() { - TreeNodeChildren newRootChildren = new DefaultTreeNodeChildren(NIL_LIST, new TreeMap()); - Either either = newRootChildren.addNewChildAt(0,this); - return either; - } - - public int compareTo(TreeNode o) { - return this.GetHashCode() - o.GetHashCode(); - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeAttribute.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeAttribute.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; -using System.Text; - -public class DefaultTreeNodeAttribute : TreeNodeAttributes { - public List children; - public TreeMap attrs; - - public DefaultTreeNodeAttribute(List _children, TreeMap _attrs){ - children = _children; // null? - attrs = _attrs; - } - - public TreeMap getAttributesAsRawMap(){ - return attrs; - } - - public Either delete(string _key) { - if (_key == null) { - return DefaultEither.newA (NodeEditorError.NULL_VALUE_NOT_ALLOWED); - } - - if (null == attrs.getRoot()) { - return DefaultEither.newA(NodeEditorError.DELETE_KEY_NOT_FOUND); - } - - TreeMap newMap = attrs.delete(_key); - TreeNode newNode = new DefaultTreeNode(children, newMap); - return DefaultEither.newB(newNode); - } - - public Either put(string _key, byte[] _value){ - if (_key == null || _value == null) { - return DefaultEither.newA (NodeEditorError.NULL_VALUE_NOT_ALLOWED); - } - - TreeMap newMap = attrs.put (_key, _value); - - TreeNode newNode = new DefaultTreeNode (children, newMap); - - return DefaultEither.newB (newNode); - } - - public byte[] get(string _key) { - if (_key == null) { - return new byte[1]{0}; - } - byte[] op = attrs.get(_key); //null - if (op != null) { - return op; - } - return new byte[1]{0}; - } - - 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 getKeys(){ - return attrs.keys (); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeChildren.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/DefaultTreeNodeChildren.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class DefaultTreeNodeChildren : TreeNodeChildren { - - public List children; - public TreeMap attrs; - - public DefaultTreeNodeChildren(List _children, TreeMap _attrs){ - children = _children; - attrs = _attrs; - } - - private bool boundaryCheck(int _pos) { - int size = children.length (); - if (size < _pos) { - return false; - } - return true; - } - - public List getChildrenAsRawList() { - return children; - } - - public Either addNewChildAt(int _pos) { - if (!boundaryCheck(_pos) || _pos < 0) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - - List newChildren = children.add(_pos, new DefaultTreeNode()); - TreeNode newNode = new DefaultTreeNode(newChildren, attrs); - return DefaultEither.newB(newNode); - } - - - public Either deleteChildAt(int _pos) { - if (!boundaryCheck(_pos) || _pos < 0 || size() == 0) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - - List newChildren = children.delete(_pos); - TreeNode newNode = new DefaultTreeNode(newChildren, attrs); - - return DefaultEither.newB(newNode); - } - - - public int size() { - return children.length(); - } - - -// public Iterator iterator() { -// return children.iterator(); -// } - - - public Either replaceNode(int _pos, TreeNode _replacement) { - int size = children.length(); - if (!(0 <= _pos && _pos < size)) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - TreeNode replacement = _replacement; - - List newChildren = children.replace(_pos, replacement); - TreeNode node = new DefaultTreeNode(newChildren, attrs); - return DefaultEither.newB(node); - } - - - public Either at(int _pos) { - if (children.length() < _pos + 1) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - - TreeNode Node = children.index(_pos); - - return DefaultEither.newB(Node); - } - - - public Either addNewChildAt(int _pos, TreeNode _newChild) { - if (!boundaryCheck(_pos) || _pos < 0) { - return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - List newChildren = children.add(_pos, _newChild); - TreeNode newNode = new DefaultTreeNode(newChildren, attrs); - - return DefaultEither.newB(newNode); - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/TransactionManager.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/transaction/TransactionManager.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - -public interface TransactionManager { - Either commit(TreeNode _newRoot, TreeOperationLog _log); - Either firstcommit(TreeNode _newRoot, TreeOperationLog _log); - string getUUID(); - long getRevision(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluator.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultEvaluator.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -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 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); - - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultTraverser.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/DefaultTraverser.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -using System.Collections.Generic; -using System.Collections; -using UnityEngine; -using System; -// yet write. -public class DefaultTraverser : Traverser { - - - public Either traverse(TreeNode _root, Evaluator _evaluator) { - // 無名クラスを書いてない - Children warper = new InnerChildren(_root, _evaluator); - - Children chs = warper; - Either>> ret = _traverse(chs, _evaluator, -1); - - if (ret.isA ()) { - return DefaultEither.newA (ret.a ()); - } - - List> list = ret.b (); - IEnumerator> iterable = list.iterator (); - TreeNode destination = ret.b ().headList ().getTarget (); - - Traversal traversal = new InnerTraversal (iterable, destination); - - return DefaultEither.newB (traversal); - - } - - - private Either>> _traverse(Children _chs, Evaluator _evaluator, int _pos) { - int pos = _pos; - TreeNode ch; - for (int i = 0; i < _chs.size(); i++) { - Either 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>>.newB(_goal(ch, pos)); - } - - if (r == Result.BREAK) { - break; - } - - if (r == Result.CONTINUE) { - pos++; - continue; - } - - return DefaultEither>>.newA (TraverserError.UNDEFINED_OPERATOR); - } - return DefaultEither>>.newA (TraverserError.PATH_NOT_FOUND); - } - - - private List> _goal( TreeNode _current, int _pos) { - Direction d = new InnerDirection (_pos, _current); - - List> list = new List> (); - List> newList = list.addLast (d); - - return newList; - } - - - private Either>> _accept(TreeNode _current, int _pos,Evaluator _evaluator) - { - Children chs = _current.getChildren (); - Either>> either = _traverse (chs, _evaluator, 0); - if (either.isA ()) { - return either; - } - List> list = either.b (); - Direction d = new InnerDirection (_pos, _current); - - List> newList = list.addLast (d); - return DefaultEither>>.newB (newList); - } - - public class InnerTraversal : Traversal{ - IEnumerator> iterable; - TreeNode destination; - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public IEnumerator> GetEnumerator() - { - return iterable; - } - - - public InnerTraversal(IEnumerator> _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 iterator() { - List list = new List (); - return list.addLast (root).iterator (); - } - - public int size() { - return 1; - } - - public Either at(int _pos) { - if (_pos != 0) { - return DefaultEither.newA (NodeEditorError.INDEX_OUT_OF_BOUNDS); - } - return DefaultEither.newB (root); - } - } - - public class InnerDirection : Direction{ - 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 diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Direction.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Direction.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - -public interface Direction { - int getPosition(); - T getTarget(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluation.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluation.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - -public interface Evaluation { - Result results(); - Evaluator evaluators(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluator.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Evaluator.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public interface Evaluator { - Evaluation evaluate (TreeNode _current, int _pos); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/InterfaceTraverser.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/InterfaceTraverser.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - -public class InterfaceTraverser { - TreeNode root; - TreeMap>> indexList; - ParentIndex parentIndex; - bool parentUpdateFlag; - bool useIndex; - - public InterfaceTraverser(TreeNode root, bool indexFlag) - : this (root, new TreeMap>> (), new ParentIndex (), indexFlag) - { - } - - public InterfaceTraverser(TreeNode root, TreeMap>> 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>> getIndex() { - return indexList; - } - - public void commit() { - parentUpdateFlag = false; - } - - public ParentIndex getParentIndex() { - return parentIndex; - } - - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traversal.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traversal.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -using System.Collections.Generic; - -public interface Traversal : IEnumerable> { - TreeNode destinations(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traverser.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/Traverser.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - -// jungle/ -public interface Traverser { - - Either traverse ( TreeNode _root, Evaluator _evaluator); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/TraverserError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/traverser/TraverserError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - -public class TraverserError { - public static Error UNDEFINED_OPERATOR = new DefaultError(); - public static Error PATH_NOT_FOUND = new DefaultError(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultEither.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultEither.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ - -public class DefaultEither : Either { - private A theA; - private B theB; - - private DefaultEither(A _theA, B _theB){ - theA = _theA; - theB = _theB; - } - - public static DefaultEither newA(A _theA) - { - return new DefaultEither(_theA,default(B)); - } - - public static DefaultEither newB(B _theB) - { - return new DefaultEither(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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/DefaultError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - -public class DefaultError : Error { - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Either.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Either.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - -public interface Either { - A a(); - bool isA(); - B b(); - bool isB(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Error.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Error.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public interface Error { - -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/GetOldTreeError.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/GetOldTreeError.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -public class GetOldTreeError : Error { - public static Error OLD_TREE_NOT_FOUND = new DefaultError(); -} diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/IterableConverter.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/IterableConverter.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using System.Collections; -using System; - -public class IterableConverter : IEnumerable { - private IEnumerable iterable; - private Converter converter; - - - IEnumerator IEnumerable.GetEnumerator() - { - // call the generic version of the method - return this.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return iterator (); - } - - public IterableConverter(IEnumerable _iterable,Converter _converter) - { - iterable = _iterable; - converter = _converter; - } - - public IEnumerator iterator() - { - return new IteratorConverter(iterable.GetEnumerator(),converter); - } - - private class IteratorConverter : IEnumerator - { - public List appLines { get; set; } - - private IEnumerator iterator; - private Converter converter; - - public IteratorConverter(IEnumerator _iterator,Converter _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; } - } - - public void Dispose() { - ((IEnumerator)this.appLines).Dispose (); - } - } - - - public interface Converter{ - A conv (B _b); - } - -} \ No newline at end of file diff -r e07d8f241630 -r f99f39ac5be8 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Pair.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/util/Pair.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class Pair { - 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; - } - -} diff -r e07d8f241630 -r f99f39ac5be8 src/test.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4df8e3bcf46384763b4ddb79fecede1e +folderAsset: yes +timeCreated: 1478444950 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3e1122d186bd942d49a8ce5c49329c57 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/DefaultJungleTreeTest.cs --- a/src/test/csharp/DefaultJungleTreeTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -using UnityEngine; -using System; -//using System.Diagnostics; - -public class DefaultJungleTreeTest : MonoBehaviour { - // apiの仕様的にこんな感じ - private readonly int COUNT = 500; - public Jungle instance() { - Jungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); // hogeというtreeを作る - return j; - } - - public string key = "moumou"; - private byte[] value = BitConverter.GetBytes(10); - - public void Insert () { - Jungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); - JungleTree t = j.createNewTree("tree"); - - JungleTreeEditor editor1 = t.getTreeEditor(); - - DefaultNodePath root = new DefaultNodePath(); - - 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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0b54b0e3bd9754d93be52212b2681094 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/DefaultJungleTreeTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/DefaultJungleTreeTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/deleteTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/deleteTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/listAdd.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/listAdd.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/replaceTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/list/replaceTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapDelete.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapDelete.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/data/treemap/TreeMapTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -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()); -// } - for(int count = 5; count > -10; count--){ - int op = map.get(count); - if(op != null) { - Debug.Log("op " + op); - } - } - Debug.Log ("end"); - - } -} - diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 101adcfb26f2944c8800370a02d957f1 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 681cf10920ffc4080bdac0652ef155bc +timeCreated: 1478444954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7cb126621dcee4e8ebc5319145d374c0 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a384b88c6df8847d7aab285819ae36fb +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/deleteTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/deleteTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/deleteTest.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e9b5e96cbe47543488dd8dc8d2fbc604 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/listAdd.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/listAdd.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/listAdd.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 25f833369f8934547abcd56b334c50b7 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/replaceTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/replaceTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/list/replaceTest.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 03f0e538edace4f34a0ce6b9d208119d +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cf4af4e227fde4ab090f8a96f4c95d0a +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapDelete.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapDelete.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -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 e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapDelete.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1dedacd2be558447e9dc70e99f5121f4 +timeCreated: 1478444953 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -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("------------------------------------------"); - - - } - - } -} - diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f347b48e1f13c4b739307ca420dc9a7b +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 076ec1ab7bcf94e1f9146ff618f0e57a +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c16e0ac5ed2bc4252bd684bc6f838342 +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core/nodeeditor.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7d3a0ab74b4b94b2ba3e9a4be44ff38f +folderAsset: yes +timeCreated: 1478444952 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core/nodeeditor/PutAttributeTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core/nodeeditor/PutAttributeTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -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 () { - - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/jungle/core/nodeeditor/PutAttributeTest.cs.meta --- /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.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ba07e3300dd7f45dbaea170e94ceac7d +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0ce639aa3ac534cddbc6c7f6d0dde33b +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7612d4ac089684ab9980d39f09c8f71e +folderAsset: yes +timeCreated: 1478444951 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildOperationTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildOperationTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -using UnityEngine; -using System.Collections; -using MsgPack; - -// http://qiita.com/snaka/items/8da9f89deeef17b1923a -// message pack refarence URL. -public class NetworkAppendChildOperationTest : MonoBehaviour { - - // Use this for initialization - void Start () { - NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(1); - ObjectPacker pack = new ObjectPacker(); - byte[] value = pack.Pack(op); - - // unpackage - ObjectPacker unpack = new ObjectPacker(); - NetworkAppendChildAtOperation mOp = unpack.Unpack(value); - print(mOp.getPosition()); // add position 1 , get what number? - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildOperationTest.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildOperationTest.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ea8b377e596ce4021811a402ea92a480 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperationTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperationTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -using UnityEngine; -using System.Collections; -using MsgPack; - -public class NetworkDeleteAttributeOperationTest : MonoBehaviour { - - // Use this for initialization - void Start () { - NetworkDeleteAttributeOperation op = new NetworkDeleteAttributeOperation("hoge"); - ObjectPacker pack = new ObjectPacker(); - byte[] value = pack.Pack(op); - - // unpackage - ObjectPacker unpack = new ObjectPacker(); - NetworkDeleteAttributeOperation mOp = unpack.Unpack(value); - print(mOp.getKey()); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperationTest.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperationTest.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0fda6f1733e4c48eda30a4882b462637 +timeCreated: 1478444952 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperationTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperationTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -using UnityEngine; -using System.Collections; -using MsgPack; - -public class NetworkDeleteChildAtOperationTest : MonoBehaviour { - - // Use this for initialization - void Start () { - NetworkDeleteChildAtOperation op = new NetworkDeleteChildAtOperation(1); - ObjectPacker pack = new ObjectPacker(); - byte[] value = pack.Pack(op); - - // unpackage - ObjectPacker unpack = new ObjectPacker(); - NetworkDeleteChildAtOperation mOp = unpack.Unpack(value); - print(mOp.getPosition()); - print(mOp.getCommand()); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperationTest.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperationTest.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b10d50e11beb94f549dbcf90d1e06974 +timeCreated: 1478444956 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperationTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperationTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -using UnityEngine; -using System.Collections; -using MsgPack; - -public class NetworkNodeOperationTest : MonoBehaviour { - - // Use this for initialization - void Start () { - NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(3); - NetworkNodeOperation nOp = new NetworkNodeOperation(op); - - ObjectPacker pack = new ObjectPacker(); - byte[] value = pack.Pack(nOp); - - ObjectPacker unpack = new ObjectPacker(); - NetworkNodeOperation mnp = unpack.Unpack(value); - print (mnp.getCommand()); - print (mnp.getPosition()); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperationTest.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperationTest.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ddc2b47207c15421daeaa9eef2a41a14 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperationTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperationTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -using UnityEngine; -using System.Collections; -using MsgPack; -using System; - -public class NetworkPutAttributeOperationTest : MonoBehaviour { - - // Use this for initialization - void Start () { - byte[] value = System.Text.ASCIIEncoding.UTF8.GetBytes("test"); - NetworkPutAttributeOperation op = new NetworkPutAttributeOperation("hoge", value); - - ObjectPacker pack = new ObjectPacker(); - // send this byte to server. - byte[] packValue = pack.Pack(op); - - ObjectPacker unpack = new ObjectPacker(); - NetworkPutAttributeOperation nOp = unpack.Unpack(packValue); - print(System.Text.ASCIIEncoding.UTF8.GetString(nOp.getValue())); - print (nOp.getCommand()); - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperationTest.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperationTest.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dd0e8a440e2f545f28cd700b2b1611a2 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLogTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLogTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -using UnityEngine; -using System.Collections; -using MsgPack; - -public class NetworkTreeOperationLogTest : MonoBehaviour { - - // Use this for initialization - void Start () { // not work yet 10/23 13:33 - NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(1); - NetworkNodePath path = new NetworkNodePath(); - NodePath npath = path.add(1).add(2); - NetworkTreeOperationLog log = new NetworkTreeOperationLog(); - log.add(npath, op); - log.add(npath, op); - ObjectPacker pack = new ObjectPacker(); - byte[] value = pack.Pack(log); - - // unpackage - ObjectPacker unpack = new ObjectPacker(); - NetworkTreeOperationLog mOp = unpack.Unpack(value); - foreach (var m in mOp) { - print(m.getNodePath().size()); - print(m.getNodeOperation()); - } - } -} diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLogTest.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLogTest.cs.meta Mon Nov 07 00:15:25 2016 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e271cb5bf570740359c508498f8fc643 +timeCreated: 1478444957 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r e07d8f241630 -r f99f39ac5be8 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/nodeeditor/PutAttributeTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle/core/nodeeditor/PutAttributeTest.cs Sun Oct 23 13:37:01 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -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 () { - - } -}