Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 268:7b81ce1d6f10 Implementation_of_communication
tmp
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultTreeContext.java Tue Dec 13 18:23:49 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultTreeContext.java Tue Dec 13 20:30:01 2016 +0900 @@ -37,7 +37,7 @@ @Override public TreeNode getUnDefineNode(){ - return null; // no use + return null; // not use } @Override
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DifferenceTreeContext.java Tue Dec 13 18:23:49 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DifferenceTreeContext.java Tue Dec 13 20:30:01 2016 +0900 @@ -14,13 +14,14 @@ */ public class DifferenceTreeContext implements TreeContext { private final TreeNode root; + private final TreeNode unDefineNode; private final TreeContext previous; private final ChangeList changeList; private final String uuid; private final String treeName; private final long revision; private final InterfaceTraverser traverser; - private final TreeNode unDefineNode; + public DifferenceTreeContext(TreeNode root, TreeNode unDefineNode, TreeContext _prev, ChangeList _log, String _uuid, String _treeName, long _revision, InterfaceTraverser traverser) { this.root = root;
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/treeEditor/DifferenceTreeEditor.java Tue Dec 13 18:23:49 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/editor/treeEditor/DifferenceTreeEditor.java Tue Dec 13 20:30:01 2016 +0900 @@ -11,9 +11,6 @@ import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error.Error; -/** - * Created by e115731 on 2016/12/11. - */ public class DifferenceTreeEditor implements TreeEditor { private Traverser traverser; @@ -33,11 +30,10 @@ if (traverseEither.isA()) { return DefaultEither.newA(traverseEither.a()); } - Traversal traversal = traverseEither.b(); TreeNode target = traversal.destination(); Either<Error, LoggingNode> either = editor.edit(target); - if (!target.isDefine()) + if (!target.status()) return either; if (either.isA()) { return DefaultEither.newA(either.a()); @@ -47,18 +43,17 @@ return clone(traversal, newWrap, editor); } - private Either<Error, LoggingNode> clone(Traversal t, LoggingNode newWrap, NodeEditor editor) { + private Either<Error, LoggingNode> clone(Traversal traversal, LoggingNode newWrap, NodeEditor editor) { // copying nodes from bottom to root - List<Direction<TreeNode>> path = new List<>(); - for (Direction<TreeNode> direction : t) { + for (Direction<TreeNode> direction : traversal) { path = path.addLast(direction); } - // top + Direction<TreeNode> editedNodeDirection = path.head(); - Direction<TreeNode> targetDirection = path.head(); - int pos = targetDirection.getPosition(); + // top + int pos = editedNodeDirection.getPosition(); TreeNode child = newWrap.getWrap(); for (Direction<TreeNode> parentDirection : path.deleteHead()) {
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/DefaultTreeNode.java Tue Dec 13 18:23:49 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/DefaultTreeNode.java Tue Dec 13 20:30:01 2016 +0900 @@ -2,17 +2,15 @@ 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.util.Either; import jp.ac.u_ryukyu.ie.cr.jungle.util.Error.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; import java.nio.ByteBuffer; -import java.rmi.dgc.VMID; public class DefaultTreeNode implements TreeNode { private List<TreeNode> children; private TreeMap<String, ByteBuffer> attrs; - final String nodeId = new VMID().toString(); private static final List<TreeNode> NIL_LIST = new List<>(); @@ -36,7 +34,7 @@ } @Override - public boolean isDefine() { + public boolean status() { return true; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/TreeNode.java Tue Dec 13 18:23:49 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/TreeNode.java Tue Dec 13 20:30:01 2016 +0900 @@ -9,7 +9,7 @@ public TreeNodeAttributes getAttributes(); - public boolean isDefine(); + public NodeType status(); public TreeNode createNewNode();
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/UnDefineNode.java Tue Dec 13 18:23:49 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/UnDefineNode.java Tue Dec 13 20:30:01 2016 +0900 @@ -38,7 +38,7 @@ } @Override - public boolean isDefine() { + public boolean status() { return false; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/traverser/LastNodeEvaluator.java Tue Dec 13 18:23:49 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/traverser/LastNodeEvaluator.java Tue Dec 13 20:30:01 2016 +0900 @@ -13,7 +13,7 @@ @Override public Evaluation evaluate(TreeNode _current, int _pos) { - if (!_current.isDefine()) + if (!_current.status()) return new DefaultEvaluation(Result.GOAL, null); Result result = Result.ACCEPT;