comparison src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/PutIndexEditor.java @ 145:72f454eb04ec

add parentIndex
author one
date Fri, 21 Nov 2014 08:11:24 +0900
parents 99bda30ea72c
children
comparison
equal deleted inserted replaced
142:ef183969bf31 145:72f454eb04ec
6 import fj.data.List; 6 import fj.data.List;
7 import fj.data.Option; 7 import fj.data.Option;
8 import fj.data.TreeMap; 8 import fj.data.TreeMap;
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; 9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath;
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.TreeEditor; 10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.TreeEditor;
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.IndexTreeEditor;
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; 12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode;
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.TreeOperationLog; 13 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.TreeOperationLog;
13 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.IndexJungleTreeEditor; 14 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.IndexJungleTreeEditor;
14 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.TransactionManager; 15 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.TransactionManager;
15 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; 16 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither;
34 this.attribute = new String(attribute.array()); 35 this.attribute = new String(attribute.array());
35 this.path = path; 36 this.path = path;
36 } 37 }
37 38
38 @Override 39 @Override
39 public Either<Error, IndexJungleTreeEditor> edit(TreeNode root,TransactionManager txManager,TreeEditor editor,TreeOperationLog log,TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index) { 40 public Either<Error, IndexJungleTreeEditor>edit(TreeNode root,TransactionManager txManager, IndexTreeEditor editor,TreeOperationLog log,TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index, TreeMap<TreeNode,TreeNode> parentIndex) {
40 NodePath newPath = path.pop().right(); 41 NodePath newPath = path.pop().right();
41 TreeNode target = getTarget(root, newPath); 42 TreeNode target = getTarget(root, newPath);
42 TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> newIndex = editIndex(target, path, key, attribute,index); 43 TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> newIndex = editIndex(target, path, key, attribute,index);
43 IndexJungleTreeEditor newEditor = new IndexJungleTreeEditor(root,txManager,editor,log, newIndex); 44 IndexJungleTreeEditor newEditor = new IndexJungleTreeEditor(root,txManager,editor,log, newIndex, parentIndex);
44 Either<Error, IndexJungleTreeEditor> either = DefaultEither.newB(newEditor); 45 Either<Error, IndexJungleTreeEditor> either = DefaultEither.newB(newEditor);
45 return either; 46 return either;
46 } 47 }
47 48
48 public TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> editIndex(TreeNode target, NodePath path, String key, String attribute,TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index){ 49 public TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> editIndex(TreeNode target, NodePath path, String key, String attribute,TreeMap<String, TreeMap<String, List<Pair<TreeNode, NodePath>>>> index){