Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 263:cac88cf813f1 Implementation_of_communication
tmp
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/Data/ListBenchMark.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,27 @@ +package jp.ac.u_ryukyu.ie.cr.benchMark.Data; + +import jp.ac.u_ryukyu.ie.cr.jungle.data.differentialList.DifferentialList; +import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; + + +public class ListBenchMark { + public static void main(String args[]) { + List<Integer> list = new List<>(); + DifferentialList<Integer> dfList = new DifferentialList<>(); + + Long t1 = System.currentTimeMillis(); + for (int i = 0; i < 10000; i++) { + list = list.addLast(i); + } + Long t2 = System.currentTimeMillis(); + + System.out.println("list add time = " + (t2 - t1)); + + t1 = System.currentTimeMillis(); + for (int i = 0; i < 10000; i++) { + dfList = dfList.addLast(i); + } + t2 = System.currentTimeMillis(); + System.out.println("dflist add time = " + (t2 - t1)); + } +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/JungleBenchMark.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/JungleBenchMark.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,15 +1,14 @@ package jp.ac.u_ryukyu.ie.cr.benchMark; import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeAttributes; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import java.nio.ByteBuffer; import java.util.Iterator; @@ -20,10 +19,10 @@ */ public class JungleBenchMark { public static void main(String args[]) { - DefaultJungle jungle = new DefaultJungle(null, "sample", new DefaultTreeEditor(new DefaultTraverser())); + DefaultJungle jungle = new DefaultJungle(null, "sample", new DefaultTraverser()); jungle.createNewTree("tree"); JungleTree tree = jungle.getTreeByName("tree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); NodePath path = new DefaultNodePath(); path = path.add(0); for (int count = 1; count <= 10; count++) {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataReadBenchMark.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataReadBenchMark.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,12 +1,12 @@ package jp.ac.u_ryukyu.ie.cr.benchMark.persistent; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListReader; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; @@ -41,7 +41,7 @@ NetworkNodePath path = new NetworkNodePath(); t1 = System.currentTimeMillis(); for (int j = 0; j < 100 * i; j++) { - editor = tree1.getTreeEditor(); + editor = tree1.getJungleTreeEditor(); Either<Error, JungleTreeEditor> either = editor.addNewChildAt(path, pos); NodePath childPath = path.add(pos); Assert.assertFalse(either.isA()); @@ -68,7 +68,7 @@ if (tree2 == null) { tree2 = jungle2.createNewTree(treeName); } - JungleTreeEditor editor2 = tree2.getTreeEditor(); + JungleTreeEditor editor2 = tree2.getJungleTreeEditor(); Either<Error, JungleTreeEditor> either2 = JungleUpdater.edit(editor2, chList); Assert.assertFalse(either2.isA()); editor2 = either2.b();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataWriteBenchMark.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataWriteBenchMark.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,10 +1,10 @@ package jp.ac.u_ryukyu.ie.cr.benchMark.persistent; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent.PersistentJournal; import jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent.PersistentJungle; @@ -20,7 +20,7 @@ Jungle jungle = new PersistentJungle(journal1, "uuid",new DefaultTreeEditor(new DefaultTraverser())); jungle.createNewTree("testTree"); JungleTree tree = jungle.getTreeByName("testTree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); int multiple = Integer.valueOf(args[0]); for (int count = 0 ; count < 5000 ; count++) { editor = editor.addNewChildAt(new DefaultNodePath(),count).b();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/JungleLogCopyBenchMark.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/JungleLogCopyBenchMark.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,10 +1,10 @@ package jp.ac.u_ryukyu.ie.cr.benchMark.persistent; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations.NetworkNodePath; @@ -38,7 +38,7 @@ int count = 0; for (int j = 0; j < 2000; j++) { count++; - editor = tree1.getTreeEditor(); + editor = tree1.getJungleTreeEditor(); Either<jp.ac.u_ryukyu.ie.cr.jungle.util.Error, JungleTreeEditor> either = editor.addNewChildAt(path, pos); NodePath childPath = path.add(pos); Assert.assertFalse(either.isA());
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/DefaultJungle.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/DefaultJungle.java Tue Dec 13 00:00:18 2016 +0900 @@ -6,17 +6,23 @@ import jp.ac.u_ryukyu.ie.cr.jungle.persistent.Journal; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.NullJournal; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultDifferenceTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeContext; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Traverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.DefaultJungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.DefferenceListJungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; @@ -28,13 +34,14 @@ private Journal journal; private ConcurrentHashMap<String, JungleTree> trees; private String uuid; - private TreeEditor editor; + private TreeEditor treeEditor; + private TreeEditor differenceEditor; public static void main(String args[]) { - DefaultJungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); + DefaultJungle j = new DefaultJungle(null, "hoge", new DefaultTraverser()); JungleTree t = j.createNewTree("fuga"); - JungleTreeEditor e1 = t.getTreeEditor(); + JungleTreeEditor e1 = t.getJungleTreeEditor(); DefaultNodePath root = new DefaultNodePath(); @@ -45,11 +52,12 @@ e1.success(); } - public DefaultJungle(Journal journal, String uuid, TreeEditor editor) { + public DefaultJungle(Journal journal, String uuid, Traverser traverser) { this.journal = new NullJournal(); this.trees = new ConcurrentHashMap<String, JungleTree>(); this.uuid = uuid; - this.editor = editor; + this.treeEditor = new DefaultTreeEditor(traverser); + this.differenceEditor = new DefaultDifferenceTreeEditor(traverser); } @Override @@ -90,7 +98,47 @@ }; InterfaceTraverser traverser = new InterfaceTraverser(rootNode, true); TreeContext tc = new DefaultTreeContext(rootNode, null, list, uuid, name, 0, traverser); - JungleTree newTree = new DefaultJungleTree(tc, uuid, journal.getWriter(), editor); + JungleTree newTree = new DefaultJungleTree(tc, uuid, journal.getWriter(), treeEditor); + if (trees.putIfAbsent(name, newTree) != null) { + return null; + } + return newTree; + } + + @Override + public JungleTree createNewDifferenceTree(final String name) { + return createNewDifferenceTree(name,new DefaultTreeNode()); + } + + @Override + public JungleTree createNewDifferenceTree(final String name, TreeNode rootNode) { + + ChangeList list = new ChangeList() { + @Override + public Iterator<TreeOperation> iterator() { + List<TreeOperation> nil = new List<>(); + return nil.iterator(); + } + + @Override + public String uuid() { + return uuid; + } + + @Override + public String getTreeName() { + return name; + } + + @Override + public TreeOperationLog getLog() { + return new DefaultTreeOperationLog(); + } + + }; + InterfaceTraverser traverser = new InterfaceTraverser(rootNode, true); + TreeContext tc = new DefaultTreeContext(rootNode, null, list, uuid, name, 0, traverser); + JungleTree newTree = new DefferenceListJungleTree(tc, uuid, journal.getWriter(), differenceEditor); if (trees.putIfAbsent(name, newTree) != null) { return null; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/DefaultJungleTree.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle; - -import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; -import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; -import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeChildren; -import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; -import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultJungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTransactionManager; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; -import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.util.GetOldTreeError; - -import java.util.Optional; -import java.util.concurrent.atomic.AtomicReference; - -public class DefaultJungleTree implements JungleTree { - - private final AtomicReference<TreeContext> repository; - private final String uuid; - private final ChangeListWriter writer; - private final TreeEditor treeEditor; - - public DefaultJungleTree(TreeContext tc, String uuid, ChangeListWriter writer, TreeEditor editor) { - this.repository = new AtomicReference<TreeContext>(tc); - this.uuid = uuid; - this.writer = writer; - this.treeEditor = editor; - } - - @Override - public JungleTreeEditor getTreeEditor() { - TreeContext tc = repository.get(); - DefaultTransactionManager txManager = new DefaultTransactionManager(writer, tc, repository, uuid); - TreeNode root = tc.getRoot(); - return new DefaultJungleTreeEditor(root, txManager, treeEditor); - } - - @Override - public JungleTreeEditor getLocalTreeEditor() { - return getTreeEditor(); - } - - @Override - public TreeNode getRootNode() { - TreeContext tc = repository.get(); - return tc.getRoot(); - } - - @Override - public InterfaceTraverser getTraverser(boolean useIndex) { - TreeContext tc = repository.get(); - return tc.getTraverser(); - } - - @Override - public ParentIndex getParentIndex() { - TreeContext tc = repository.get(); - return tc.getParentIndex(); - } - - @Override - public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex() { - TreeContext tc = repository.get(); - return tc.getIndex(); - } - - @Override - public long revision() { - TreeContext tc = repository.get(); - return tc.revision(); - } - - @Override - public Either<Error, JungleTree> getOldTree(long revision) { - TreeContext tc = repository.get(); - - for (; tc.revision() != revision; ) { - tc = tc.prev(); - if (tc == null) - return DefaultEither.newA(GetOldTreeError.OLD_TREE_NOT_FOUND); - } - - - String oldTreeUuid = uuid + revision; - JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, writer, treeEditor); - return DefaultEither.newB(oldTree); - } - - @Override - public Either<Error, TreeNode> getNodeOfPath(NodePath path) { - TreeNode node = repository.get().getRoot(); - for (int num : path) { - if (num == -1) - continue; - Either<Error, TreeNode> either = node.getChildren().at(num); - if (either.isA()) - return either; - node = either.b(); - } - return DefaultEither.newB(node); - } - - @Override - public NodePath getNodePath(TreeNode node) { - ParentIndex parentIndex = getParentIndex(); - NodePath path = new DefaultNodePath().pop().right(); - Optional<TreeNode> parentOp = parentIndex.get(node); - while(parentOp.isPresent()) { - TreeNode parent = parentOp.get(); - TreeNodeChildren children = parent.getChildren(); - int num = 0; - for (TreeNode child : children) { - if (child == node) - break; - num++; - } - path = path.addHead(num); - node = parent; - parentOp = parentIndex.get(node); - } - return path.addHead(-1); - } - - @Override - public void setBufferSize(int _bufferSize) { - // not use - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/Jungle.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/Jungle.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,13 +2,21 @@ import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import java.util.Iterator; -public interface Jungle -{ - public JungleTree getTreeByName(String name); - public JungleTree createNewTree(String name); - public JungleTree createNewTree(String name , TreeNode rootNode); - public Iterator<String> getTreeNames(); +public interface Jungle { + public JungleTree getTreeByName(String name); + + public JungleTree createNewTree(String name); + + public JungleTree createNewTree(String name, TreeNode rootNode); + + public JungleTree createNewDifferenceTree(String name); + + public JungleTree createNewDifferenceTree(String name, TreeNode rootNode); + + + public Iterator<String> getTreeNames(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/JungleTree.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle; - - -import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; -import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; - -public interface JungleTree { - public JungleTreeEditor getTreeEditor(); - - public JungleTreeEditor getLocalTreeEditor(); - - public TreeNode getRootNode(); - - public long revision(); - - public Either<Error, JungleTree> getOldTree(long revision); - - public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex(); - - public ParentIndex getParentIndex(); - - public InterfaceTraverser getTraverser(boolean useIndex); - - public Either<Error, TreeNode> getNodeOfPath(NodePath path); - - public void setBufferSize(int _bufferSize); - - public NodePath getNodePath(TreeNode node); -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/JungleTreeEditor.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle; - -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; - -import java.nio.ByteBuffer; - -public interface JungleTreeEditor { - - public Either<Error, JungleTreeEditor> addNewChildAt(NodePath path, int pos); - - public Either<Error, JungleTreeEditor> deleteChildAt(NodePath path, int pos); - - public Either<Error, JungleTreeEditor> putAttribute(NodePath path, String key, ByteBuffer value); - - public Either<Error, JungleTreeEditor> deleteAttribute(NodePath path, String key); - - public Either<Error, JungleTreeEditor> replaceNewRootNode(); - - public Either<Error, JungleTreeEditor> edit(NodePath path, NodeEditor editor); - - public Either<Error, JungleTreeEditor> success(); - - public Either<Error, JungleTreeEditor> flushSuccess(); - - public Either<Error, JungleTreeEditor> moveChild(NodePath path,int childNum ,String move); -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/benchMark/Data/ListBenchMark.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.benchMark.Data; - -import jp.ac.u_ryukyu.ie.cr.jungle.data.differentialList.DifferentialList; -import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; - - -public class ListBenchMark { - public static void main(String args[]) { - List<Integer> list = new List<>(); - DifferentialList<Integer> dfList = new DifferentialList<>(); - - Long t1 = System.currentTimeMillis(); - for (int i = 0; i < 10000; i++) { - list = list.addLast(i); - } - Long t2 = System.currentTimeMillis(); - - System.out.println("list add time = " + (t2 - t1)); - - t1 = System.currentTimeMillis(); - for (int i = 0; i < 10000; i++) { - dfList = dfList.addLast(i); - } - t2 = System.currentTimeMillis(); - System.out.println("dflist add time = " + (t2 - t1)); - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/benchMark/Data/TreeMapBenchMark.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.benchMark.Data; - - -import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; - -import java.util.ArrayList; -import java.util.Collections; - -public class TreeMapBenchMark { - public static void main(String[] args) { - for (int i = 1; i <= 10; i++) { - TreeMap<Integer, Integer> map = new TreeMap<>(); - ArrayList<Integer> list = new ArrayList<>(); - - for (int count = 1; count < 100000 * i; count++) { - map = map.put(count, count); - list.add(count); - } - - Collections.shuffle(list); - long t1 = System.currentTimeMillis(); - for (Integer num : list) { - map = map.delete(num); - } - long t2 = System.currentTimeMillis(); - System.out.println((i * 100000) + " time = " + (t2 - t1)); - } - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/benchMark/JungleBenchMark.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.benchMark; - -import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeAttributes; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; - -import java.nio.ByteBuffer; -import java.util.Iterator; - - -/** - * Created by e115731 on 15/05/07. - */ -public class JungleBenchMark { - public static void main(String args[]) { - DefaultJungle jungle = new DefaultJungle(null, "sample", new DefaultTreeEditor(new DefaultTraverser())); - jungle.createNewTree("tree"); - JungleTree tree = jungle.getTreeByName("tree"); - JungleTreeEditor editor = tree.getTreeEditor(); - NodePath path = new DefaultNodePath(); - path = path.add(0); - for (int count = 1; count <= 10; count++) { - for (int personCount = 0; personCount < 1000 * count; personCount++) { - editor = editor.replaceNewRootNode().b(); - ByteBuffer value = ByteBuffer.wrap(("p:" + personCount).getBytes()); - editor = editor.putAttribute(path, "personId", value).b(); - ByteBuffer value2 = ByteBuffer.wrap(("r:" + personCount).getBytes()); - editor = editor.putAttribute(path, "roleId", value2).b(); - } - editor.success(); - long t1 = System.currentTimeMillis(); - for (int findCount = 0; findCount < 50000; ) { - InterfaceTraverser traverser = tree.getTraverser(true); - Iterator<TreeNode> it = traverser.find(null, "personId", "p:100"); - if (it.hasNext()) { - TreeNode targetNode = it.next(); - TreeNodeAttributes attribute = targetNode.getAttributes(); - String targetRoleId = attribute.getString("roleId"); - if (targetRoleId.equals("r:100")) - findCount++; - } else { - System.out.println("find miss"); - System.exit(1); - } - } - long t2 = System.currentTimeMillis(); - System.out.println("time = " + (t2 - t1)); - } - - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/commandline/commandline.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,15 +2,14 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.omnigraffle.OmniGraffleCreater; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultError; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; @@ -68,7 +67,7 @@ */ public class commandline { - Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTraverser()); public void start() throws IOException, InterruptedException { System.out.println("jungle 対話モード"); @@ -210,7 +209,7 @@ JungleTree tree = jungle.getTreeByName(treeName); if (tree == null) tree = jungle.createNewTree(treeName); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); Iterator<String> keyIterator = keys.iterator(); Iterator<String> valueIterator = values.iterator(); Either<Error, JungleTreeEditor> either = DefaultEither.newA(new DefaultError()); @@ -260,7 +259,7 @@ JungleTree tree = jungle.getTreeByName(treeName); if (tree == null) tree = jungle.createNewTree(treeName); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); Iterator<String> keyIterator = keys.iterator(); Iterator<String> valueIterator = values.iterator(); NodePath parentPath = path.last().right(); // Nodeの追加
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/core/App.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/core/App.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,12 +1,11 @@ package jp.ac.u_ryukyu.ie.cr.jungle.core; import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; @@ -20,10 +19,10 @@ { public static void main( String[] args ) { - DefaultJungle jungle = new DefaultJungle(null,"sample", new DefaultTreeEditor(new DefaultTraverser())); + DefaultJungle jungle = new DefaultJungle(null,"sample",new DefaultTraverser()); jungle.createNewTree("hoge"); JungleTree tree = jungle.getTreeByName("hoge"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); DefaultNodePath path = new DefaultNodePath(); String key = "key";
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/persistent/ChangeList.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/persistent/ChangeList.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,6 +1,6 @@ package jp.ac.u_ryukyu.ie.cr.jungle.persistent; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; public interface ChangeList extends Iterable<TreeOperation>
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/NodePath.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store; - -import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair; - -public interface NodePath extends Iterable<Integer> -{ - public NodePath add(int pos); - public Pair<Integer,NodePath> pop(); - public NodePath tail(); - public int size(); - public Pair<Integer,NodePath> last(); - public NodePath addHead(int pos); -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/TreeEditor.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store; - -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; - -public interface TreeEditor -{ - public Either<Error,LoggingNode> edit(TreeNode root,NodePath path,NodeEditor transformer); -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/TreeEditorError.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store; - -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultError; - -public class TreeEditorError -{ - public static final Error NODEPATH_NOTFOUND = new DefaultError(); -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/DefaultNodePath.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl; - - -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair; -import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; - -import java.util.Iterator; - -public class DefaultNodePath implements NodePath { - private final List<Integer> path; - - public static void main(String args[]) { - DefaultNodePath p = new DefaultNodePath(); - p = p.add(1).add(2).add(3).add(4); - System.out.println(p.toString()); - } - - public DefaultNodePath() { - path = new List<Integer>().addLast(-1); - } - - public DefaultNodePath (String nodePath) { - List<Integer> _path = new List<>(-1); - String[] nums = nodePath.split(","); - for (String num : nums) { - if (num.equals("-1")) - continue; - _path = _path.addLast(Integer.parseInt(num)); - } - this.path = _path; - } - - private DefaultNodePath(List<Integer> path) { - this.path = path; - } - - @Override - public Iterator<Integer> iterator() { - return path.iterator(); - } - - @Override - public DefaultNodePath add(int pos) { - List<Integer> newPath = path.addLast(pos); - return new DefaultNodePath(newPath); - } - - @Override - public NodePath addHead(int pos) { - List<Integer> newPath = path.add(0,pos); - return new DefaultNodePath(newPath); - } - - @Override - public Pair<Integer, NodePath> pop() { - Integer head = path.head(); - List<Integer> tail = path.deleteHead(); - return new Pair<>(head, new DefaultNodePath(tail)); - } - - @Override - public Pair<Integer, NodePath> last() { - Integer last = path.tail(); - List<Integer> list = path.deleteLast(); - return new Pair<>(last, new DefaultNodePath(list)); - } - - @Override - public String toString() { - return path.toString(); - } - - @Override - public int size() { - return path.length(); - } - - - //PATHの一番後ろを取り除いたPATHを新しく作って返す -// EXAMPLE <0,0,3> → <0,0> - @Override - public NodePath tail() { - List<Integer> tail = path.deleteLast(); - return new DefaultNodePath(tail); - } - - public List<DefaultNodePath> inits() { - List<DefaultNodePath> paths = new List<>(); - List<Integer> coursePath = new List<>(); - for (Integer tmpPath : path) { - List<Integer> tmp = coursePath.addLast(tmpPath); - paths = paths.addLast(new DefaultNodePath(tmp)); - coursePath = tmp; - } - return paths; - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/DefaultTreeEditor.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl; - - -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultEvaluator; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Direction; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Traversal; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Traverser; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; -import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; - -public class DefaultTreeEditor implements TreeEditor -{ - private final Traverser traverser; - public DefaultTreeEditor(Traverser traverser) - { - this.traverser = traverser; - } - - @Override - public Either<Error,LoggingNode> edit(TreeNode root,NodePath path,NodeEditor editor) - { - DefaultEvaluator e = new DefaultEvaluator(path); - Either<jp.ac.u_ryukyu.ie.cr.jungle.util.Error, Traversal> either = traverser.traverse(root,e); - - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - Traversal t = either.b(); - return clone(t,editor); - } - - private Either<Error,LoggingNode> clone(Traversal t,NodeEditor editor) - { - // copying nodes from bottom to root - - List<Direction<TreeNode>> path = new List<>(); - for(Direction<TreeNode> direction : t){ - path = path.addLast(direction); - } - - // target - Direction<TreeNode> targetDirection = path.head(); - TreeNode target = targetDirection.getTarget(); - Either<Error,LoggingNode> either = editor.edit(target); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - LoggingNode newWrap = either.b(); - - // top - int pos = targetDirection.getPosition(); - TreeNode child = newWrap.getWrap(); - - - for(Direction<TreeNode> parentDirection : path.deleteHead()){ - - TreeNodeChildren chs = parentDirection.getTarget().getChildren(); - - Either<Error,TreeNode> ret = chs.replaceNode(pos,child); - if(ret.isA()){ - return DefaultEither.newA(ret.a()); - } - - child = ret.b(); - pos = parentDirection.getPosition(); - } - - TreeNode newRoot = child; - LoggingNode logNode = editor.wrap(newRoot,newWrap.getOperationLog()); - return DefaultEither.newB(logNode); - } - -} \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/logger/DefaultOperationLog.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger; - - -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; - -import java.util.Iterator; - -public class DefaultOperationLog implements OperationLog -{ - private final List<NodeOperation> log; - - private static final List<NodeOperation> EMPTY =new List<>(); - - public DefaultOperationLog() - { - this(EMPTY); - } - - private DefaultOperationLog(List<NodeOperation> _log) - { - log = _log; - } - - @Override - public Iterator<NodeOperation> iterator() - { - return log.iterator(); - } - - - @Override - public DefaultOperationLog add(NodeOperation _op) - { - return new DefaultOperationLog(log.addLast(_op)); - } - - @Override - public int length() - { - return log.length(); - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/logger/DefaultTreeOperationLog.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger; - - -import com.google.common.collect.Iterables; -import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DefaultTreeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; - -import java.util.Iterator; - -public class DefaultTreeOperationLog implements TreeOperationLog -{ - private final Iterable<TreeOperation> list; - private final int size; - - public DefaultTreeOperationLog() - { - list = new List<>(); - size = 0; - } - - public DefaultTreeOperationLog(Iterable<TreeOperation> _list,int _size) - { - list = _list; - size = _size; - } - - @Override - public Iterator<TreeOperation> iterator() - { - return list.iterator(); - } - - @Override - public TreeOperationLog add(NodePath _p, NodeOperation _op) - { - TreeOperation op = new DefaultTreeOperation(_p,_op); - List<TreeOperation> newList = new List<>(op); - Iterable<TreeOperation> concat = Iterables.concat(list,newList); - - return new DefaultTreeOperationLog(concat,size + 1); - } - - @Override - public TreeOperationLog append(TreeOperationLog _log) - { - int argumentLogSize = _log.length(); - Iterable<TreeOperation> concat = Iterables.concat(list,_log); - - return new DefaultTreeOperationLog(concat,argumentLogSize + size); - } - - @Override - public int length() - { - return size; - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/logger/LoggingAttributes.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger; - -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeAttributes; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DeleteAttributeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.PutAttributeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; - -import java.nio.ByteBuffer; - -public class LoggingAttributes //implements EditableAttributes -{ - private final TreeNode wrap; - private final OperationLog log; - - public LoggingAttributes(TreeNode _wrap,OperationLog _log) - { - wrap = _wrap; - log = _log; - } - - public ByteBuffer get(String _key) - { - TreeNodeAttributes attributes = wrap.getAttributes(); - return attributes.get(_key); - } - - private Either<Error,LoggingNode> edit(NodeOperation _op) - { - Either<Error,TreeNode> either = _op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newNode = either.b(); - OperationLog newLog = log.add(_op); - LoggingNode newLogNode = new LoggingNode(newNode,newLog); - - return DefaultEither.newB(newLogNode); - } - - public Either<Error,LoggingNode> delete(final String _key) - { - - DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key); - return edit(deleteAttribute); - } - - public Either<Error,LoggingNode> put(final String _key,final ByteBuffer _value) - { - PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value); - return edit(putAttribute); - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/logger/LoggingChildren.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger; - - -import jp.ac.u_ryukyu.ie.cr.jungle.core.Children; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.AppendChildAtOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.ChildMoveOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DeleteChildAtOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; - -public class LoggingChildren -{ - private final TreeNode wrap; - private final OperationLog log; - - public LoggingChildren(TreeNode _wrap,OperationLog _log) - { - wrap = _wrap; - log = _log; - } - - public int size() - { - Children children = wrap.getChildren(); - return children.size(); - } - - public Either<Error,LoggingNode> edit(NodeOperation _op) - { - Either<Error,TreeNode> either = _op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newWrap = either.b(); - OperationLog newLog = log.add(_op); - LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); - return DefaultEither.newB(newLoggingNode); - } - - public Either<Error,LoggingNode> addNewChildAt(final int _pos) - { - NodeOperation addNewChildAt = new AppendChildAtOperation(_pos); - return edit(addNewChildAt); - } - - public Either<Error,LoggingNode> deleteChildAt(final int _pos) - { - NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos); - return edit(deleteChildAt); - } - - - public Either<Error,LoggingNode> moveChild(String move, int childNum) { - NodeOperation moveChild = new ChildMoveOperation(move,childNum); - return edit(moveChild); - } - - public Either<Error,LoggingNode> at(int _pos) - { - Children children = wrap.getChildren(); - Either<Error,TreeNode> either = children.at(_pos); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode node = either.b(); - LoggingNode logNode = new LoggingNode(node); - return DefaultEither.newB(logNode); - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/logger/LoggingNode.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger; - -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.ReplaceRootNodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; - - -public class LoggingNode -{ - - private final TreeNode wrap; - private final OperationLog log; - - public LoggingNode(TreeNode _wrap) - { - this(_wrap,new DefaultOperationLog()); - } - - public LoggingNode(TreeNode _wrap,OperationLog _log) - { - wrap = _wrap; - log = _log; - } - - public LoggingAttributes getAttributes() - { - return new LoggingAttributes(wrap,log); - } - - public LoggingChildren getChildren() - { - return new LoggingChildren(wrap,log); - } - - - public OperationLog getOperationLog() - { - return log; - } - - - public Either<Error, LoggingNode> replaceNewRootNode() { - NodeOperation replaceRootNode = new ReplaceRootNodeOperation(); - return edit(replaceRootNode); - } - - public Either<Error, LoggingNode> edit(NodeOperation op){ - Either<Error,TreeNode> either = op.invoke(wrap); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TreeNode newWrap = either.b(); - OperationLog newLog = log.add(op); - LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); - return DefaultEither.newB(newLoggingNode); - } - - public TreeNode getWrap() - { - return wrap; - } -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/logger/OperationLog.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger; - -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; - - -public interface OperationLog extends Iterable<NodeOperation> -{ - public OperationLog add(NodeOperation _op); - public int length(); -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/impl/logger/TreeOperationLog.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger; - -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; - -public interface TreeOperationLog extends Iterable<TreeOperation> -{ - public TreeOperationLog add(NodePath _p,NodeOperation _op); - public TreeOperationLog append(TreeOperationLog _log); - public int length(); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/logger/DefaultOperationLog.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,43 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.logger; + + +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; + +import java.util.Iterator; + +public class DefaultOperationLog implements OperationLog +{ + private final List<NodeOperation> log; + + private static final List<NodeOperation> EMPTY =new List<>(); + + public DefaultOperationLog() + { + this(EMPTY); + } + + private DefaultOperationLog(List<NodeOperation> _log) + { + log = _log; + } + + @Override + public Iterator<NodeOperation> iterator() + { + return log.iterator(); + } + + + @Override + public DefaultOperationLog add(NodeOperation _op) + { + return new DefaultOperationLog(log.addLast(_op)); + } + + @Override + public int length() + { + return log.length(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/logger/DefaultTreeOperationLog.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,61 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.logger; + + +import com.google.common.collect.Iterables; +import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DefaultTreeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; + +import java.util.Iterator; + +public class DefaultTreeOperationLog implements TreeOperationLog +{ + private final Iterable<TreeOperation> list; + private final int size; + + public DefaultTreeOperationLog() + { + list = new List<>(); + size = 0; + } + + public DefaultTreeOperationLog(Iterable<TreeOperation> _list,int _size) + { + list = _list; + size = _size; + } + + @Override + public Iterator<TreeOperation> iterator() + { + return list.iterator(); + } + + @Override + public TreeOperationLog add(NodePath _p, NodeOperation _op) + { + TreeOperation op = new DefaultTreeOperation(_p,_op); + List<TreeOperation> newList = new List<>(op); + Iterable<TreeOperation> concat = Iterables.concat(list,newList); + + return new DefaultTreeOperationLog(concat,size + 1); + } + + @Override + public TreeOperationLog append(TreeOperationLog _log) + { + int argumentLogSize = _log.length(); + Iterable<TreeOperation> concat = Iterables.concat(list,_log); + + return new DefaultTreeOperationLog(concat,argumentLogSize + size); + } + + @Override + public int length() + { + return size; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/logger/LoggingAttributes.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,57 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.logger; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeAttributes; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DeleteAttributeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.PutAttributeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +import java.nio.ByteBuffer; + +public class LoggingAttributes //implements EditableAttributes +{ + private final TreeNode wrap; + private final OperationLog log; + + public LoggingAttributes(TreeNode _wrap,OperationLog _log) + { + wrap = _wrap; + log = _log; + } + + public ByteBuffer get(String _key) + { + TreeNodeAttributes attributes = wrap.getAttributes(); + return attributes.get(_key); + } + + private Either<Error,LoggingNode> edit(NodeOperation _op) + { + Either<Error,TreeNode> either = _op.invoke(wrap); + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + + TreeNode newNode = either.b(); + OperationLog newLog = log.add(_op); + LoggingNode newLogNode = new LoggingNode(newNode,newLog); + + return DefaultEither.newB(newLogNode); + } + + public Either<Error,LoggingNode> delete(final String _key) + { + + DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key); + return edit(deleteAttribute); + } + + public Either<Error,LoggingNode> put(final String _key,final ByteBuffer _value) + { + PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value); + return edit(putAttribute); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/logger/LoggingChildren.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,74 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.logger; + + +import jp.ac.u_ryukyu.ie.cr.jungle.core.Children; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.AppendChildAtOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.ChildMoveOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DeleteChildAtOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +public class LoggingChildren +{ + private final TreeNode wrap; + private final OperationLog log; + + public LoggingChildren(TreeNode _wrap,OperationLog _log) + { + wrap = _wrap; + log = _log; + } + + public int size() + { + Children children = wrap.getChildren(); + return children.size(); + } + + public Either<Error,LoggingNode> edit(NodeOperation _op) + { + Either<Error,TreeNode> either = _op.invoke(wrap); + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + + TreeNode newWrap = either.b(); + OperationLog newLog = log.add(_op); + LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); + return DefaultEither.newB(newLoggingNode); + } + + public Either<Error,LoggingNode> addNewChildAt(final int _pos) + { + NodeOperation addNewChildAt = new AppendChildAtOperation(_pos); + return edit(addNewChildAt); + } + + public Either<Error,LoggingNode> deleteChildAt(final int _pos) + { + NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos); + return edit(deleteChildAt); + } + + + public Either<Error,LoggingNode> moveChild(String move, int childNum) { + NodeOperation moveChild = new ChildMoveOperation(move,childNum); + return edit(moveChild); + } + + public Either<Error,LoggingNode> at(int _pos) + { + Children children = wrap.getChildren(); + Either<Error,TreeNode> either = children.at(_pos); + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + + TreeNode node = either.b(); + LoggingNode logNode = new LoggingNode(node); + return DefaultEither.newB(logNode); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/logger/LoggingNode.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,66 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.logger; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.ReplaceRootNodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; + + +public class LoggingNode +{ + + private final TreeNode wrap; + private final OperationLog log; + + public LoggingNode(TreeNode _wrap) + { + this(_wrap,new DefaultOperationLog()); + } + + public LoggingNode(TreeNode _wrap,OperationLog _log) + { + wrap = _wrap; + log = _log; + } + + public LoggingAttributes getAttributes() + { + return new LoggingAttributes(wrap,log); + } + + public LoggingChildren getChildren() + { + return new LoggingChildren(wrap,log); + } + + + public OperationLog getOperationLog() + { + return log; + } + + + public Either<Error, LoggingNode> replaceNewRootNode() { + NodeOperation replaceRootNode = new ReplaceRootNodeOperation(); + return edit(replaceRootNode); + } + + public Either<Error, LoggingNode> edit(NodeOperation op){ + Either<Error,TreeNode> either = op.invoke(wrap); + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + + TreeNode newWrap = either.b(); + OperationLog newLog = log.add(op); + LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); + return DefaultEither.newB(newLoggingNode); + } + + public TreeNode getWrap() + { + return wrap; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/logger/OperationLog.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,10 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.logger; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; + + +public interface OperationLog extends Iterable<NodeOperation> +{ + public OperationLog add(NodeOperation _op); + public int length(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/logger/TreeOperationLog.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,12 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.logger; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; + +public interface TreeOperationLog extends Iterable<TreeOperation> +{ + public TreeOperationLog add(NodePath _p,NodeOperation _op); + public TreeOperationLog append(TreeOperationLog _log); + public int length(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/nodepath/DefaultNodePath.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,109 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath; + + +import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair; +import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; + +import java.util.Iterator; + +public class DefaultNodePath implements NodePath { + private final List<Integer> path; + + public static void main(String args[]) { + DefaultNodePath p = new DefaultNodePath(); + p = p.add(1).add(2).add(3).add(4); + System.out.println(p.toString()); + } + + public DefaultNodePath() { + path = new List<Integer>().addLast(-1); + } + + + /* + * 基本使わない + * 差分リストTreeの指定のときのみ使用する + * 差分リストTreeでは、<0>の時一番後ろの不定ノードを指定するようにする + * DefaultNodePath(0)で一番後ろの不定ノードを指定するPathを作成する際にのみ使用する + */ + public DefaultNodePath(int num) { + path = new List<Integer>().addLast(num); + } + + public DefaultNodePath(String nodePath) { + List<Integer> _path = new List<>(); + String[] nums = nodePath.split(","); + for (String num : nums) { + if (num.equals("-1")) + _path = _path.addLast(-1); + else + _path = _path.addLast(Integer.parseInt(num)); + } + this.path = _path; + } + + private DefaultNodePath(List<Integer> path) { + this.path = path; + } + + @Override + public Iterator<Integer> iterator() { + return path.iterator(); + } + + @Override + public DefaultNodePath add(int pos) { + List<Integer> newPath = path.addLast(pos); + return new DefaultNodePath(newPath); + } + + @Override + public NodePath addHead(int pos) { + List<Integer> newPath = path.add(0, pos); + return new DefaultNodePath(newPath); + } + + @Override + public Pair<Integer, NodePath> pop() { + Integer head = path.head(); + List<Integer> tail = path.deleteHead(); + return new Pair<>(head, new DefaultNodePath(tail)); + } + + @Override + public Pair<Integer, NodePath> last() { + Integer last = path.tail(); + List<Integer> list = path.deleteLast(); + return new Pair<>(last, new DefaultNodePath(list)); + } + + @Override + public String toString() { + return path.toString(); + } + + @Override + public int size() { + return path.length(); + } + + + //PATHの一番後ろを取り除いたPATHを新しく作って返す +// EXAMPLE <0,0,3> → <0,0> + @Override + public NodePath tail() { + List<Integer> tail = path.deleteLast(); + return new DefaultNodePath(tail); + } + + public List<DefaultNodePath> inits() { + List<DefaultNodePath> paths = new List<>(); + List<Integer> coursePath = new List<>(); + for (Integer tmpPath : path) { + List<Integer> tmp = coursePath.addLast(tmpPath); + paths = paths.addLast(new DefaultNodePath(tmp)); + coursePath = tmp; + } + return paths; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/nodepath/NodePath.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,13 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath; + +import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair; + +public interface NodePath extends Iterable<Integer> +{ + public NodePath add(int pos); + public Pair<Integer,NodePath> pop(); + public NodePath tail(); + public int size(); + public Pair<Integer,NodePath> last(); + public NodePath addHead(int pos); +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/omnigraffle/App.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/omnigraffle/App.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,9 +2,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.xml.reader.XmlReader; import org.xml.sax.SAXException; @@ -18,7 +17,7 @@ public static void main(String args[]) throws IOException, SAXException, ParserConfigurationException, URISyntaxException, TransformerException { - Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hoge",new DefaultTraverser()); JungleTree tree = jungle.createNewTree("tree"); if (tree == null) tree = jungle.getTreeByName("tree");
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/omnigraffle/InsertNodePositionData.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/omnigraffle/InsertNodePositionData.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,6 +1,6 @@ package jp.ac.u_ryukyu.ie.cr.jungle.store.omnigraffle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.query.JungleNodeIterator; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeChildren;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/omnigraffle/OmniGraffleCreater.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/omnigraffle/OmniGraffleCreater.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,7 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.jungle.store.omnigraffle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeAttributes; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeChildren;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/operations/DefaultTreeOperation.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/operations/DefaultTreeOperation.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,6 +1,6 @@ package jp.ac.u_ryukyu.ie.cr.jungle.store.operations; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; public class DefaultTreeOperation implements TreeOperation {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/operations/TreeOperation.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/operations/TreeOperation.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,6 +1,6 @@ package jp.ac.u_ryukyu.ie.cr.jungle.store.operations; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; public interface TreeOperation {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/AppendChildAt.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/AppendChildAt.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,8 +1,8 @@ package jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/DeleteAttribute.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/DeleteAttribute.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,8 +3,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/DeleteChildAt.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/DeleteChildAt.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,8 +1,8 @@ package jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/MoveChild.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/MoveChild.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,8 +2,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/NodeEditor.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/NodeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,8 +3,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; public interface NodeEditor
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/PutAttribute.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/PutAttribute.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,8 +3,8 @@ import java.nio.ByteBuffer; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/replaceRootNodeAt.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/store/trasnformer/replaceRootNodeAt.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,7 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultJungleTreeEditor.java Wed Nov 30 19:47:47 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.transaction; - -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DefaultTreeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; -import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.*; -import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.util.IterableConverter; - -import java.nio.ByteBuffer; - -public class DefaultJungleTreeEditor implements JungleTreeEditor -{ - private final TransactionManager txManager; - private final TreeNode root; - private final TreeEditor editor; - private final TreeOperationLog log; - - public DefaultJungleTreeEditor(TreeNode _root,TransactionManager _txManager,TreeEditor _editor) - { - this(_root,_txManager,_editor,new DefaultTreeOperationLog()); - } - - - - public DefaultJungleTreeEditor(TreeNode newNode,TransactionManager _txManager,TreeEditor _editor,TreeOperationLog _log) - { - this.root = newNode; - this.txManager = _txManager; - this.editor = _editor; - this.log = _log; - } - - private Either<Error,JungleTreeEditor> _edit(final NodePath _path,NodeEditor _e) - { - Either<jp.ac.u_ryukyu.ie.cr.jungle.util.Error,LoggingNode> either = editor.edit(root,_path,_e); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - LoggingNode newLogging = either.b(); - OperationLog newLog = newLogging.getOperationLog(); - TreeNode newNode = newLogging.getWrap(); - - IterableConverter.Converter<TreeOperation,NodeOperation> converter = new IterableConverter.Converter<TreeOperation,NodeOperation>(){ - @Override - public TreeOperation conv(NodeOperation _b){ - return new DefaultTreeOperation(_path,_b); - } - }; - - Iterable<TreeOperation> iterable = new IterableConverter<>(newLog,converter); - DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); - TreeOperationLog newTreeOpLog = log.append(treeOperationLog); - - JungleTreeEditor newEditor = new DefaultJungleTreeEditor(newNode,txManager,editor,newTreeOpLog); - return DefaultEither.newB(newEditor); - } - - @Override - public Either<Error,JungleTreeEditor> replaceNewRootNode() - { - replaceRootNodeAt appendChildAt = new replaceRootNodeAt(); - return _edit(new DefaultNodePath(),appendChildAt); - } - - @Override - public Either<Error,JungleTreeEditor> addNewChildAt(NodePath _path, int _pos) - { - AppendChildAt appendChildAt = new AppendChildAt(_pos); - return _edit(_path,appendChildAt); - } - - @Override - public Either<Error,JungleTreeEditor> deleteChildAt(NodePath _path, int _pos) - { - DeleteChildAt deleteChildAt = new DeleteChildAt(_pos); - return _edit(_path,deleteChildAt); - } - - @Override - public Either<Error,JungleTreeEditor> putAttribute(NodePath _path,String _key,ByteBuffer _value) - { - PutAttribute putAttribute = new PutAttribute(_key,_value); - return _edit(_path,putAttribute); - } - - @Override - public Either<Error,JungleTreeEditor> deleteAttribute(NodePath _path, String _key) - { - DeleteAttribute deleteAttribute = new DeleteAttribute(_key); - return _edit(_path,deleteAttribute); - } - - @Override - public Either<Error, JungleTreeEditor> moveChild(NodePath path,int childNum, String move) { - MoveChild movechild = new MoveChild(move, childNum); - return _edit(path,movechild); - } - - - @Override - public Either<Error,JungleTreeEditor> edit(NodePath _path,NodeEditor _editor) - { - return _edit(_path,_editor); - } - - @Override - public Either<Error,JungleTreeEditor> success() - { - Either<Error,TransactionManager> either = txManager.commit(root,log); - if(either.isA()){ - return DefaultEither.newA(either.a()); - } - - TransactionManager newTxManager = either.b(); - JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(root,newTxManager,editor); - - return DefaultEither.newB(newTreeEditor); - } - - @Override - public Either<Error, JungleTreeEditor> flushSuccess() { - return success(); - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultTransactionManager.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultTransactionManager.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,7 +3,7 @@ import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/TransactionManager.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/TransactionManager.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,7 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.jungle.transaction; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/Error/TreeEditorError.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,10 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.Error; + +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultError; + +public class TreeEditorError +{ + public static final Error NODEPATH_NOTFOUND = new DefaultError(); + public static final Error NOT_USE_METHOD = new DefaultError(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/jungleTreeEditor/DefaultDifferenceJungleTreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,93 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.AppendChildAt; +import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.TransactionManager; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +import java.nio.ByteBuffer; + +import static jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.Error.TreeEditorError.NOT_USE_METHOD; + +/** + * Created by e115731 on 2016/12/11. + */ +public class DefaultDifferenceJungleTreeEditor implements JungleTreeEditor { + + private final TransactionManager txManager; + private final TreeNode root; + private final TreeEditor editor; + private final TreeOperationLog log; + + public DefaultDifferenceJungleTreeEditor(TreeNode _root, TransactionManager _txManager, TreeEditor _editor) { + this(_root, _txManager, _editor, new DefaultTreeOperationLog()); + } + + + public DefaultDifferenceJungleTreeEditor(TreeNode newNode, TransactionManager _txManager, TreeEditor _editor, TreeOperationLog _log) { + this.root = newNode; + this.txManager = _txManager; + this.editor = _editor; + this.log = _log; + } + + private Either<Error, JungleTreeEditor> _edit(final NodePath _path, NodeEditor _e) { + Either<Error, LoggingNode> either = editor.edit(root, _path, _e); + return null; + } + + + @Override + public Either<Error, JungleTreeEditor> addNewChildAt(NodePath path, int pos) { + AppendChildAt appendChildAt = new AppendChildAt(pos); + return _edit(path,appendChildAt); + } + + @Override + public Either<Error, JungleTreeEditor> deleteChildAt(NodePath path, int pos) { + return null; + } + + @Override + public Either<Error, JungleTreeEditor> putAttribute(NodePath path, String key, ByteBuffer value) { + return null; + } + + @Override + public Either<Error, JungleTreeEditor> deleteAttribute(NodePath path, String key) { + return null; + } + + @Override + public Either<Error, JungleTreeEditor> replaceNewRootNode() { + return null; + } + + @Override + public Either<Error, JungleTreeEditor> edit(NodePath path, NodeEditor editor) { + return null; + } + + @Override + public Either<Error, JungleTreeEditor> success() { + return null; + } + + @Override + public Either<Error, JungleTreeEditor> flushSuccess() { + return null; + } + + @Override + public Either<Error, JungleTreeEditor> moveChild(NodePath path, int childNum, String move) { + return DefaultEither.newA(NOT_USE_METHOD); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/jungleTreeEditor/DefaultJungleTreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,138 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DefaultTreeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; +import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.*; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.TransactionManager; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; +import jp.ac.u_ryukyu.ie.cr.jungle.util.IterableConverter; + +import java.nio.ByteBuffer; + +public class DefaultJungleTreeEditor implements JungleTreeEditor +{ + private final TransactionManager txManager; + private final TreeNode root; + private final TreeEditor editor; + private final TreeOperationLog log; + + public DefaultJungleTreeEditor(TreeNode _root,TransactionManager _txManager,TreeEditor _editor) + { + this(_root,_txManager,_editor,new DefaultTreeOperationLog()); + } + + + + public DefaultJungleTreeEditor(TreeNode newNode,TransactionManager _txManager,TreeEditor _editor,TreeOperationLog _log) + { + this.root = newNode; + this.txManager = _txManager; + this.editor = _editor; + this.log = _log; + } + + private Either<Error,JungleTreeEditor> _edit(final NodePath _path,NodeEditor _e) + { + Either<Error,LoggingNode> either = editor.edit(root,_path,_e); + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + + LoggingNode newLogging = either.b(); + OperationLog newLog = newLogging.getOperationLog(); + TreeNode newNode = newLogging.getWrap(); + + IterableConverter.Converter<TreeOperation,NodeOperation> converter = new IterableConverter.Converter<TreeOperation,NodeOperation>(){ + @Override + public TreeOperation conv(NodeOperation _b){ + return new DefaultTreeOperation(_path,_b); + } + }; + + Iterable<TreeOperation> iterable = new IterableConverter<>(newLog,converter); + DefaultTreeOperationLog treeOperationLog = new DefaultTreeOperationLog(iterable,newLog.length()); + TreeOperationLog newTreeOpLog = log.append(treeOperationLog); + + JungleTreeEditor newEditor = new DefaultJungleTreeEditor(newNode,txManager,editor,newTreeOpLog); + return DefaultEither.newB(newEditor); + } + + @Override + public Either<Error,JungleTreeEditor> replaceNewRootNode() + { + replaceRootNodeAt appendChildAt = new replaceRootNodeAt(); + return _edit(new DefaultNodePath(),appendChildAt); + } + + @Override + public Either<Error,JungleTreeEditor> addNewChildAt(NodePath _path, int _pos) + { + AppendChildAt appendChildAt = new AppendChildAt(_pos); + return _edit(_path,appendChildAt); + } + + @Override + public Either<Error,JungleTreeEditor> deleteChildAt(NodePath _path, int _pos) + { + DeleteChildAt deleteChildAt = new DeleteChildAt(_pos); + return _edit(_path,deleteChildAt); + } + + @Override + public Either<Error,JungleTreeEditor> putAttribute(NodePath _path,String _key,ByteBuffer _value) + { + PutAttribute putAttribute = new PutAttribute(_key,_value); + return _edit(_path,putAttribute); + } + + @Override + public Either<Error,JungleTreeEditor> deleteAttribute(NodePath _path, String _key) + { + DeleteAttribute deleteAttribute = new DeleteAttribute(_key); + return _edit(_path,deleteAttribute); + } + + @Override + public Either<Error, JungleTreeEditor> moveChild(NodePath path,int childNum, String move) { + MoveChild movechild = new MoveChild(move, childNum); + return _edit(path,movechild); + } + + + @Override + public Either<Error,JungleTreeEditor> edit(NodePath _path,NodeEditor _editor) + { + return _edit(_path,_editor); + } + + @Override + public Either<Error,JungleTreeEditor> success() + { + Either<Error,TransactionManager> either = txManager.commit(root,log); + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + + TransactionManager newTxManager = either.b(); + JungleTreeEditor newTreeEditor = new DefaultJungleTreeEditor(root,newTxManager,editor); + + return DefaultEither.newB(newTreeEditor); + } + + @Override + public Either<Error, JungleTreeEditor> flushSuccess() { + return success(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/jungleTreeEditor/JungleTreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,29 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +import java.nio.ByteBuffer; + +public interface JungleTreeEditor { + + public Either<Error, JungleTreeEditor> addNewChildAt(NodePath path, int pos); + + public Either<Error, JungleTreeEditor> deleteChildAt(NodePath path, int pos); + + public Either<Error, JungleTreeEditor> putAttribute(NodePath path, String key, ByteBuffer value); + + public Either<Error, JungleTreeEditor> deleteAttribute(NodePath path, String key); + + public Either<Error, JungleTreeEditor> replaceNewRootNode(); + + public Either<Error, JungleTreeEditor> edit(NodePath path, NodeEditor editor); + + public Either<Error, JungleTreeEditor> success(); + + public Either<Error, JungleTreeEditor> flushSuccess(); + + public Either<Error, JungleTreeEditor> moveChild(NodePath path,int childNum ,String move); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/treeEditor/DefaultDifferenceTreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,24 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Traverser; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +/** + * Created by e115731 on 2016/12/11. + */ +public class DefaultDifferenceTreeEditor implements TreeEditor { + private Traverser traverser; + public DefaultDifferenceTreeEditor(Traverser traverser) { + this. traverser = traverser; + } + + @Override + public Either<Error, LoggingNode> edit(TreeNode root, NodePath path, NodeEditor transformer) { + return null; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/treeEditor/DefaultTreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,81 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor; + + +import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeChildren; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultEvaluator; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Direction; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Traversal; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.Traverser; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +public class DefaultTreeEditor implements TreeEditor +{ + private final Traverser traverser; + public DefaultTreeEditor(Traverser traverser) + { + this.traverser = traverser; + } + + @Override + public Either<Error,LoggingNode> edit(TreeNode root, NodePath path, NodeEditor editor) + { + DefaultEvaluator e = new DefaultEvaluator(path); + Either<Error, Traversal> either = traverser.traverse(root,e); + + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + Traversal t = either.b(); + return clone(t,editor); + } + + private Either<Error,LoggingNode> clone(Traversal t,NodeEditor editor) + { + // copying nodes from bottom to root + + List<Direction<TreeNode>> path = new List<>(); + for(Direction<TreeNode> direction : t){ + path = path.addLast(direction); + } + + // target + Direction<TreeNode> targetDirection = path.head(); + TreeNode target = targetDirection.getTarget(); + Either<Error,LoggingNode> either = editor.edit(target); + if(either.isA()){ + return DefaultEither.newA(either.a()); + } + + LoggingNode newWrap = either.b(); + + // top + int pos = targetDirection.getPosition(); + TreeNode child = newWrap.getWrap(); + + + for(Direction<TreeNode> parentDirection : path.deleteHead()){ + + TreeNodeChildren chs = parentDirection.getTarget().getChildren(); + + Either<Error,TreeNode> ret = chs.replaceNode(pos,child); + if(ret.isA()){ + return DefaultEither.newA(ret.a()); + } + + child = ret.b(); + pos = parentDirection.getPosition(); + } + + TreeNode newRoot = child; + LoggingNode logNode = editor.wrap(newRoot,newWrap.getOperationLog()); + return DefaultEither.newB(logNode); + } + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/treeEditor/TreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,13 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor; + +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +public interface TreeEditor +{ + public Either<Error,LoggingNode> edit(TreeNode root, NodePath path, NodeEditor transformer); +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/traverser/DefaultEvaluator.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/traverser/DefaultEvaluator.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,6 +1,6 @@ package jp.ac.u_ryukyu.ie.cr.jungle.traverser; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/tree/DefaultJungleTree.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,153 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.tree; + +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; +import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; +import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeChildren; +import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.DefaultJungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTransactionManager; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; +import jp.ac.u_ryukyu.ie.cr.jungle.util.GetOldTreeError; + +import java.util.Optional; +import java.util.concurrent.atomic.AtomicReference; + +public class DefaultJungleTree implements JungleTree { + + private final AtomicReference<TreeContext> repository; + private final String uuid; + private final ChangeListWriter writer; + private final TreeEditor treeEditor; + + public DefaultJungleTree(TreeContext tc, String uuid, ChangeListWriter writer, TreeEditor editor) { + this.repository = new AtomicReference<TreeContext>(tc); + this.uuid = uuid; + this.writer = writer; + this.treeEditor = editor; + } + + @Override + public JungleTreeEditor getJungleTreeEditor() { + TreeContext tc = repository.get(); + DefaultTransactionManager txManager = new DefaultTransactionManager(writer, tc, repository, uuid); + TreeNode root = tc.getRoot(); + return new DefaultJungleTreeEditor(root, txManager, treeEditor); + } + + @Override + public JungleTreeEditor getLocalJungleTreeEditor() { + return getJungleTreeEditor(); + } + + @Override + public TreeNode getRootNode() { + TreeContext tc = repository.get(); + return tc.getRoot(); + } + + @Override + public NodePath getNodePath(TreeNode node) { + ParentIndex parentIndex = getParentIndex(); + NodePath path = new DefaultNodePath().pop().right(); + Optional<TreeNode> parentOp = parentIndex.get(node); + while(parentOp.isPresent()) { + TreeNode parent = parentOp.get(); + TreeNodeChildren children = parent.getChildren(); + int num = 0; + for (TreeNode child : children) { + if (child == node) + break; + num++; + } + path = path.addHead(num); + node = parent; + parentOp = parentIndex.get(node); + } + return path.addHead(-1); + } + + AtomicReference<TreeContext> getRepository(){ + return repository; + } + + ChangeListWriter getWriter(){ + return writer; + } + + String getUuid(){ + return uuid; + } + + TreeEditor getTreeEditor(){ + return treeEditor; + } + @Override + public InterfaceTraverser getTraverser(boolean useIndex) { + TreeContext tc = repository.get(); + return tc.getTraverser(); + } + + @Override + public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex() { + TreeContext tc = repository.get(); + return tc.getIndex(); + } + + @Override + public ParentIndex getParentIndex() { + TreeContext tc = repository.get(); + return tc.getParentIndex(); + } + + @Override + public long revision() { + TreeContext tc = repository.get(); + return tc.revision(); + } + + @Override + public Either<Error, JungleTree> getOldTree(long revision) { + TreeContext tc = repository.get(); + + for (; tc.revision() != revision; ) { + tc = tc.prev(); + if (tc == null) + return DefaultEither.newA(GetOldTreeError.OLD_TREE_NOT_FOUND); + } + + + String oldTreeUuid = uuid + revision; + JungleTree oldTree = new DefaultJungleTree(tc, oldTreeUuid, writer, treeEditor); + return DefaultEither.newB(oldTree); + } + + @Override + public Either<Error, TreeNode> getNodeOfPath(NodePath path) { + TreeNode node = repository.get().getRoot(); + for (int num : path) { + if (num == -1) + continue; + Either<Error, TreeNode> either = node.getChildren().at(num); + if (either.isA()) + return either; + node = either.b(); + } + return DefaultEither.newB(node); + } + + @Override + public void setBufferSize(int _bufferSize) { + // not use + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/tree/DefferenceListJungleTree.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,32 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.tree; + + +import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; +import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTransactionManager; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.DefaultDifferenceJungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; + +import java.util.concurrent.atomic.AtomicReference; + +public class DefferenceListJungleTree extends DefaultJungleTree { + public DefferenceListJungleTree(TreeContext tc, String uuid, ChangeListWriter writer, TreeEditor editor) { + super(tc, uuid, writer, editor); + } + + @Override + public JungleTreeEditor getJungleTreeEditor() { + AtomicReference<TreeContext> repository = super.getRepository(); + TreeContext tc = repository.get(); + ChangeListWriter writer = super.getWriter(); + String uuid = super.getUuid(); + TreeEditor treeEditor = super.getTreeEditor(); + DefaultTransactionManager txManager = new DefaultTransactionManager(writer, tc, repository, uuid); + TreeNode root = tc.getRoot(); + return new DefaultDifferenceJungleTreeEditor(root, txManager, treeEditor); + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/tree/JungleTree.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,36 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.tree; + + +import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; +import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; + +public interface JungleTree { + public JungleTreeEditor getJungleTreeEditor(); + + public TreeNode getRootNode(); + + public long revision(); + + public Either<Error, JungleTree> getOldTree(long revision); + + public TreeMap<String, TreeMap<String, List<TreeNode>>> getIndex(); + + public ParentIndex getParentIndex(); + + public InterfaceTraverser getTraverser(boolean useIndex); + + public Either<Error, TreeNode> getNodeOfPath(NodePath path); + + public void setBufferSize(int _bufferSize); + + public NodePath getNodePath(TreeNode node); + + public JungleTreeEditor getLocalJungleTreeEditor(); +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/ReadXmlHandler.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/ReadXmlHandler.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,9 +1,9 @@ package jp.ac.u_ryukyu.ie.cr.jungle.xml.reader; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair; @@ -22,7 +22,7 @@ public ReadXmlHandler(JungleTree tree) { this.tree = tree; - this.editor = tree.getTreeEditor(); + this.editor = tree.getJungleTreeEditor(); this.path = new DefaultNodePath().add(-1); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/XmlReader.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/XmlReader.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,9 +2,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; @@ -14,7 +13,7 @@ public class XmlReader { public static void main(String args[]) { String xmlPath = args[0]; - Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTraverser()); JungleTree tree = jungle.createNewTree("XMLTEST"); new XmlReader().start(xmlPath,tree); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/core/NetworkDefaultJungle.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/core/NetworkDefaultJungle.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,15 +2,15 @@ import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.Journal; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeContext; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; @@ -79,6 +79,17 @@ } @Override + public JungleTree createNewDifferenceTree(String name) { + return null; //未実装 + } + + @Override + public JungleTree createNewDifferenceTree(String name, TreeNode rootNode) { + return null;//未実装 + } + + + @Override public Iterator<String> getTreeNames() { Enumeration<String> treeNames = trees.keys(); return new Iterator<String>() {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/operations/NetworkNodePath.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/operations/NetworkNodePath.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,7 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair; import org.msgpack.annotation.Message;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/operations/NetworkTreeOperation.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/operations/NetworkTreeOperation.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,7 +2,7 @@ import jp.ac.u_ryukyu.ie.cr.jungle.store.Command; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.*; import org.msgpack.annotation.Message;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/operations/NetworkTreeOperationLog.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/operations/NetworkTreeOperationLog.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,8 +1,8 @@ package jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import org.msgpack.annotation.Message;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentChangeList.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentChangeList.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,7 +3,7 @@ import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations.NetworkTreeOperationLog;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentJungle.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentJungle.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,14 +2,14 @@ import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; @@ -77,6 +77,16 @@ } @Override + public JungleTree createNewDifferenceTree(String name) { + return null; //未実装 + } + + @Override + public JungleTree createNewDifferenceTree(String name, TreeNode rootNode) { + return null;//未実装 + } + + @Override public Iterator<String> getTreeNames() { Enumeration<String> treeNames = trees.keys(); return new Iterator<String>() {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentJungleTree.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentJungleTree.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,17 +1,17 @@ package jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent; -import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.DefaultJungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeChildren; import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; @@ -42,7 +42,7 @@ } @Override - public JungleTreeEditor getTreeEditor() { + public JungleTreeEditor getJungleTreeEditor() { TreeContext tc = repository.get(); PersistentTransactionManager txManager = new PersistentTransactionManager(treeName, writer, tc, repository, uuid, bufferSize); TreeNode root = tc.getRoot(); @@ -57,8 +57,8 @@ } @Override - public JungleTreeEditor getLocalTreeEditor() { - return getTreeEditor(); + public JungleTreeEditor getLocalJungleTreeEditor() { + return getJungleTreeEditor(); } @Override
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentJungleTreeEditor.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentJungleTreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,14 +1,14 @@ package jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DefaultTreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentTransactionManager.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/persistent/PersistentTransactionManager.java Tue Dec 13 00:00:18 2016 +0900 @@ -4,8 +4,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.TransactionManager; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/JungleUpdater.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/JungleUpdater.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,9 +1,9 @@ package jp.ac.u_ryukyu.ie.cr.jungleNetwork.transaction; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.Command; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkDefaultJungleTree.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkDefaultJungleTree.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,16 +1,16 @@ package jp.ac.u_ryukyu.ie.cr.jungleNetwork.transaction; -import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.DefaultJungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNodeChildren; import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; @@ -41,7 +41,7 @@ } @Override - public JungleTreeEditor getTreeEditor() + public JungleTreeEditor getJungleTreeEditor() { TreeContext tc = repository.get(); NetworkTransactionManager txManager = new NetworkTransactionManager(treeName, writer,tc,repository,uuid); @@ -50,7 +50,7 @@ } @Override - public JungleTreeEditor getLocalTreeEditor() + public JungleTreeEditor getLocalJungleTreeEditor() { TreeContext tc = repository.get(); NetworkTransactionManager txManager = new NetworkTransactionManager(treeName, writer,tc,repository,uuid);
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkDefaultJungleTreeEditor.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkDefaultJungleTreeEditor.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,14 +2,14 @@ import alice.codesegment.CodeSegment; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.TreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.DefaultTreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.NodeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkTransactionManager.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkTransactionManager.java Tue Dec 13 00:00:18 2016 +0900 @@ -5,7 +5,7 @@ import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListWriter; import jp.ac.u_ryukyu.ie.cr.jungle.store.TreeContext; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.TreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.operations.TreeOperation; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeContext; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.TransactionManager;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transformer/NetworkAppendChildAt.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transformer/NetworkAppendChildAt.java Tue Dec 13 00:00:18 2016 +0900 @@ -6,8 +6,8 @@ */ import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.OperationLog; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.OperationLog; import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.NodeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either;
--- a/src/test/java/DefaultJungleTreeTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/DefaultJungleTreeTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,21 +1,20 @@ -import java.nio.ByteBuffer; - import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import junit.framework.Assert; import junit.framework.TestCase; +import java.nio.ByteBuffer; + public class DefaultJungleTreeTest extends TestCase { public Jungle instance() { - Jungle j = new DefaultJungle(null, "hogehoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle j = new DefaultJungle(null, "hogehoge", new DefaultTraverser()); return j; } @@ -27,8 +26,8 @@ j.createNewTree("tree"); JungleTree tree = j.getTreeByName("tree"); Assert.assertEquals(0, tree.revision()); - JungleTreeEditor editor1 = tree.getTreeEditor(); - JungleTreeEditor editor2 = tree.getTreeEditor(); + JungleTreeEditor editor1 = tree.getJungleTreeEditor(); + JungleTreeEditor editor2 = tree.getJungleTreeEditor(); DefaultNodePath root = new DefaultNodePath();
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/GetNodeOfPathTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/GetNodeOfPathTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,13 +2,12 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import junit.framework.Assert; import org.junit.Test; @@ -19,10 +18,10 @@ @Test public void getNodeOfPathTest() { - Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTraverser()); jungle.createNewTree("tree"); JungleTree tree = jungle.getTreeByName("tree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); DefaultNodePath path = new DefaultNodePath(); editor = editor.addNewChildAt(path, 0).b(); path = path.add(0);
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/GetOldTreeTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/GetOldTreeTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,30 +1,28 @@ package jp.ac.u_ryukyu.ie.cr.jungle.core; -import java.nio.ByteBuffer; - import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; +import junit.framework.Assert; import org.junit.Test; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import junit.framework.Assert; +import java.nio.ByteBuffer; public class GetOldTreeTest { @Test public void getOldTreeTest() { - Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTraverser()); jungle.createNewTree("tree"); JungleTree tree = jungle.getTreeByName("tree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); DefaultNodePath path = new DefaultNodePath(); for (int num = 0; num < 10; num++) {
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,9 +1,9 @@ package jp.ac.u_ryukyu.ie.cr.jungle.core.impl.treeeditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.AppendChildAt; import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.PutAttribute; import jp.ac.u_ryukyu.ie.cr.jungle.tests.util.TestUtil;
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/AppendChildAtTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/AppendChildAtTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -4,7 +4,7 @@ import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.AppendChildAt; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import junit.framework.Assert;
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/DeleteAttributeAtTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/DeleteAttributeAtTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,7 +3,7 @@ import java.nio.ByteBuffer; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.DeleteAttribute; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either;
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/DeleteChildAtTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/DeleteChildAtTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,7 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.jungle.core.nodeeditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.DeleteChildAt; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either;
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/PutAttributeTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/PutAttributeTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,7 +3,7 @@ import java.nio.ByteBuffer; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.logger.LoggingNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.logger.LoggingNode; import jp.ac.u_ryukyu.ie.cr.jungle.store.trasnformer.PutAttribute; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either;
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/ReplaceRootNodeAt.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/nodeeditor/ReplaceRootNodeAt.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,25 +2,23 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import junit.framework.Assert; - import org.junit.Test; public class ReplaceRootNodeAt { @Test public void ReplaceRootNodeAtTest() { - Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hogehoge",new DefaultTraverser()); jungle.createNewTree("tree"); JungleTree tree = jungle.getTreeByName("tree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); TreeNode oldRoot = tree.getRootNode(); Either<Error, JungleTreeEditor> either = editor.replaceNewRootNode();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/tree/DefferenceTree.java Tue Dec 13 00:00:18 2016 +0900 @@ -0,0 +1,24 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.core.tree; + +import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; +import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import org.junit.Test; + +/** + * Created by e115731 on 2016/12/12. + */ +public class DefferenceTree { + @Test + public void DefferenceTreeTest(){ + Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTraverser()); + JungleTree tree = jungle.createNewDifferenceTree("df"); + JungleTreeEditor editor = tree.getJungleTreeEditor(); + NodePath path = new DefaultNodePath(-2); + editor = editor.addNewChildAt(path,0).b(); + } +}
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/impl/node/GetNodePath.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/impl/node/GetNodePath.java Tue Dec 13 00:00:18 2016 +0900 @@ -3,16 +3,15 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; -import jp.ac.u_ryukyu.ie.cr.jungle.util.*; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import junit.framework.Assert; import org.junit.Test; @@ -22,10 +21,10 @@ public class GetNodePath { @Test public void getNodePathTest(){ - Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hogehoge",new DefaultTraverser()); jungle.createNewTree("tree"); JungleTree tree = jungle.getTreeByName("tree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); editor = createTree(editor,0,3,new DefaultNodePath());
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/index/parentIndexTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/index/parentIndexTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,15 +2,14 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.store.index.ParentIndex; import junit.framework.Assert; import org.junit.Test; @@ -22,10 +21,10 @@ public class parentIndexTest { @Test public void parentIndex() { - Jungle jungle = new DefaultJungle(null, "hogehoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(null, "hogehoge",new DefaultTraverser()); jungle.createNewTree("tree"); JungleTree tree = jungle.getTreeByName("tree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); DefaultNodePath path = new DefaultNodePath(); for (int count = 0; count < 100; count++) {
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/tests/util/TestUtil.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/tests/util/TestUtil.java Tue Dec 13 00:00:18 2016 +0900 @@ -4,8 +4,8 @@ import org.junit.Ignore; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either;
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/traverse/InterfaceTraverserTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/traverse/InterfaceTraverserTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,16 +2,15 @@ import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.NullJournal; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.InterfaceTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; import junit.framework.Assert; @@ -26,10 +25,10 @@ public class InterfaceTraverserTest { @Test public void InterfaseTraverserTest() { - Jungle jungle = new DefaultJungle(new NullJournal(), "hoge", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle = new DefaultJungle(new NullJournal(), "hoge", new DefaultTraverser()); jungle.createNewTree("TestTree"); JungleTree tree = jungle.getTreeByName("TestTree"); - JungleTreeEditor editor = tree.getTreeEditor(); + JungleTreeEditor editor = tree.getJungleTreeEditor(); editor = createTree(editor, 0, 3, new DefaultNodePath()); Either<Error, JungleTreeEditor> either = editor.success(); if (either.isA())
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/traverse/TraverserTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/traverse/TraverserTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -2,8 +2,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.*;
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/junglenetwork/DataWriteBufferTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/junglenetwork/DataWriteBufferTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,13 +1,13 @@ package jp.ac.u_ryukyu.ie.cr.junglenetwork; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.core.Children; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListReader; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; @@ -36,7 +36,7 @@ jungle.createNewTree("hoge"); JungleTree tree1 = jungle.getTreeByName("hoge"); tree1.setBufferSize(10); - JungleTreeEditor editor = tree1.getTreeEditor(); + JungleTreeEditor editor = tree1.getJungleTreeEditor(); NetworkNodePath path = new NetworkNodePath(); Either<Error, JungleTreeEditor> either = editor.addNewChildAt(path, pos); NodePath childPath = path.add(pos); @@ -55,7 +55,7 @@ Assert.assertFalse(iterator.hasNext()); for (int count = 0; count < 9; count++) { - editor = tree1.getTreeEditor(); + editor = tree1.getJungleTreeEditor(); either = editor.addNewChildAt(path, pos); childPath = path.add(pos); Assert.assertFalse(either.isA()); @@ -65,7 +65,7 @@ either = editor2.success(); Assert.assertFalse(either.isA()); } - editor = tree1.getTreeEditor(); + editor = tree1.getJungleTreeEditor(); either = editor.flushSuccess(); Assert.assertFalse(either.isA()); @@ -80,7 +80,7 @@ if (tree2 == null) { tree2 = jungle2.createNewTree(treeName); } - editor2 = tree2.getTreeEditor(); + editor2 = tree2.getJungleTreeEditor(); Either<Error, JungleTreeEditor> either2 = JungleUpdater.edit(editor2, chList); Assert.assertFalse(either2.isA()); editor2 = either2.b();
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/junglenetwork/PersistentJournalTest.java Wed Nov 30 19:47:47 2016 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/junglenetwork/PersistentJournalTest.java Tue Dec 13 00:00:18 2016 +0900 @@ -1,13 +1,13 @@ package jp.ac.u_ryukyu.ie.cr.junglenetwork; import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.tree.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.core.Children; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListReader; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.store.nodepath.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.treeEditor.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; @@ -29,7 +29,7 @@ Jungle jungle = new PersistentJungle(journal1, "uuid",new DefaultTreeEditor(new DefaultTraverser())); jungle.createNewTree("hoge"); JungleTree tree1 = jungle.getTreeByName("hoge"); - JungleTreeEditor editor = tree1.getTreeEditor(); + JungleTreeEditor editor = tree1.getJungleTreeEditor(); NetworkNodePath path = new NetworkNodePath(); String key = "key"; ByteBuffer value = ByteBuffer.wrap("value".getBytes()); @@ -54,7 +54,7 @@ if(tree2 == null) { tree2 = jungle2.createNewTree(treeName); } - JungleTreeEditor editor2 = tree2.getTreeEditor(); + JungleTreeEditor editor2 = tree2.getJungleTreeEditor(); Either<Error, JungleTreeEditor> either2 = JungleUpdater.edit(editor2, chList); assertFalse(either2.isA()); editor2 = either2.b();