Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 110:cf17350a2415
traverse find args change Query
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungle.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungle.java Sat Sep 13 19:23:31 2014 +0900 @@ -10,6 +10,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.Journal; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.NullJournal; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; +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.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor; @@ -21,6 +22,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultTraverser; 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 DefaultJungle implements Jungle {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Sat Sep 13 19:23:31 2014 +0900 @@ -4,6 +4,7 @@ import fj.data.TreeMap; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListWriter; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; +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.transaction.AtomicReservableReference; @@ -12,6 +13,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTransactionManager; 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; public class DefaultJungleTree implements JungleTree
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/JungleTree.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/JungleTree.java Sat Sep 13 19:23:31 2014 +0900 @@ -3,8 +3,10 @@ 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.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; public interface JungleTree {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/ChangeSet.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/ChangeSet.java Sat Sep 13 19:23:31 2014 +0900 @@ -6,6 +6,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; public interface ChangeSet {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNode.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNode.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,7 +2,9 @@ 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.util.Pair; import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,6 +2,7 @@ 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.LoggingNode; @@ -11,6 +12,7 @@ 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; import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class AppendChildAt implements NodeEditor @@ -48,7 +50,7 @@ } @Override - public TreeMap<String,TreeMap<String, List<TreeNode>>> getIndex() { + public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex() { // TODO Auto-generated method stub return null; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,12 +2,14 @@ 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.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; 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; import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class DeleteAttribute implements NodeEditor @@ -44,7 +46,7 @@ } @Override - public TreeMap<String,TreeMap<String, List<TreeNode>>> getIndex() { + public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex() { // TODO Auto-generated method stub return null; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,6 +2,7 @@ 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.LoggingNode; @@ -11,6 +12,7 @@ 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; import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class DeleteChildAt implements NodeEditor @@ -47,7 +49,7 @@ } @Override - public TreeMap<String,TreeMap<String, List<TreeNode>>> getIndex() { + public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex() { // TODO Auto-generated method stub return null; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,6 +2,7 @@ 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.LoggingNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/PutAttribute.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/PutAttribute.java Sat Sep 13 19:23:31 2014 +0900 @@ -4,6 +4,7 @@ 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.TreeNodeAttributes; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultOperationLog; @@ -15,6 +16,7 @@ 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; import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; public class PutAttribute implements NodeEditor @@ -54,7 +56,7 @@ } @Override - public TreeMap<String,TreeMap<String, List<TreeNode>>> getIndex() { + public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex() { // TODO Auto-generated method stub return null; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultChangeSet.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultChangeSet.java Sat Sep 13 19:23:31 2014 +0900 @@ -4,8 +4,10 @@ import fj.data.TreeMap; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; +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.operations.TreeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; public class DefaultChangeSet implements ChangeSet { @@ -16,6 +18,7 @@ private final String treeName; private final long revision; private final TreeMap<String,TreeMap<String, List<TreeNode>>> index; + public DefaultChangeSet(TreeNode _node,ChangeSet _prev,ChangeList _log,String _uuid, String _treeName, long _revision, TreeMap<String,TreeMap<String, List<TreeNode>>> index) { this.root = _node;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTransactionManager.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTransactionManager.java Sat Sep 13 19:23:31 2014 +0900 @@ -8,6 +8,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListWriter; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.Result; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; +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.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; @@ -16,6 +17,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultError; 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 DefaultTransactionManager implements TransactionManager {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/TransactionManager.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/TransactionManager.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,10 +2,12 @@ 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.TreeOperationLog; 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 interface TransactionManager {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/InterfaceTraverser.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/InterfaceTraverser.java Sat Sep 13 19:23:31 2014 +0900 @@ -12,6 +12,7 @@ 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.query.PathNodeIterator; +import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.query.Query; import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.query.SearchQuery; import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.query.UpdateQuery; @@ -22,9 +23,9 @@ TreeMap<String,TreeMap<String, List<TreeNode>>> index; JungleTreeEditor editor; - public InterfaceTraverser(TreeNode _root, TreeMap<String,TreeMap<String, List<TreeNode>>> treeMap, JungleTreeEditor editor) { + public InterfaceTraverser(TreeNode _root, TreeMap<String,TreeMap<String, List<TreeNode>>> indez, JungleTreeEditor editor) { this.node = _root; - this.index = treeMap; + this.index = index; this.editor = editor; } @@ -58,8 +59,8 @@ * _attribute){ return null; } */ - public JungleTreeEditor update(final UpdateQuery query) { - Iterator<Pair<TreeNode, NodePath>> findNode = find(query); + public JungleTreeEditor update(final Query query) { + /*Iterator<Pair<TreeNode, NodePath>> findNode = find(query); //do { for (; findNode.hasNext();) { Either<Error, JungleTreeEditor> either = editor.putAttribute(findNode.next().right(), "KEY", query.getUpdateAttribute()); @@ -68,11 +69,11 @@ editor = either.b(); } //} while (editor.success().isA()); - +*/ return editor; } - public Iterator<Pair<TreeNode, NodePath>> find(final SearchQuery query) { + public Iterator<Pair<TreeNode, NodePath>> find(final Query query) { final PathNodeIterator itNode = new PathNodeIterator(node, query); return new Iterator<Pair<TreeNode, NodePath>>() {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/query/PathNodeIterator.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/query/PathNodeIterator.java Sat Sep 13 19:23:31 2014 +0900 @@ -25,7 +25,7 @@ * otherwise traverse tree and create index * * */ - public PathNodeIterator(TreeNode root, SearchQuery query) { + public PathNodeIterator(TreeNode root, Query query) { this.root = root; path = new DefaultNodePath(); node = root;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/AppendChildAtIndex.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/AppendChildAtIndex.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,7 +2,9 @@ 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;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/DeleteAttributeIndex.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/DeleteAttributeIndex.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,11 +2,13 @@ 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 {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/DeleteChildAtIndex.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/DeleteChildAtIndex.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,11 +2,13 @@ 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{
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/Logging.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/Logging.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,10 +2,12 @@ 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 {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexAttributes.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexAttributes.java Sat Sep 13 19:23:31 2014 +0900 @@ -6,6 +6,7 @@ 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; @@ -24,7 +25,7 @@ private final OperationLog log; private TreeMap<String,TreeMap<String, List<TreeNode>>> index; - public LoggingIndexAttributes(TreeNode _wrap, OperationLog _log, TreeMap<String,TreeMap<String, List<TreeNode>>> index) { + public LoggingIndexAttributes(TreeNode _wrap, OperationLog _log,TreeMap<String,TreeMap<String, List<TreeNode>>> index) { super(_wrap, _log); this.wrap = _wrap; this.log = _log; @@ -47,7 +48,7 @@ public Either<Error,Logging> delete(final String key) { - /* DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(key); + DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(key); Either<Error, Logging> either = edit(deleteAttribute); if(either.isA()) @@ -58,12 +59,12 @@ OperationLog log = logNode.getOperationLog(); index = index.delete(key); Logging logIndexNode = new LoggingIndexNode(node, log, index); - return DefaultEither.newB(logIndexNode);*/return null; + return DefaultEither.newB(logIndexNode); } public Either<Error,Logging> put(final String key,final ByteBuffer value) - { - /*PutAttributeOperation putAttribute = new PutAttributeOperation(key,value); + {return null; + /* PutAttributeOperation putAttribute = new PutAttributeOperation(key,value); Either<Error, Logging> either = edit(putAttribute); if(either.isA()) return either; @@ -71,16 +72,22 @@ Logging logNode = either.b(); TreeNode newNode = logNode.getWrap(); OperationLog newLog = logNode.getOperationLog(); - Option<TreeMap<String, TreeNode>> opAttributeIndex = index.get(key); - String indexKey = new String(value.array()); - TreeMap<String, TreeNode> list = TreeMap.empty(Ord.stringOrd); + + + 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> newAttributeindex = TreeMap.empty(Ord.stringOrd); - list = list.set(indexKey,newNode); + TreeMap<String, TreeNode> newNodeindex = TreeMap.empty(Ord.stringOrd); + + } else { Option<TreeNode> oplist = opAttributeIndex.some().get(indexKey); - list = opAttributeIndex.some(); + list = list.cons(opAttributeIndex.some()); list = list.cons(newNode); } @@ -94,6 +101,5 @@ TreeMap<String,List<TreeNode>> newIndex = index.set(indexKey,list); Logging logIndexNode = new LoggingIndexNode(newNode, newLog, newIndex); return DefaultEither.newB(logIndexNode);*/ - return null; } } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexNode.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexNode.java Sat Sep 13 19:23:31 2014 +0900 @@ -2,6 +2,7 @@ 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;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/PutAttributeIndex.java Fri Sep 12 21:57:35 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/PutAttributeIndex.java Sat Sep 13 19:23:31 2014 +0900 @@ -5,6 +5,7 @@ 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; @@ -12,6 +13,7 @@ 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 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/test.java Sat Sep 13 19:23:31 2014 +0900 @@ -0,0 +1,19 @@ + +import fj.*; +import fj.data.List; + +public class test { + public static void main(String _args[]) { + List<Integer> test = List.nil(); + test = test.snoc(0); + test = test.snoc(1); + test = test.snoc(2); + test = test.snoc(3); + test = test.snoc(4); + test.reverse(); + P2<List<Integer>,List<Integer>> split = test.splitAt(3); + test = split._1(); + test = test.tail(); + System.out.println("www"); + } +}