Mercurial > hg > Members > tatsuki > bench > jungle-core
changeset 79:b4f145174970
change log
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNodeHook.java Sun Aug 31 00:44:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNodeHook.java Sun Aug 31 02:10:14 2014 +0900 @@ -25,7 +25,7 @@ if(either.isA()){ return DefaultEither.newA(either.a()); } - + log = editor.getLog(); T newLoggingNode = either.b(); //T newNode = newLoggingNode.getWrap(); //log = newLoggingNode.getOperationLog();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Sun Aug 31 00:44:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Sun Aug 31 02:10:14 2014 +0900 @@ -1,6 +1,10 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer; 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.operations.AppendChildAtOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; 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; @@ -25,4 +29,12 @@ return DefaultEither.newB(either.b()); } + + @Override + public OperationLog getLog() { + OperationLog op = new DefaultOperationLog(); + NodeOperation addNewChildAt = new AppendChildAtOperation(pos); + op = op.add(addNewChildAt); + return op; + } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Sun Aug 31 00:44:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Sun Aug 31 02:10:14 2014 +0900 @@ -1,6 +1,9 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer; 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.operations.DeleteAttributeOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; @@ -18,4 +21,11 @@ { return _e.getAttributes().delete(key); } + + @Override + public OperationLog getLog() { + OperationLog op = new DefaultOperationLog(); + DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(key); + return op.add(deleteAttribute); + } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Sun Aug 31 00:44:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Sun Aug 31 02:10:14 2014 +0900 @@ -1,6 +1,10 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer; 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.operations.DeleteChildAtOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; @@ -18,4 +22,11 @@ { return _e.getChildren().deleteChildAt(pos); } + + @Override + public OperationLog getLog() { + OperationLog op = new DefaultOperationLog(); + NodeOperation deleteChildAt = new DeleteChildAtOperation(pos); + return op.add(deleteChildAt); + } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Sun Aug 31 00:44:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Sun Aug 31 02:10:14 2014 +0900 @@ -1,10 +1,12 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer; 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.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; public interface NodeEditor { public <T extends TreeNode<T>> Either<Error,T> edit(T _e); + public OperationLog getLog(); } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/PutAttribute.java Sun Aug 31 00:44:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/PutAttribute.java Sun Aug 31 02:10:14 2014 +0900 @@ -4,6 +4,9 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNodeAttributes; +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.operations.PutAttributeOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; @@ -24,4 +27,11 @@ TreeNodeAttributes<T> attrs = _e.getAttributes(); return attrs.put(key,value); } + + @Override + public OperationLog getLog() { + OperationLog op = new DefaultOperationLog(); + PutAttributeOperation putAttribute = new PutAttributeOperation(key,value); + return op.add(putAttribute); + } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Sun Aug 31 00:44:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Sun Aug 31 02:10:14 2014 +0900 @@ -54,7 +54,6 @@ T newNode = either.b(); OperationLog newLog = hook.getLog(); - //NodeOperation Log = new AppendChildAtOperation(3); IterableConverter.Converter<TreeOperation,NodeOperation> converter = new IterableConverter.Converter<TreeOperation,NodeOperation>(){ @Override @@ -63,9 +62,9 @@ } }; - //Iterable<TreeOperation> iterable = new IterableConverter<TreeOperation,NodeOperation>(newLog,converter); - //DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); - //TreeOperationLog newTreeOpLog = log.append(treeOperationLog); + Iterable<TreeOperation> iterable = new IterableConverter<TreeOperation,NodeOperation>(newLog,converter); + DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); + TreeOperationLog newTreeOpLog = log.append(treeOperationLog); JungleTreeEditor newEditor = new DefaultJungleTreeEditor<T>(newNode,txManager,editor,new DefaultTreeOperationLog()); return DefaultEither.newB(newEditor);