Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 117:74723b26ad96
add IndexJungleTreeEditr and remove DefaultJungleIndexTreeEditor
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Tue Sep 30 13:15:22 2014 +0900 @@ -8,9 +8,9 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.TreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.AtomicReservableReference; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultJungleIndexTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultJungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTransactionManager; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.IndexJungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.TreeContext; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.InterfaceTraverser; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; @@ -46,9 +46,8 @@ TreeContext tc = repository.get(); DefaultTransactionManager txManager = new DefaultTransactionManager(writer,tc,repository,uuid); TreeNode root = tc.getTreeNode(); - ChangeSet cs = tc.getChangeSet(); - TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> newIndex = cs.getIndex(); - return new DefaultJungleIndexTreeEditor(root,txManager,editor,newIndex); + TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> newIndex = getIndex(); + return new IndexJungleTreeEditor(root,txManager,editor,newIndex); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/JungleTreeEditor.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/JungleTreeEditor.java Tue Sep 30 13:15:22 2014 +0900 @@ -2,9 +2,9 @@ import java.nio.ByteBuffer; - import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.NodeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/TreeEditor.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/TreeEditor.java Tue Sep 30 13:15:22 2014 +0900 @@ -1,12 +1,12 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.NodeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public interface TreeEditor { - public Either<Error,Logging> edit(TreeNode root,NodePath path,NodeEditor transformer); + public Either<Error,LoggingNode> edit(TreeNode root,NodePath path,NodeEditor transformer); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultTreeEditor.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultTreeEditor.java Tue Sep 30 13:15:22 2014 +0900 @@ -3,6 +3,7 @@ import fj.data.List; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.NodeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultEvaluator; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.Direction; @@ -11,7 +12,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class DefaultTreeEditor implements TreeEditor { @@ -23,7 +23,7 @@ } @Override - public Either<Error,Logging> edit(TreeNode root,NodePath path,NodeEditor editor) + public Either<Error,LoggingNode> edit(TreeNode root,NodePath path,NodeEditor editor) { DefaultEvaluator e = new DefaultEvaluator(path); Either<Error, Traversal> either = traverser.traverse(root,e); @@ -33,12 +33,12 @@ } Traversal t = either.b(); - Either<Error,Logging> ret = clone(t,editor); + Either<Error,LoggingNode> ret = clone(t,editor); return ret; } - private Either<Error,Logging> clone(Traversal t,NodeEditor editor) + private Either<Error,LoggingNode> clone(Traversal t,NodeEditor editor) { // copying nodes from bottom to root @@ -51,12 +51,12 @@ Direction<TreeNode> targetDirection = path.head(); TreeNode target = targetDirection.getTarget(); //EditableNodeWrapper<T> wrapper = new EditableNodeWrapper<T>(target); - Either<Error,Logging> either = editor.edit(target); + Either<Error,LoggingNode> either = editor.edit(target); if(either.isA()){ return DefaultEither.newA(either.a()); } - Logging newWrap = either.b(); + LoggingNode newWrap = either.b(); // top int pos = targetDirection.getPosition(); @@ -75,7 +75,7 @@ } TreeNode newRoot = child; - Logging logNode = editor.wrap(newRoot,newWrap.getOperationLog()); + LoggingNode logNode = editor.wrap(newRoot,newWrap.getOperationLog()); return DefaultEither.newB(logNode); } } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingAttributes.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingAttributes.java Tue Sep 30 13:15:22 2014 +0900 @@ -10,7 +10,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class LoggingAttributes //implements EditableAttributes { @@ -29,7 +28,7 @@ return attributes.get(_key); } - private Either<Error,Logging> edit(NodeOperation _op) + private Either<Error,LoggingNode> edit(NodeOperation _op) { Either<Error,TreeNode> either = _op.invoke(wrap); if(either.isA()){ @@ -38,19 +37,19 @@ TreeNode newNode = either.b(); OperationLog newLog = log.add(_op); - Logging newLogNode = new LoggingNode(newNode,newLog); + LoggingNode newLogNode = new LoggingNode(newNode,newLog); return DefaultEither.newB(newLogNode); } - public Either<Error,Logging> delete(final String _key) + public Either<Error,LoggingNode> delete(final String _key) { DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key); return edit(deleteAttribute); } - public Either<Error,Logging> put(final String _key,final ByteBuffer _value) + public Either<Error,LoggingNode> put(final String _key,final ByteBuffer _value) { PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value); return edit(putAttribute);
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingChildren.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingChildren.java Tue Sep 30 13:15:22 2014 +0900 @@ -10,7 +10,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class LoggingChildren //implements EditableChildren { @@ -37,7 +36,7 @@ return children.iterator(); }*/ - public Either<Error,Logging> edit(NodeOperation _op) + public Either<Error,LoggingNode> edit(NodeOperation _op) { Either<Error,TreeNode> either = _op.invoke(wrap); if(either.isA()){ @@ -46,23 +45,23 @@ TreeNode newWrap = either.b(); OperationLog newLog = log.add(_op); - Logging newLoggingNode = new LoggingNode(newWrap,newLog); + LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); return DefaultEither.newB(newLoggingNode); } - public Either<Error,Logging> addNewChildAt(final int _pos) + public Either<Error,LoggingNode> addNewChildAt(final int _pos) { NodeOperation addNewChildAt = new AppendChildAtOperation(_pos); return edit(addNewChildAt); } - public Either<Error,Logging> deleteChildAt(final int _pos) + public Either<Error,LoggingNode> deleteChildAt(final int _pos) { NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos); return edit(deleteChildAt); } - public Either<Error,Logging> at(int _pos) + public Either<Error,LoggingNode> at(int _pos) { Children children = wrap.getChildren(); Either<Error,TreeNode> either = children.at(_pos); @@ -71,7 +70,7 @@ } TreeNode node = either.b(); - Logging logNode = new LoggingNode(node); + LoggingNode logNode = new LoggingNode(node); return DefaultEither.newB(logNode); } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNode.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNode.java Tue Sep 30 13:15:22 2014 +0900 @@ -5,10 +5,9 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; -public class LoggingNode implements Logging +public class LoggingNode { public LoggingNode(TreeNode _wrap) { @@ -24,32 +23,25 @@ private final TreeNode wrap; private final OperationLog log; - @Override public LoggingAttributes getAttributes() { return new LoggingAttributes(wrap,log); } - - @Override + public LoggingChildren getChildren() { return new LoggingChildren(wrap,log); } - @Override + public OperationLog getOperationLog() { return log; } - @Override public TreeNode getWrap() { return wrap; } - @Override - public TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> getIndex() { - return null; - } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Tue Sep 30 13:15:22 2014 +0900 @@ -13,7 +13,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class AppendChildAt implements NodeEditor { @@ -24,9 +23,9 @@ pos = _pos; } - public Either<Error, Logging> _edit(Logging _e) + public Either<Error, LoggingNode> _edit(LoggingNode _e) { - Either<Error,Logging> either = _e.getChildren().addNewChildAt(pos); + Either<Error,LoggingNode> either = _e.getChildren().addNewChildAt(pos); if(either.isA()){ // error return either; @@ -35,17 +34,17 @@ } @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); + public Either<Error, LoggingNode> edit(TreeNode _e) { + LoggingNode logNode = wrap(_e); return _edit(logNode); } - public Logging wrap(TreeNode node) { + public LoggingNode wrap(TreeNode node) { return new LoggingNode(node); } @Override - public Logging wrap(TreeNode node, OperationLog op) { + public LoggingNode wrap(TreeNode node, OperationLog op) { return new LoggingNode(node, op); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Tue Sep 30 13:15:22 2014 +0900 @@ -10,7 +10,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class DeleteAttribute implements NodeEditor { @@ -20,9 +19,9 @@ key = _key; } - public Either<Error,Logging> _edit(Logging logNode) + public Either<Error,LoggingNode> _edit(LoggingNode logNode) { - Either<Error,Logging> either = logNode.getAttributes().delete(key); + Either<Error,LoggingNode> either = logNode.getAttributes().delete(key); if(either.isA()){ // error return either; @@ -31,17 +30,17 @@ } @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); + public Either<Error, LoggingNode> edit(TreeNode _e) { + LoggingNode logNode = wrap(_e); return _edit(logNode); } - public Logging wrap(TreeNode node) { + public LoggingNode wrap(TreeNode node) { return new LoggingNode(node); } @Override - public Logging wrap(TreeNode node, OperationLog op) { + public LoggingNode wrap(TreeNode node, OperationLog op) { return new LoggingNode(node, op); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Tue Sep 30 13:15:22 2014 +0900 @@ -13,7 +13,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class DeleteChildAt implements NodeEditor { @@ -23,9 +22,9 @@ pos = _pos; } - public Either<Error,Logging> _edit(Logging logNode) + public Either<Error,LoggingNode> _edit(LoggingNode logNode) { - Either<Error,Logging> either = logNode.getChildren().deleteChildAt(pos); + Either<Error,LoggingNode> either = logNode.getChildren().deleteChildAt(pos); if(either.isA()){ // error return either; @@ -34,17 +33,17 @@ } @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); + public Either<Error, LoggingNode> edit(TreeNode _e) { + LoggingNode logNode = wrap(_e); return _edit(logNode); } - public Logging wrap(TreeNode node) { + public LoggingNode wrap(TreeNode node) { return new LoggingNode(node); } @Override - public Logging wrap(TreeNode node, OperationLog op) { + public LoggingNode wrap(TreeNode node, OperationLog op) { return new LoggingNode(node, op); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Tue Sep 30 13:15:22 2014 +0900 @@ -10,11 +10,10 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public interface NodeEditor { - public Either<Error,Logging> edit(TreeNode _e); - public Logging wrap(TreeNode node, OperationLog op); + public Either<Error,LoggingNode> edit(TreeNode _e); + public LoggingNode wrap(TreeNode node, OperationLog op); public TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> getIndex(); } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/PutAttribute.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/PutAttribute.java Tue Sep 30 13:15:22 2014 +0900 @@ -17,7 +17,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class PutAttribute implements NodeEditor { @@ -30,9 +29,9 @@ value = _value; } - public Either<Error,Logging> _edit(Logging _e) + public Either<Error,LoggingNode> _edit(LoggingNode _e) { - Either<Error,Logging> either = _e.getAttributes().put(key,value); + Either<Error,LoggingNode> either = _e.getAttributes().put(key,value); if(either.isA()){ // error return either; @@ -41,17 +40,17 @@ } @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); + public Either<Error, LoggingNode> edit(TreeNode _e) { + LoggingNode logNode = wrap(_e); return _edit(logNode); } - public Logging wrap(TreeNode node) { + public LoggingNode wrap(TreeNode node) { return new LoggingNode(node); } @Override - public Logging wrap(TreeNode node, OperationLog op) { + public LoggingNode wrap(TreeNode node, OperationLog op) { return new LoggingNode(node, op); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleIndexTreeEditor.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction; - -import java.nio.ByteBuffer; - -import fj.data.List; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.TreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DefaultTreeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.AppendChildAt; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.DeleteAttribute; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.DeleteChildAt; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.NodeEditor; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.IterableConverter; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.AppendChildAtIndex; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.DeleteAttributeIndex; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.DeleteChildAtIndex; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.PutAttributeIndex; - -public class DefaultJungleIndexTreeEditor extends DefaultJungleTreeEditor -{ - private final TransactionManager txManager; - private final TreeNode root; - private final TreeEditor editor; - private final TreeOperationLog log; - private TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index; - - public DefaultJungleIndexTreeEditor(TreeNode _root,TransactionManager _txManager,TreeEditor _editor, TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) - { - this(_root,_txManager,_editor,new DefaultTreeOperationLog(), index); - } - - public DefaultJungleIndexTreeEditor(TreeNode newNode,TransactionManager _txManager,TreeEditor _editor,TreeOperationLog _log, TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) - { - super(newNode, _txManager, _editor , _log); - this.root = newNode; - this.txManager = _txManager; - this.editor = _editor; - this.log = _log; - this.index = index; - } - - private Either<Error,JungleTreeEditor> _edit(final NodePath _path,NodeEditor _e) - { - //LoggingNodeHook hook = new LoggingNodeHook(_e); - Either<Error,Logging> either = editor.edit(root,_path,_e); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - Logging newLogging = either.b(); - OperationLog newLog = newLogging.getOperationLog(); - TreeNode newNode = newLogging.getWrap(); - index = newLogging.getIndex(); - IterableConverter.Converter<TreeOperation,NodeOperation> converter = new IterableConverter.Converter<TreeOperation,NodeOperation>(){ - @Override - public TreeOperation conv(NodeOperation _b){ - return new DefaultTreeOperation(_path,_b); - } - }; - - Iterable<TreeOperation> iterable = new IterableConverter<TreeOperation,NodeOperation>(newLog,converter); - DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); - TreeOperationLog newTreeOpLog = log.append(treeOperationLog); - - JungleTreeEditor newEditor = new DefaultJungleIndexTreeEditor(newNode,txManager,editor,newTreeOpLog, index); - return DefaultEither.newB(newEditor); - } - - @Override - public Either<Error,JungleTreeEditor> addNewChildAt(NodePath _path, int _pos) - { - AppendChildAtIndex appendChildAt = new AppendChildAtIndex(_pos, index); - return _edit(_path,appendChildAt); - } - - @Override - public Either<Error,JungleTreeEditor> deleteChildAt(NodePath _path, int _pos) - { - DeleteChildAtIndex deleteChildAt = new DeleteChildAtIndex(_pos, index); - return _edit(_path,deleteChildAt); - } - - @Override - public Either<Error,JungleTreeEditor> putAttribute(NodePath _path,String _key,ByteBuffer _value) - { - PutAttributeIndex putAttribute = new PutAttributeIndex(_key,_value, index); - return _edit(_path,putAttribute); - } - - @Override - public Either<Error,JungleTreeEditor> deleteAttribute(NodePath _path, String _key) - { - DeleteAttributeIndex deleteAttribute = new DeleteAttributeIndex(_key, index); - return _edit(_path,deleteAttribute); - } - - @Override - public Either<Error,JungleTreeEditor> edit(NodePath _path,NodeEditor _editor) - { - return _edit(_path,_editor); - } - - @Override - public Either<Error,JungleTreeEditor> success() - { - Either<Error,TransactionManager> either = txManager.commit(root,log, index); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TransactionManager newTxManager = either.b(); - JungleTreeEditor newTreeEditor = new DefaultJungleIndexTreeEditor(root,newTxManager,editor, index); - - return DefaultEither.newB(newTreeEditor); - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Tue Sep 30 13:15:22 2014 +0900 @@ -25,7 +25,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.IterableConverter; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class DefaultJungleTreeEditor implements JungleTreeEditor { @@ -54,12 +53,12 @@ private Either<Error,JungleTreeEditor> _edit(final NodePath _path,NodeEditor _e) { - Either<Error,Logging> either = editor.edit(root,_path,_e); + Either<Error,LoggingNode> either = editor.edit(root,_path,_e); if(either.isA()){ return DefaultEither.newA(either.a()); } - Logging newLogging = either.b(); + LoggingNode newLogging = either.b(); OperationLog newLog = newLogging.getOperationLog(); TreeNode newNode = newLogging.getWrap();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/AppendChildAtIndex.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index; - -import fj.data.List; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultOperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.AppendChildAt; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; - -public class AppendChildAtIndex extends AppendChildAt { - - private TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index; - - public AppendChildAtIndex(int _pos, TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) { - super(_pos); - this.index = index; - - } - - @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); - return _edit(logNode); - } - - @Override - public Logging wrap(TreeNode node) { - return new LoggingIndexNode(node, index); - } - - @Override - public Logging wrap(TreeNode node, OperationLog op) { - return new LoggingIndexNode(node, op, index); - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/DeleteAttributeIndex.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index; - -import fj.data.List; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.DeleteAttribute; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; - -public class DeleteAttributeIndex extends DeleteAttribute { - - TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index; - private String key; - - public DeleteAttributeIndex(String _key ,TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) { - super(_key); - this.key = key; - this.index = index; - } - - @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); - return _edit(logNode); - } - - @Override - public Logging wrap(TreeNode node) { - return new LoggingIndexNode(node, index); - } - - @Override - public Logging wrap(TreeNode node, OperationLog op) { - return new LoggingIndexNode(node, op, index); - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/DeleteChildAtIndex.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index; - -import fj.data.List; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.DeleteChildAt; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; - -public class DeleteChildAtIndex extends DeleteChildAt{ - - private TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index; - - public DeleteChildAtIndex(int _pos, TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) { - super(_pos); - this.index = index; - } - - @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); - return _edit(logNode); - } - - @Override - public Logging wrap(TreeNode node) { - return new LoggingIndexNode(node, index); - } - - @Override - public Logging wrap(TreeNode node, OperationLog op) { - return new LoggingIndexNode(node, op, index); - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/Logging.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index; - -import fj.data.List; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingAttributes; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingChildren; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; - -public interface Logging { - - public LoggingAttributes getAttributes(); - public LoggingChildren getChildren(); - public OperationLog getOperationLog(); - public TreeNode getWrap(); - public TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> getIndex(); -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexAttributes.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index; - -import java.nio.ByteBuffer; - -import fj.Ord; -import fj.data.List; -import fj.data.Option; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingAttributes; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteAttributeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; - -public class LoggingIndexAttributes extends LoggingAttributes { - - private final TreeNode wrap; - private final OperationLog log; - private TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index; - - public LoggingIndexAttributes(TreeNode _wrap, OperationLog _log,TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) { - super(_wrap, _log); - this.wrap = _wrap; - this.log = _log; - this.index = index; - } - - private Either<Error,Logging> edit(NodeOperation _op) - { - Either<Error,TreeNode> either = _op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newNode = either.b(); - OperationLog newLog = log.add(_op); - Logging newLogNode = new LoggingNode(newNode,newLog); - - return DefaultEither.newB(newLogNode); - } - - public Either<Error,Logging> delete(final String key) - { - DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(key); - Either<Error, Logging> either = edit(deleteAttribute); - - if(either.isA()) - return either; - - Logging logNode = either.b(); - TreeNode node = logNode.getWrap(); - OperationLog log = logNode.getOperationLog(); - index = index.delete(key); - Logging logIndexNode = new LoggingIndexNode(node, log, index); - return DefaultEither.newB(logIndexNode); - } - - public Either<Error,Logging> put(final String key,final ByteBuffer value) - {return null; - /* PutAttributeOperation putAttribute = new PutAttributeOperation(key,value); - Either<Error, Logging> either = edit(putAttribute); - if(either.isA()) - return either; - - Logging logNode = either.b(); - TreeNode newNode = logNode.getWrap(); - OperationLog newLog = logNode.getOperationLog(); - - - - TreeMap<String, List<TreeNode>> list = TreeMap.empty(Ord.stringOrd); - - - - Option<TreeMap<String, List<TreeNode>>> opAttributeIndex = index.get(key); - String indexKey = new String(value.array()); - if (opAttributeIndex.isNone()) { - TreeMap<String, TreeNode> newNodeindex = TreeMap.empty(Ord.stringOrd); - - - } else { - Option<TreeNode> oplist = opAttributeIndex.some().get(indexKey); - list = list.cons(opAttributeIndex.some()); - list = list.cons(newNode); - } - - - if (opList.isNone()) { - list = list.set(,newNode); - } else { - list = opList.some(); - list = list.cons(newNode); - } - TreeMap<String,List<TreeNode>> newIndex = index.set(indexKey,list); - Logging logIndexNode = new LoggingIndexNode(newNode, newLog, newIndex); - return DefaultEither.newB(logIndexNode);*/ - } -} \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexNode.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index; - -import fj.data.List; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultOperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingAttributes; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingChildren; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; - -public class LoggingIndexNode extends LoggingNode { - - - private final TreeNode wrap; - private final OperationLog log; - private TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index; - - public LoggingIndexNode(TreeNode wrap ,TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) - { - this(wrap,new DefaultOperationLog(),index); - } - - public LoggingIndexNode(TreeNode wrap,OperationLog log, TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) - { - super(wrap, log); - this.wrap = wrap; - this.log = log; - this.index = index; - } - - @Override - public TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> getIndex(){ - return index; - } - - @Override - public LoggingAttributes getAttributes() - { - return new LoggingIndexAttributes(wrap,log,index); - } - - @Override - public LoggingChildren getChildren() - { - return new LoggingChildren(wrap,log); - } - - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/PutAttributeIndex.java Thu Sep 18 13:34:30 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index; - -import java.nio.ByteBuffer; - -import fj.data.List; -import fj.data.Option; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; - -public class PutAttributeIndex extends PutAttribute { - - private TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index; - - public PutAttributeIndex(String _key,ByteBuffer _value, TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) - { - super(_key, _value); - this.index = index; - } - - @Override - public Either<Error, Logging> edit(TreeNode _e) { - Logging logNode = wrap(_e); - return _edit(logNode); - } - - @Override - public Logging wrap(TreeNode node) { - return new LoggingIndexNode(node, index); - } - - @Override - public Logging wrap(TreeNode node, OperationLog op) { - return new LoggingIndexNode(node, op, index); - } - - @Override - public TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> getIndex(){ - return index; - } -}
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Tue Sep 30 13:15:22 2014 +0900 @@ -5,6 +5,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.AppendChildAt; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.tests.util.TestUtil; @@ -14,7 +15,6 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.Traversal; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; import junit.framework.Assert; import junit.framework.TestCase; @@ -42,7 +42,7 @@ for(DefaultNodePath part : path.inits()){ ByteBuffer value = ByteBuffer.wrap(part.toString().getBytes()); PutAttribute putAttribute = new PutAttribute(key,value); - Either<Error,Logging> either = currentEditor.edit(currentRoot,part,putAttribute); + Either<Error,LoggingNode> either = currentEditor.edit(currentRoot,part,putAttribute); if(either.isA()){ Assert.fail(); } @@ -83,7 +83,7 @@ DefaultTreeNode node = new DefaultTreeNode(); DefaultNodePath path = new DefaultNodePath(); - Either<Error,Logging> either = instance.edit(node,path,new AppendChildAt(0)); + Either<Error,LoggingNode> either = instance.edit(node,path,new AppendChildAt(0)); if(either.isA()){ Assert.fail(); }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/AppendChildAtTest.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/AppendChildAtTest.java Tue Sep 30 13:15:22 2014 +0900 @@ -2,11 +2,11 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.AppendChildAt; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; import junit.framework.Assert; import junit.framework.TestCase; @@ -16,12 +16,12 @@ { TreeNode node = new DefaultTreeNode(); AppendChildAt op = new AppendChildAt(0); - Either<Error, Logging> either = op.edit(node); + Either<Error, LoggingNode> either = op.edit(node); if(either.isA()){ Assert.fail(); } - Logging newNode = either.b(); + LoggingNode newNode = either.b(); Assert.assertEquals(1,newNode.getChildren().size()); } }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/DeleteAttributeAtTest.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/DeleteAttributeAtTest.java Tue Sep 30 13:15:22 2014 +0900 @@ -3,11 +3,11 @@ import java.nio.ByteBuffer; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.DeleteAttribute; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; import junit.framework.Assert; import junit.framework.TestCase; @@ -26,11 +26,11 @@ node = either.b(); DeleteAttribute op = new DeleteAttribute(key); - Either<Error,Logging> either2 = op.edit(node); + Either<Error,LoggingNode> either2 = op.edit(node); if(either2.isA()){ Assert.fail(); } - Logging newNode = either2.b(); + LoggingNode newNode = either2.b(); ByteBuffer ret = newNode.getAttributes().get(key); Assert.assertNull(ret); }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/DeleteChildAtTest.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/DeleteChildAtTest.java Tue Sep 30 13:15:22 2014 +0900 @@ -1,11 +1,11 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.nodeeditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.DeleteChildAt; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; import junit.framework.Assert; import junit.framework.TestCase; @@ -22,11 +22,11 @@ Assert.assertEquals(1,node.getChildren().size()); DeleteChildAt op = new DeleteChildAt(0); - Either<Error,Logging> either2 = op.edit(node); + Either<Error,LoggingNode> either2 = op.edit(node); if(either2.isA()){ Assert.fail(); } - Logging logNode = either2.b(); + LoggingNode logNode = either2.b(); Assert.assertEquals(0,logNode.getChildren().size()); }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/PutAttributeTest.java Thu Sep 18 13:34:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/nodeeditor/PutAttributeTest.java Tue Sep 30 13:15:22 2014 +0900 @@ -5,11 +5,11 @@ import org.junit.Assert; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; import junit.framework.TestCase; public class PutAttributeTest extends TestCase @@ -21,12 +21,12 @@ TreeNode node = new DefaultTreeNode(); PutAttribute op = new PutAttribute(key,value); //EditableNodeWrapper<DefaultTreeNode> wrapper = new EditableNodeWrapper<DefaultTreeNode>(node); - Either<Error, Logging> either = op.edit(node); + Either<Error, LoggingNode> either = op.edit(node); if(either.isA()){ Assert.fail(); } - Logging newNode = either.b(); + LoggingNode newNode = either.b(); ByteBuffer ret = newNode.getAttributes().get(key); Assert.assertEquals(0,ret.compareTo(value)); }