Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 104:3d88bad21bc4
refactoring 9-11
author | one |
---|---|
date | Thu, 11 Sep 2014 18:02:26 +0900 |
parents | c297f0015d9e |
children | 3e75124550e9 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/InterfaceTraverser.java src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/query/PathNodeIterator.java src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/BruteForceTraverserTest.java src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/DefaultTraverserTest.java |
diffstat | 4 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/InterfaceTraverser.java Thu Sep 11 16:38:26 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/InterfaceTraverser.java Thu Sep 11 18:02:26 2014 +0900 @@ -60,7 +60,8 @@ * public List<Pair<NodePath,TreeNode>> distinct(String _key ,String... * _attribute){ return null; } */ - public JungleTreeEditor update(final UpdateQuery query) { + + public JungleTreeEditor update(UpdateQuery query) { Iterator<Pair<TreeNode, NodePath>> findNode = find(query); //do { for (; findNode.hasNext();) {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/query/PathNodeIterator.java Thu Sep 11 16:38:26 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/query/PathNodeIterator.java Thu Sep 11 18:02:26 2014 +0900 @@ -35,7 +35,7 @@ public Pair<TreeNode, NodePath> next() { TreeNode now = node; NodePath currentPath = path; - if (node.getChildren().size() > 0) { + if (node.getChildren().size() > 0) { // nodeStack.push(node); path = path.add(0); children = node.getChildren();
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/BruteForceTraverserTest.java Thu Sep 11 16:38:26 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/BruteForceTraverserTest.java Thu Sep 11 18:02:26 2014 +0900 @@ -42,10 +42,6 @@ Pair<TreeNode, NodePath> test = null; TreeNode root = createTree(0,0,maxHeight,new DefaultNodePath()); InterfaceTraverser traverser = instance(root); - Iterator<Pair<TreeNode, NodePath>> itNode = traverser.find(new SearchQuery("KEY","<-1,0,0>")); - for(;itNode.hasNext(); ){ - test = itNode.next(); - } JungleTreeEditor editor = traverser.update(new UpdateQuery("KEY", "<-1,0,0>", "tatsuki")); traverser.set(editor.getRoot()); Iterator<Pair<TreeNode, NodePath>> checkNode = traverser.find(new SearchQuery("KEY","tatsuki"));
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/DefaultTraverserTest.java Thu Sep 11 16:38:26 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/DefaultTraverserTest.java Thu Sep 11 18:02:26 2014 +0900 @@ -1,8 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverse; -import java.util.Iterator; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; +import fj.data.TreeMap; 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.transaction.DefaultJungleTreeEditor; @@ -41,7 +40,11 @@ @Override public InterfaceTraverser instance(TreeNode root) { - return new InterfaceTraverser(root, new Pair(null,null),new DefaultJungleTreeEditor(root,null,new DefaultTreeEditor(new DefaultTraverser()),null)); + Pair<TreeMap<String, TreeNode>, TreeMap<String, String>> index = new Pair<TreeMap<String, TreeNode>, TreeMap<String, String>>(null,null); + DefaultTraverser traverser = new DefaultTraverser(); + DefaultTreeEditor treeEditor = new DefaultTreeEditor(traverser); + DefaultJungleTreeEditor editor = new DefaultJungleTreeEditor(root,null,treeEditor,null); + return new InterfaceTraverser(root,index,editor); } }