# HG changeset patch # User Kazuma Takeda # Date 1484740944 -32400 # Node ID f7616084d3ab351d3b3dc1522a1389d545c3aeb1 # Parent 9588ad364fdda6dae2dde71d83a03aba42ecd1ca Continue to put on the created path. diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-main/JungleTreeEditor.cs --- a/Main/jungle-main/JungleTreeEditor.cs Wed Jan 18 19:53:29 2017 +0900 +++ b/Main/jungle-main/JungleTreeEditor.cs Wed Jan 18 21:02:24 2017 +0900 @@ -4,7 +4,9 @@ Either addNewChildAt(NodePath path,int pos); Either deleteChildAt(NodePath path,int pos); Either putAttribute(NodePath path,string key, byte[] value); + Either putAttribute(string key, byte[] value); // add Method put Attribute (path, T?); + // Either putAttribute(NodePath path, string Key, MultiAttributes value); Either deleteAttribute(NodePath path,string key); Either replaceNewRootNode(); Either edit(NodePath path, NodeEditor editor); diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-main/core/MultiAttributes.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Main/jungle-main/core/MultiAttributes.cs Wed Jan 18 21:02:24 2017 +0900 @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace JungleDB { + public class MultiAttributes { + private T attribute; + public T Attribute { + set { this.attribute = value; } + get { return this.attribute; } + } + + public MultiAttributes (T value) { + this.Attribute = value; + } + + public string getString () { + return attribute.ToString (); + } + } +} diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-main/core/MultiAttributes.cs.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Main/jungle-main/core/MultiAttributes.cs.meta Wed Jan 18 21:02:24 2017 +0900 @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5986906e4cd3448a7bcde454a46cab69 +timeCreated: 1484737113 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-main/store/impl/TreeNodeAttributes.cs --- a/Main/jungle-main/store/impl/TreeNodeAttributes.cs Wed Jan 18 19:53:29 2017 +0900 +++ b/Main/jungle-main/store/impl/TreeNodeAttributes.cs Wed Jan 18 21:02:24 2017 +0900 @@ -3,6 +3,7 @@ public interface TreeNodeAttributes : Attributes { Either delete(string key); Either put(string key, byte[] value); + // Either put (string key, MultiAttributes value); TreeMap getAttributesAsRawMap(); IEnumerator getKeys(); } diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-main/store/operations/NodeOperation.cs --- a/Main/jungle-main/store/operations/NodeOperation.cs Wed Jan 18 19:53:29 2017 +0900 +++ b/Main/jungle-main/store/operations/NodeOperation.cs Wed Jan 18 21:02:24 2017 +0900 @@ -6,4 +6,12 @@ string getKey(); byte[] getValue(); } + + public interface NodeOperation { + Command getCommand(); + Either invoke (TreeNode _target); + int getPosition(); + string getKey(); + MultiAttributes getValue(); + } } diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-main/store/transformer/PutAttribute.cs --- a/Main/jungle-main/store/transformer/PutAttribute.cs Wed Jan 18 19:53:29 2017 +0900 +++ b/Main/jungle-main/store/transformer/PutAttribute.cs Wed Jan 18 21:02:24 2017 +0900 @@ -35,4 +35,4 @@ return new LoggingNode(node, op); } } -} + } diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-main/transaction/DefaultJungleTreeEditor.cs --- a/Main/jungle-main/transaction/DefaultJungleTreeEditor.cs Wed Jan 18 19:53:29 2017 +0900 +++ b/Main/jungle-main/transaction/DefaultJungleTreeEditor.cs Wed Jan 18 21:02:24 2017 +0900 @@ -57,6 +57,7 @@ } public Either addNewChildAt(NodePath _path, int _pos) { + prevPath = _path.add (_pos); AppendChildAt appendChildAt = new AppendChildAt (_pos); return _edit (_path, appendChildAt); } @@ -65,18 +66,30 @@ 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); } + /// + /// When use path, before create path. + /// * Problem -> copy to path from root everytime. + /// + /// The attribute. + /// Key. + /// Value. + public Either putAttribute(string _key, byte[] _value) { + PutAttribute putAttribute = new PutAttribute (_key, _value); + return _edit (prevPath, putAttribute); + } + public Either deleteAttribute(NodePath _path, string _key) { DeleteAttribute deleteAttribute = new DeleteAttribute (_key); return _edit (_path, deleteAttribute); } - public Either edit(NodePath _path,NodeEditor _editor) { + public Either edit(NodePath _path, NodeEditor _editor) { return _edit(_path,_editor); } diff -r 9588ad364fdd -r f7616084d3ab Main/jungle-network/transaction/NetworkDefaultJungleTreeEditor.cs --- a/Main/jungle-network/transaction/NetworkDefaultJungleTreeEditor.cs Wed Jan 18 19:53:29 2017 +0900 +++ b/Main/jungle-network/transaction/NetworkDefaultJungleTreeEditor.cs Wed Jan 18 21:02:24 2017 +0900 @@ -11,6 +11,8 @@ private readonly TreeOperationLog Log; private bool ExportLog; + private NodePath prevPath; + public NetworkDefaultJungleTreeEditor(string tname, TreeNode root, TransactionManager txMan, TreeEditor edit) { this.TreeName = tname; @@ -77,8 +79,8 @@ } - public Either addNewChildAt(NodePath _path, int _pos) - { + public Either addNewChildAt(NodePath _path, int _pos) { + prevPath = _path.add (_pos); AppendChildAt appendChildAt = new AppendChildAt(_pos); return this.TreeEditor(_path,appendChildAt); } @@ -95,6 +97,12 @@ return this.TreeEditor(_path,putAttribute); } + public Either putAttribute(string _key, byte[] _value) + { + PutAttribute putAttribute = new PutAttribute(_key,_value); + return this.TreeEditor(prevPath, putAttribute); + } + public Either deleteAttribute(NodePath _path, string _key) { DeleteAttribute deleteAttribute = new DeleteAttribute(_key); diff -r 9588ad364fdd -r f7616084d3ab README.md --- a/README.md Wed Jan 18 19:53:29 2017 +0900 +++ b/README.md Wed Jan 18 21:02:24 2017 +0900 @@ -74,5 +74,6 @@ // end put Attribute function. } +# Fix Update -# Get Data. +1/18 no use path, Continue to put on the created path.