Mercurial > hg > Members > tatsuki > bench > jungle-core
changeset 86:fb1dc448ac8c
delete <T extends TreeNode>
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungle.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungle.java Wed Sep 03 23:44:23 2014 +0900 @@ -78,8 +78,8 @@ DefaultTreeNode root = new DefaultTreeNode(); ChangeSet set = new DefaultChangeSet(root,null,list,uuid,_name,0); - DefaultTreeContext<DefaultTreeNode> tc = new DefaultTreeContext<DefaultTreeNode>(root,set); - JungleTree newTree = new DefaultJungleTree<DefaultTreeNode>(tc,uuid,journal.getWriter(),editor); + DefaultTreeContext tc = new DefaultTreeContext(root,set); + JungleTree newTree = new DefaultJungleTree(tc,uuid,journal.getWriter(),editor); if(trees.putIfAbsent(_name,newTree) != null){ return null; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/DefaultJungleTree.java Wed Sep 03 23:44:23 2014 +0900 @@ -10,16 +10,16 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.TreeContext; -public class DefaultJungleTree<T extends TreeNode> implements JungleTree +public class DefaultJungleTree implements JungleTree { - private final AtomicReservableReference<TreeContext<T>> repository; + private final AtomicReservableReference<TreeContext> repository; private final String uuid; private final ChangeListWriter writer; private final TreeEditor editor; - public DefaultJungleTree(TreeContext<T> _tc,String _uuid,ChangeListWriter _writer,TreeEditor _editor) + public DefaultJungleTree(TreeContext _tc,String _uuid,ChangeListWriter _writer,TreeEditor _editor) { - repository = new AtomicReservableReference<TreeContext<T>>(_tc); + repository = new AtomicReservableReference<TreeContext>(_tc); uuid = _uuid; writer = _writer; editor = _editor; @@ -28,10 +28,10 @@ @Override public JungleTreeEditor getTreeEditor() { - TreeContext<T> tc = repository.get(); - DefaultTransactionManager<T> txManager = new DefaultTransactionManager<T>(writer,tc,repository,uuid); + TreeContext tc = repository.get(); + DefaultTransactionManager txManager = new DefaultTransactionManager(writer,tc,repository,uuid); TreeNode root = tc.getTreeNode(); - return new DefaultJungleTreeEditor<T>(root,txManager,editor); + return new DefaultJungleTreeEditor(root,txManager,editor); } @Override @@ -43,7 +43,7 @@ @Override public TreeNode getRootNode() { - TreeContext<T> tc = repository.get(); + TreeContext tc = repository.get(); ChangeSet cs = tc.getChangeSet(); return cs.getRoot(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/Children.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/Children.java Wed Sep 03 23:44:23 2014 +0900 @@ -1,10 +1,11 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -public interface Children<T> extends Iterable<T> +public interface Children extends Iterable<TreeNode> { - public Either<Error,T> at(int _pos); + public Either<Error,TreeNode> at(int _pos); public int size(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/TreeEditor.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/TreeEditor.java Wed Sep 03 23:44:23 2014 +0900 @@ -7,5 +7,5 @@ public interface TreeEditor { - public <T extends TreeNode> Either<Error,TreeNode> edit(T _root,NodePath _path,NodeEditor _transformer); + public Either<Error,TreeNode> edit(TreeNode _root,NodePath _path,NodeEditor _transformer); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultTreeEditor.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultTreeEditor.java Wed Sep 03 23:44:23 2014 +0900 @@ -22,34 +22,34 @@ } @Override - public <T extends TreeNode> Either<Error,TreeNode> edit(T _root,NodePath _path,NodeEditor _editor) + public Either<Error,TreeNode> edit(TreeNode _root,NodePath _path,NodeEditor _editor) { DefaultEvaluator e = new DefaultEvaluator(_path); //TraversableNodeWrapper<T> wrap = new TraversableNodeWrapper<T>(_root); - Either<Error, Traversal<TreeNode>> either = traverser.traverse(_root,e); + Either<Error, Traversal> either = traverser.traverse(_root,e); if(either.isA()){ return DefaultEither.newA(either.a()); } - Traversal<TreeNode> t = either.b(); + Traversal t = either.b(); Either<Error,TreeNode> ret = clone(t,_editor); return ret; } - private <T extends TreeNode> Either<Error,TreeNode> clone(Traversal<T> _t,NodeEditor _editor) + private Either<Error,TreeNode> clone(Traversal _t,NodeEditor _editor) { // copying nodes from bottom to root - List<Direction<T>> path = List.nil(); - for(Direction<T> direction : _t){ + List<Direction<TreeNode>> path = List.nil(); + for(Direction<TreeNode> direction : _t){ path = path.cons(direction); } // target - Direction<T> targetDirection = path.head(); - T target = targetDirection.getTarget(); + Direction<TreeNode> targetDirection = path.head(); + TreeNode target = targetDirection.getTarget(); //EditableNodeWrapper<T> wrapper = new EditableNodeWrapper<T>(target); Either<Error,TreeNode> either = _editor.edit(target); if(either.isA()){ @@ -61,8 +61,8 @@ // top int pos = targetDirection.getPosition(); TreeNode child = newNode; - for(Direction<T> parentDirection : path.tail()){ - TreeNodeChildren<TreeNode> chs = parentDirection.getTarget().getChildren(); + for(Direction<TreeNode> parentDirection : path.tail()){ + TreeNodeChildren chs = parentDirection.getTarget().getChildren(); Either<Error,TreeNode> ret = chs.replaceNode(pos,child); if(ret.isA()){
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/TreeNode.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/TreeNode.java Wed Sep 03 23:44:23 2014 +0900 @@ -4,10 +4,10 @@ public interface TreeNode extends AttributesContainer { - public TreeNodeChildren<TreeNode> getChildren(); + public TreeNodeChildren getChildren(); @Override - public TreeNodeAttributes<TreeNode> getAttributes(); + public TreeNodeAttributes getAttributes(); public TreeNode createNewNode(); //public Node getAsNode();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/TreeNodeAttributes.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/TreeNodeAttributes.java Wed Sep 03 23:44:23 2014 +0900 @@ -7,7 +7,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -public interface TreeNodeAttributes<T extends TreeNode> extends Attributes +public interface TreeNodeAttributes extends Attributes { public Either<Error,TreeNode> delete(String _key); public Either<Error,TreeNode> put(String _key,ByteBuffer _value);
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/TreeNodeChildren.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/TreeNodeChildren.java Wed Sep 03 23:44:23 2014 +0900 @@ -5,11 +5,11 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -public interface TreeNodeChildren<T extends TreeNode> extends Children<T> +public interface TreeNodeChildren extends Children { public Either<Error,TreeNode> addNewChildAt(int _pos); public Either<Error,TreeNode> deleteChildAt(int _pos); - public Either<Error,TreeNode> addNewChildAt(int _pos,T _newChild); + public Either<Error,TreeNode> addNewChildAt(int _pos,TreeNode _newChild); public Either<Error,TreeNode> replaceNode(int _pos,TreeNode _replacement); public List<TreeNode> getChildrenAsRawList(); } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNodeHook.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNodeHook.java Wed Sep 03 23:44:23 2014 +0900 @@ -18,7 +18,7 @@ } @Override - public <T extends TreeNode> Either<Error,TreeNode> edit(T _e) + public Either<Error,TreeNode> edit(TreeNode _e) { //LoggingNode<T> loggingNode = new LoggingNode<T>(_e); Either<Error,TreeNode> either = editor.edit(_e);
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java Wed Sep 03 23:44:23 2014 +0900 @@ -19,7 +19,7 @@ } @Override - public <T extends TreeNode> Either<Error,TreeNode> edit(T _e) + public Either<Error,TreeNode> edit(TreeNode _e) { Either<Error,TreeNode> either = _e.getChildren().addNewChildAt(pos); if(either.isA()){
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteAttribute.java Wed Sep 03 23:44:23 2014 +0900 @@ -17,7 +17,7 @@ } @Override - public <T extends TreeNode> Either<Error,TreeNode> edit(T _e) + public Either<Error,TreeNode> edit(TreeNode _e) { return _e.getAttributes().delete(key); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/DeleteChildAt.java Wed Sep 03 23:44:23 2014 +0900 @@ -18,7 +18,7 @@ } @Override - public <T extends TreeNode> Either<Error,TreeNode> edit(T _e) + public Either<Error,TreeNode> edit(TreeNode _e) { return _e.getChildren().deleteChildAt(pos); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/NodeEditor.java Wed Sep 03 23:44:23 2014 +0900 @@ -7,6 +7,6 @@ public interface NodeEditor { - public <T extends TreeNode> Either<Error,TreeNode> edit(T _e); + public Either<Error,TreeNode> edit(TreeNode _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 Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/PutAttribute.java Wed Sep 03 23:44:23 2014 +0900 @@ -22,9 +22,9 @@ } @Override - public <T extends TreeNode> Either<Error,TreeNode> edit(T _e) + public Either<Error,TreeNode> edit(TreeNode _e) { - TreeNodeAttributes<TreeNode> attrs = _e.getAttributes(); + TreeNodeAttributes attrs = _e.getAttributes(); return attrs.put(key,value); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultJungleTreeEditor.java Wed Sep 03 23:44:23 2014 +0900 @@ -23,19 +23,19 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.IterableConverter; -public class DefaultJungleTreeEditor<T extends TreeNode> implements JungleTreeEditor +public class DefaultJungleTreeEditor implements JungleTreeEditor { - private final TransactionManager<T> txManager; + private final TransactionManager txManager; private final TreeNode root; private final TreeEditor editor; private final TreeOperationLog log; - public DefaultJungleTreeEditor(TreeNode _root,TransactionManager<T> _txManager,TreeEditor _editor) + public DefaultJungleTreeEditor(TreeNode _root,TransactionManager _txManager,TreeEditor _editor) { this(_root,_txManager,_editor,new DefaultTreeOperationLog()); } - public DefaultJungleTreeEditor(TreeNode newNode,TransactionManager<T> _txManager,TreeEditor _editor,TreeOperationLog _log) + public DefaultJungleTreeEditor(TreeNode newNode,TransactionManager _txManager,TreeEditor _editor,TreeOperationLog _log) { root = newNode; txManager = _txManager; @@ -65,7 +65,7 @@ DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); TreeOperationLog newTreeOpLog = log.append(treeOperationLog); - JungleTreeEditor newEditor = new DefaultJungleTreeEditor<T>(newNode,txManager,editor,newTreeOpLog); + JungleTreeEditor newEditor = new DefaultJungleTreeEditor(newNode,txManager,editor,newTreeOpLog); return DefaultEither.newB(newEditor); } @@ -106,13 +106,13 @@ @Override public Either<Error,JungleTreeEditor> success() { - Either<Error,TransactionManager<T>> either = txManager.commit(root,log); + Either<Error,TransactionManager> either = txManager.commit(root,log); if(either.isA()){ return DefaultEither.newA(either.a()); } - TransactionManager<T> newTxManager = either.b(); - JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor<T>(root,newTxManager,editor); + TransactionManager newTxManager = either.b(); + JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(root,newTxManager,editor); return DefaultEither.newB(newTreeEditor); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTransactionManager.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTransactionManager.java Wed Sep 03 23:44:23 2014 +0900 @@ -14,15 +14,15 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -public class DefaultTransactionManager<T extends TreeNode> implements TransactionManager<T> +public class DefaultTransactionManager implements TransactionManager { - private final AtomicReservableReference<TreeContext<T>> repository; - private final TreeContext<T> tip; + private final AtomicReservableReference<TreeContext> repository; + private final TreeContext tip; private final ChangeListWriter writer; private final String uuid; - public DefaultTransactionManager(ChangeListWriter _writer,TreeContext<T> _tip, - AtomicReservableReference<TreeContext<T>> _repository,String _uuid) + public DefaultTransactionManager(ChangeListWriter _writer,TreeContext _tip, + AtomicReservableReference<TreeContext> _repository,String _uuid) { repository = _repository; tip = _tip; @@ -31,7 +31,7 @@ } @Override - public Either<Error,TransactionManager<T>> commit(TreeNode _newRoot,final TreeOperationLog _log) + public Either<Error,TransactionManager> commit(TreeNode _newRoot,final TreeOperationLog _log) { ChangeSet cs = tip.getChangeSet(); long currentRevision = cs.revision(); @@ -54,7 +54,7 @@ }; DefaultChangeSet newCs = new DefaultChangeSet(_newRoot,cs,list,uuid, _treeName, nextRevision); - DefaultTreeContext<T> newContext = new DefaultTreeContext<T>(_newRoot,newCs); + DefaultTreeContext newContext = new DefaultTreeContext(_newRoot,newCs); @SuppressWarnings("rawtypes") Reservation reservation = repository.makeReservation(tip,newContext); @@ -64,7 +64,7 @@ Result r = writer.write(list); if(r == Result.SUCCESS){ reservation.confirm(); - TransactionManager<T> txManager = new DefaultTransactionManager<T>(writer,newContext,repository,uuid); + TransactionManager txManager = new DefaultTransactionManager(writer,newContext,repository,uuid); return DefaultEither.newB(txManager); } return DefaultEither.newA((Error)new DefaultError());
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeContext.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeContext.java Wed Sep 03 23:44:23 2014 +0900 @@ -3,7 +3,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -public class DefaultTreeContext<T extends TreeNode> implements TreeContext<T> +public class DefaultTreeContext implements TreeContext { private final TreeNode root; private final ChangeSet cs;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeNodeAttribute.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeNodeAttribute.java Wed Sep 03 23:44:23 2014 +0900 @@ -12,7 +12,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -public class DefaultTreeNodeAttribute implements TreeNodeAttributes<TreeNode> +public class DefaultTreeNodeAttribute implements TreeNodeAttributes { public List<TreeNode> children; public TreeMap<String,ByteBuffer> attrs;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeNodeChildren.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeNodeChildren.java Wed Sep 03 23:44:23 2014 +0900 @@ -13,7 +13,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -public class DefaultTreeNodeChildren implements TreeNodeChildren<TreeNode> +public class DefaultTreeNodeChildren implements TreeNodeChildren { public static void main(String _args[]) {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/TransactionManager.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/TransactionManager.java Wed Sep 03 23:44:23 2014 +0900 @@ -5,9 +5,9 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; -public interface TransactionManager<T extends TreeNode> +public interface TransactionManager { - public Either<Error,TransactionManager<T>> commit(TreeNode _newRoot,TreeOperationLog _log); + public Either<Error,TransactionManager> commit(TreeNode _newRoot,TreeOperationLog _log); public String getUUID(); public long getRevision(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/TreeContext.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/TreeContext.java Wed Sep 03 23:44:23 2014 +0900 @@ -3,7 +3,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -public interface TreeContext<T extends TreeNode> +public interface TreeContext { public ChangeSet getChangeSet(); public TreeNode getTreeNode();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/DefaultEvaluator.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/DefaultEvaluator.java Wed Sep 03 23:44:23 2014 +0900 @@ -14,7 +14,7 @@ } @Override - public <T extends TreeNode> Evaluation evaluate(T _current,int _pos) + public Evaluation evaluate(TreeNode _current,int _pos) { Pair<Integer,NodePath> pop = path.pop(); int head = pop.left();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/DefaultTraverser.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/DefaultTraverser.java Wed Sep 03 23:44:23 2014 +0900 @@ -13,12 +13,12 @@ public class DefaultTraverser implements Traverser { @Override - public <T extends TreeNode> Either<Error,Traversal<TreeNode>> traverse(final T _root,Evaluator _evaluator) + public Either<Error,Traversal> traverse(final TreeNode _root,Evaluator _evaluator) { - Children<T> wrapper = new Children<T>(){ + Children wrapper = new Children(){ @Override - public Iterator<T> iterator(){ - List<T> list = List.nil(); + public Iterator<TreeNode> iterator(){ + List<TreeNode> list = List.nil(); return list.cons(_root).iterator(); } @Override @@ -26,7 +26,7 @@ return 1; } @Override - public Either<Error,T> at(int _pos){ + public Either<Error,TreeNode> at(int _pos){ if(_pos != 0){ return DefaultEither.newA(NodeEditorError.INDEX_OUT_OF_BOUNDS); } @@ -35,7 +35,7 @@ }; //Children<T> chs = _root.getChildren(); - Children<T> chs = wrapper; + Children chs = wrapper; Either<Error,List<Direction<TreeNode>>> ret = _traverse(chs,_evaluator,-1); if(ret.isA()){ @@ -47,7 +47,7 @@ final Iterable<Direction<TreeNode>> iterable = list; final TreeNode destination = ret.b().last().getTarget(); - Traversal<TreeNode> traversal = new Traversal<TreeNode>(){ + Traversal traversal = new Traversal(){ @Override public Iterator<Direction<TreeNode>> iterator(){ return iterable.iterator(); @@ -62,7 +62,7 @@ return DefaultEither.newB(traversal); } - private <T extends TreeNode> Either<Error,List<Direction<TreeNode>>> _traverse(Children<T> _chs,Evaluator _evaluator,int _pos) + private Either<Error,List<Direction<TreeNode>>> _traverse(Children _chs,Evaluator _evaluator,int _pos) { int pos = _pos; for(TreeNode ch : _chs){ @@ -91,30 +91,30 @@ return DefaultEither.newA(TraverserError.PATH_NOT_FOUND); } - private <T extends TreeNode> List<Direction<T>> _goal(final T _current,final int _pos) + private List<Direction<TreeNode>> _goal(final TreeNode _current,final int _pos) { - Direction<T> d = new Direction<T>(){ + Direction<TreeNode> d = new Direction<TreeNode>(){ @Override public int getPosition() { return _pos; } @Override - public T getTarget() + public TreeNode getTarget() { return _current; } }; - List<Direction<T>> list = List.nil(); - List<Direction<T>> newList = list.cons(d); + List<Direction<TreeNode>> list = List.nil(); + List<Direction<TreeNode>> newList = list.cons(d); return newList; } private <T extends TreeNode> Either<Error,List<Direction<TreeNode>>> _accept(final T _current,final int _pos,Evaluator _evaluator) { - Children<TreeNode> chs = _current.getChildren(); + Children chs = _current.getChildren(); Either<Error,List<Direction<TreeNode>>> either = _traverse(chs,_evaluator,0); if(either.isA()){ return either;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/Evaluator.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/Evaluator.java Wed Sep 03 23:44:23 2014 +0900 @@ -4,5 +4,5 @@ public interface Evaluator { - public <T extends TreeNode> Evaluation evaluate(T _current,int _pos); + public Evaluation evaluate(TreeNode _current,int _pos); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/Traversal.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/Traversal.java Wed Sep 03 23:44:23 2014 +0900 @@ -2,7 +2,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -public interface Traversal<T extends TreeNode> extends Iterable<Direction<T>> +public interface Traversal extends Iterable<Direction<TreeNode>> { - public T destination(); + public TreeNode destination(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/Traverser.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/Traverser.java Wed Sep 03 23:44:23 2014 +0900 @@ -6,7 +6,7 @@ public interface Traverser { - public <T extends TreeNode> Either<Error,Traversal<TreeNode>> traverse(final T _root,Evaluator _evaluator); + public Either<Error,Traversal> traverse(final TreeNode _root,Evaluator _evaluator); }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/ChildrenTest.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/ChildrenTest.java Wed Sep 03 23:44:23 2014 +0900 @@ -1,7 +1,6 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core; -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.transaction.DefaultTreeNodeChildren; import junit.framework.Assert; import junit.framework.TestCase; @@ -14,7 +13,7 @@ public void testSize() { int expect = expectSize(); - Children<TreeNode> children = instance(); + Children children = instance(); Assert.assertEquals(expect,children.size()); }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Wed Sep 03 23:44:23 2014 +0900 @@ -52,7 +52,7 @@ DefaultTraverser traverser = new DefaultTraverser(); for(DefaultNodePath part : path.inits()){ - Either<Error,Traversal<TreeNode>> either = traverser.traverse(newRoot,new DefaultEvaluator(part)); + Either<Error,Traversal> either = traverser.traverse(newRoot,new DefaultEvaluator(part)); if(either.isA()){ Assert.fail(); } @@ -64,7 +64,7 @@ } for(DefaultNodePath part : path.inits()){ - Either<Error,Traversal<TreeNode>> either = traverser.traverse(oldRoot,new DefaultEvaluator(part)); + Either<Error,Traversal> either = traverser.traverse(oldRoot,new DefaultEvaluator(part)); if(either.isA()){ Assert.fail(); }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/impl/node/DefaultAttributesTest.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/impl/node/DefaultAttributesTest.java Wed Sep 03 23:44:23 2014 +0900 @@ -18,7 +18,7 @@ public class DefaultAttributesTest extends AttributesTest { - public TreeNodeAttributes<TreeNode> instance() + public TreeNodeAttributes instance() { List<TreeNode> rawList = List.nil(); TreeMap<String,ByteBuffer> rawMap = TreeMap.empty(Ord.stringOrd); @@ -35,7 +35,7 @@ public void testGetAttributesAsRawMap() { - TreeNodeAttributes<TreeNode> attrs = instance(); + TreeNodeAttributes attrs = instance(); TreeMap<String,ByteBuffer> rawMap = attrs.getAttributesAsRawMap(); // testing rawmap is not null.
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/TraverserTest.java Wed Sep 03 21:10:30 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/TraverserTest.java Wed Sep 03 23:44:23 2014 +0900 @@ -35,12 +35,12 @@ for(DefaultNodePath path : paths){ DefaultEvaluator evaluator = new DefaultEvaluator(path); - Either<Error,Traversal<TreeNode>> ret = traverser.traverse(root,evaluator); + Either<Error,Traversal> ret = traverser.traverse(root,evaluator); if(ret.isA()){ Assert.fail(); } - Traversal<TreeNode> traversal = ret.b(); + Traversal traversal = ret.b(); TreeNode target = traversal.destination(); String expect = path.toString(); ByteBuffer value = target.getAttributes().get(key);