Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 100:9a7b7af838e0
add index TreeNodeEditor
but node use
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungle.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungle.java Thu Sep 11 03:10:03 2014 +0900 @@ -3,7 +3,9 @@ import java.util.Iterator; import java.util.concurrent.ConcurrentHashMap; +import fj.Ord; import fj.data.List; +import fj.data.TreeMap; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.Journal; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.NullJournal; @@ -11,6 +13,7 @@ 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; +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.transaction.DefaultChangeSet; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeContext; @@ -18,6 +21,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 { @@ -77,9 +81,11 @@ }; DefaultTreeNode root = new DefaultTreeNode(); - ChangeSet set = new DefaultChangeSet(root,null,list,uuid,_name,0); + ChangeSet set = new DefaultChangeSet(root,null,list,uuid,_name,0,null); DefaultTreeContext tc = new DefaultTreeContext(root,set); - JungleTree newTree = new DefaultJungleTree(tc,uuid,journal.getWriter(),editor); + TreeMap<String, String> attributeIndex = TreeMap.empty(Ord.stringOrd); + TreeMap<String,TreeNode> nodeIndex = TreeMap.empty(Ord.stringOrd); + JungleTree newTree = new DefaultJungleTree(tc,uuid,journal.getWriter(),editor , new Pair<TreeMap<String,TreeNode>,TreeMap<String,String>>(nodeIndex, attributeIndex)); if(trees.putIfAbsent(_name,newTree) != null){ return null; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Thu Sep 11 03:10:03 2014 +0900 @@ -1,5 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle; +import fj.data.HashMap; +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.TreeEditor; @@ -8,6 +10,8 @@ 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.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 @@ -16,13 +20,14 @@ private final String uuid; private final ChangeListWriter writer; private final TreeEditor editor; - - public DefaultJungleTree(TreeContext _tc,String _uuid,ChangeListWriter _writer,TreeEditor _editor) + Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> index; + public DefaultJungleTree(TreeContext _tc,String _uuid,ChangeListWriter _writer,TreeEditor _editor, Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> index) { - repository = new AtomicReservableReference<TreeContext>(_tc); - uuid = _uuid; - writer = _writer; - editor = _editor; + this.repository = new AtomicReservableReference<TreeContext>(_tc); + this.uuid = _uuid; + this.writer = _writer; + this.editor = _editor; + this.index = index; } @Override @@ -31,7 +36,7 @@ TreeContext tc = repository.get(); DefaultTransactionManager txManager = new DefaultTransactionManager(writer,tc,repository,uuid); TreeNode root = tc.getTreeNode(); - return new DefaultJungleTreeEditor(root,txManager,editor); + return new DefaultJungleTreeEditor(root,txManager,editor, index); } @Override @@ -47,4 +52,9 @@ ChangeSet cs = tc.getChangeSet(); return cs.getRoot(); } + + @Override + public InterfaceTraverser getTraverser() { + return new InterfaceTraverser(getRootNode()); + } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/JungleTree.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/JungleTree.java Thu Sep 11 03:10:03 2014 +0900 @@ -2,10 +2,12 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.InterfaceTraverser; public interface JungleTree { public JungleTreeEditor getTreeEditor(); + public InterfaceTraverser getTraverser(); public JungleTreeEditor getLocalTreeEditor(); public TreeNode getRootNode(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/ChangeSet.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/ChangeSet.java Thu Sep 11 03:10:03 2014 +0900 @@ -1,9 +1,11 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store; +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.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 { @@ -15,5 +17,6 @@ public String getTreeName(); public long revision(); + public Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> getIndex(); public Iterable<TreeOperation> getOperations(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/TreeEditor.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/TreeEditor.java Thu Sep 11 03:10:03 2014 +0900 @@ -1,10 +1,12 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store; +import fj.data.TreeMap; 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.shoshi.jungle.util.Pair; public interface TreeEditor {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Thu Sep 11 03:10:03 2014 +0900 @@ -1,11 +1,11 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer; +import fj.data.TreeMap; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNodeChildren; 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.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 NodeEditor {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultChangeSet.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultChangeSet.java Thu Sep 11 03:10:03 2014 +0900 @@ -1,9 +1,11 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction; +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.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 { @@ -12,46 +14,48 @@ private final ChangeList changeList; private final String uuid; private final String treeName; - private final long revision; + private final long revision; + private final Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> index; - public DefaultChangeSet(TreeNode _node,ChangeSet _prev,ChangeList _log,String _uuid, String _treeName, long _revision) + public DefaultChangeSet(TreeNode _node,ChangeSet _prev,ChangeList _log,String _uuid, String _treeName, long _revision, Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> index) { - root = _node; - previous = _prev; - changeList = _log; - uuid = _uuid; - treeName = _treeName; - revision = _revision; + this.root = _node; + this.previous = _prev; + this.changeList = _log; + this.uuid = _uuid; + this.treeName = _treeName; + this.revision = _revision; + this.index = index; } @Override public TreeNode getRoot() { - return root; + return this.root; } @Override public ChangeSet prev() { - return previous; + return this.previous; } @Override public ChangeList getChangeList() { - return changeList; + return this.changeList; } @Override public String uuid() { - return uuid; + return this.uuid; } @Override public String getTreeName() { - return treeName; + return this.treeName; } @Override @@ -66,4 +70,9 @@ return changeList; } + @Override + public Pair<TreeMap<String, TreeNode>, TreeMap<String, String>> getIndex() { + return index; + } + }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Thu Sep 11 03:10:03 2014 +0900 @@ -2,6 +2,7 @@ import java.nio.ByteBuffer; +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; @@ -22,6 +23,7 @@ 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; public class DefaultJungleTreeEditor implements JungleTreeEditor { @@ -29,18 +31,20 @@ private final TreeNode root; private final TreeEditor editor; private final TreeOperationLog log; - - public DefaultJungleTreeEditor(TreeNode _root,TransactionManager _txManager,TreeEditor _editor) + private Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> index; + + public DefaultJungleTreeEditor(TreeNode _root,TransactionManager _txManager,TreeEditor _editor, Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> index) { - this(_root,_txManager,_editor,new DefaultTreeOperationLog()); + this(_root,_txManager,_editor,new DefaultTreeOperationLog(), index); } - public DefaultJungleTreeEditor(TreeNode newNode,TransactionManager _txManager,TreeEditor _editor,TreeOperationLog _log) + public DefaultJungleTreeEditor(TreeNode newNode,TransactionManager _txManager,TreeEditor _editor,TreeOperationLog _log, Pair<TreeMap<String,TreeNode>,TreeMap<String,String>> index) { - root = newNode; - txManager = _txManager; - editor = _editor; - log = _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) @@ -66,7 +70,7 @@ DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); TreeOperationLog newTreeOpLog = log.append(treeOperationLog); - JungleTreeEditor newEditor = new DefaultJungleTreeEditor(newNode,txManager,editor,newTreeOpLog); + JungleTreeEditor newEditor = new DefaultJungleTreeEditor(newNode,txManager,editor,newTreeOpLog, index); return DefaultEither.newB(newEditor); } @@ -113,7 +117,7 @@ } TransactionManager newTxManager = either.b(); - JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(root,newTxManager,editor); + JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(root,newTxManager,editor, index); return DefaultEither.newB(newTreeEditor); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTransactionManager.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTransactionManager.java Thu Sep 11 03:10:03 2014 +0900 @@ -53,7 +53,7 @@ } }; - DefaultChangeSet newCs = new DefaultChangeSet(_newRoot,cs,list,uuid, _treeName, nextRevision); + DefaultChangeSet newCs = new DefaultChangeSet(_newRoot,cs,list,uuid, _treeName, nextRevision,null); DefaultTreeContext newContext = new DefaultTreeContext(_newRoot,newCs); @SuppressWarnings("rawtypes")
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/BruteForceTraverser.java Wed Sep 10 18:54:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser; - -import java.util.Iterator; - -import fj.data.List; -import fj.data.TreeMap; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; -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.query.PathNodeIterator; -import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.query.Query; - -public class BruteForceTraverser { - BruteForceTraverser traverser; - TreeNode node; - TreeMap<String,TreeNode> nodeIndex; - TreeMap<String,String> attributeIndex; - - public BruteForceTraverser(TreeNode _root) { - node = _root; - //pathNodes = this.traverse(_root,new DefaultNodePath(),-1); - } - - public BruteForceTraverser getTraverser(JungleTree tree) { - return new BruteForceTraverser(tree.getRootNode()); - } - - - /*public IteratorPathNode traverse(TreeNode _node ,NodePath _path ,int _pos){ - - Children children = _node.getChildren(); - Either<Error,TreeNode> either = children.at(0); - IteratorPathNode list = new IteratorPathNodeImpl(); - int pathCount = _pos; - if(children.size() == 0){ - list = list.add(new Pair<TreeNode, NodePath>(node, _path.add(_pos))); - return list; - } - - for(TreeNode child : children){ - list = list.append(traverse(child,_path,pathCount)); - pathCount++; - } - - list = list.add(new Pair<TreeNode,NodePath>(_node, _path.add(_pos))); - return list; - } - - public int count(Query _query, String _key, String _attribute){ - return this.find(_query,_key,_attribute); - } - - public List<Pair<NodePath,TreeNode>> distinct(String _key ,String... _attribute){ - return null; - } - */ - public Iterator<Pair<TreeNode, NodePath>> find(final Query query) { - final PathNodeIterator itNode = new PathNodeIterator(node); - - return new Iterator<Pair<TreeNode, NodePath>>() { - - private Pair<TreeNode,NodePath> matchPair = nextmatch(itNode); - - private Pair<TreeNode, NodePath> nextmatch(PathNodeIterator itNode) { - for (;itNode.hasNext();) { - Pair<TreeNode, NodePath> pathNode = itNode.next(); - if (query.condition(pathNode.left())) - return pathNode; - } - return null; - } - - @Override - public boolean hasNext() { - // TODO Auto-generated method stub - return matchPair != null; - } - - @Override - public Pair<TreeNode, NodePath> next() { - Pair<TreeNode,NodePath> currentPair = matchPair; - matchPair = nextmatch(itNode); - return currentPair; - } - - @Override - public void remove() { - // TODO Auto-generated method stub - - } - - }; - - } - - -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/InterfaceTraverser.java Thu Sep 11 03:10:03 2014 +0900 @@ -0,0 +1,97 @@ +package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser; + +import java.util.Iterator; + +import fj.data.List; +import fj.data.TreeMap; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; +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.query.PathNodeIterator; +import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.query.Query; + +public class InterfaceTraverser { + InterfaceTraverser traverser; + TreeNode node; + TreeMap<String,TreeNode> nodeIndex; + TreeMap<String,String> attributeIndex; + + public InterfaceTraverser(TreeNode _root) { + node = _root; + //pathNodes = this.traverse(_root,new DefaultNodePath(),-1); + } + + public InterfaceTraverser getTraverser(JungleTree tree) { + return new InterfaceTraverser(tree.getRootNode()); + } + + + /*public IteratorPathNode traverse(TreeNode _node ,NodePath _path ,int _pos){ + + Children children = _node.getChildren(); + Either<Error,TreeNode> either = children.at(0); + IteratorPathNode list = new IteratorPathNodeImpl(); + int pathCount = _pos; + if(children.size() == 0){ + list = list.add(new Pair<TreeNode, NodePath>(node, _path.add(_pos))); + return list; + } + + for(TreeNode child : children){ + list = list.append(traverse(child,_path,pathCount)); + pathCount++; + } + + list = list.add(new Pair<TreeNode,NodePath>(_node, _path.add(_pos))); + return list; + } + + public int count(Query _query, String _key, String _attribute){ + return this.find(_query,_key,_attribute); + } + + public List<Pair<NodePath,TreeNode>> distinct(String _key ,String... _attribute){ + return null; + } + */ + public Iterator<Pair<TreeNode, NodePath>> find(final Query query) { + final PathNodeIterator itNode = new PathNodeIterator(node); + + return new Iterator<Pair<TreeNode, NodePath>>() { + + private Pair<TreeNode,NodePath> matchPair = nextmatch(itNode); + + private Pair<TreeNode, NodePath> nextmatch(PathNodeIterator itNode) { + for (;itNode.hasNext();) { + Pair<TreeNode, NodePath> pathNode = itNode.next(); + if (query.condition(pathNode.left())) + return pathNode; + } + return null; + } + + @Override + public boolean hasNext() { + return matchPair != null; + } + + @Override + public Pair<TreeNode, NodePath> next() { + Pair<TreeNode,NodePath> currentPair = matchPair; + matchPair = nextmatch(itNode); + return currentPair; + } + + @Override + public void remove() { + // TODO Auto-generated method stub + + } + + }; + + } + + +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/CompareNode.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/CompareNode.java Thu Sep 11 03:10:03 2014 +0900 @@ -1,4 +1,4 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.test; +/*package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.test; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; import fj.data.HashMap; @@ -26,4 +26,4 @@ } return muchNodes; } -} +}*/
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/BruteForceTraverserTest.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/BruteForceTraverserTest.java Thu Sep 11 03:10:03 2014 +0900 @@ -7,7 +7,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.BruteForceTraverser; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.InterfaceTraverser; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultEvaluator; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.Direction; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.Traversal; @@ -25,14 +25,14 @@ import fj.data.List; public abstract class BruteForceTraverserTest extends TestCase{ - public abstract BruteForceTraverser instance(TreeNode node); + public abstract InterfaceTraverser instance(TreeNode node); @Test public void test1() { int maxHeight = 3; Pair<TreeNode, NodePath> test = null; TreeNode root = createTree(0,0,maxHeight,new DefaultNodePath()); - BruteForceTraverser traverser = instance(root); + InterfaceTraverser traverser = instance(root); Iterator<Pair<TreeNode, NodePath>> itNode = traverser.find(new SearchQuery("KEY","<-1>")); for(;itNode.hasNext(); ){ test = itNode.next();
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/DefaultTraverserTest.java Wed Sep 10 18:54:52 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/DefaultTraverserTest.java Thu Sep 11 03:10:03 2014 +0900 @@ -4,7 +4,7 @@ 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.BruteForceTraverser; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.InterfaceTraverser; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.Traverser; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; @@ -37,9 +37,9 @@ { @Override - public BruteForceTraverser instance(TreeNode root) + public InterfaceTraverser instance(TreeNode root) { - return new BruteForceTraverser(root); + return new InterfaceTraverser(root); } }