# HG changeset patch # User one # Date 1381820016 -32400 # Node ID 9e3198bf954727b568493475e7f7760dc2b8bfb9 # Parent 87ec5dd0dc2707b5c3796f4ca716acfe9aea2d66 Modified NetworkNodePath diff -r 87ec5dd0dc27 -r 9e3198bf9547 src/alice/jungle/operations/NetworkAppendChildAtOperation.java --- a/src/alice/jungle/operations/NetworkAppendChildAtOperation.java Tue Oct 15 14:43:29 2013 +0900 +++ b/src/alice/jungle/operations/NetworkAppendChildAtOperation.java Tue Oct 15 15:53:36 2013 +0900 @@ -17,7 +17,7 @@ public class NetworkAppendChildAtOperation implements NodeOperation { // private final int pos; - /* MessagePack can not handle final.*/ + /* MessagePack cannot handle final.*/ private int pos; /* Position -1 represent root position. */ diff -r 87ec5dd0dc27 -r 9e3198bf9547 src/alice/jungle/operations/NetworkDeleteAttributeOperation.java --- a/src/alice/jungle/operations/NetworkDeleteAttributeOperation.java Tue Oct 15 14:43:29 2013 +0900 +++ b/src/alice/jungle/operations/NetworkDeleteAttributeOperation.java Tue Oct 15 15:53:36 2013 +0900 @@ -14,6 +14,7 @@ @Message public class NetworkDeleteAttributeOperation implements NodeOperation { + /* MessagePack cannot handle final.*/ //private final String key; private String key; diff -r 87ec5dd0dc27 -r 9e3198bf9547 src/alice/jungle/operations/NetworkDeleteChildAtOperation.java --- a/src/alice/jungle/operations/NetworkDeleteChildAtOperation.java Tue Oct 15 14:43:29 2013 +0900 +++ b/src/alice/jungle/operations/NetworkDeleteChildAtOperation.java Tue Oct 15 15:53:36 2013 +0900 @@ -14,8 +14,8 @@ @Message public class NetworkDeleteChildAtOperation implements NodeOperation { + /* MessagePack cannot handle final.*/ //private final int pos; - /* MessagePack can not handle final.*/ private int pos; diff -r 87ec5dd0dc27 -r 9e3198bf9547 src/alice/jungle/operations/NetworkNodePath.java --- a/src/alice/jungle/operations/NetworkNodePath.java Tue Oct 15 14:43:29 2013 +0900 +++ b/src/alice/jungle/operations/NetworkNodePath.java Tue Oct 15 15:53:36 2013 +0900 @@ -31,6 +31,13 @@ path = new LinkedList(); } + public NetworkNodePath(NodePath _p) { + path = new LinkedList(); + for(Integer pos: _p) { + path.add(pos); + } + } + private NetworkNodePath(LinkedList _path) { path = _path; } diff -r 87ec5dd0dc27 -r 9e3198bf9547 src/alice/jungle/operations/NetworkPutAttributeOperation.java --- a/src/alice/jungle/operations/NetworkPutAttributeOperation.java Tue Oct 15 14:43:29 2013 +0900 +++ b/src/alice/jungle/operations/NetworkPutAttributeOperation.java Tue Oct 15 15:53:36 2013 +0900 @@ -13,6 +13,7 @@ @Message public class NetworkPutAttributeOperation implements NodeOperation { + /* MessagePack cannot handle final.*/ /* * private final String key; * private final ByteBuffer value; diff -r 87ec5dd0dc27 -r 9e3198bf9547 src/alice/jungle/operations/NetworkTreeOperation.java --- a/src/alice/jungle/operations/NetworkTreeOperation.java Tue Oct 15 14:43:29 2013 +0900 +++ b/src/alice/jungle/operations/NetworkTreeOperation.java Tue Oct 15 15:53:36 2013 +0900 @@ -1,7 +1,12 @@ package alice.jungle.operations; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.AppendChildAtOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteAttributeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteChildAtOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; import org.msgpack.annotation.Message; @@ -9,8 +14,8 @@ @Message public class NetworkTreeOperation implements TreeOperation { - public NodePath path; - public NodeOperation operation; + public NetworkNodePath path; + public NetworkNodeOperation operation; public NetworkTreeOperation() { path = null; @@ -18,18 +23,37 @@ } public NetworkTreeOperation(NodePath _p, NodeOperation _op) { + path = new NetworkNodePath(_p); + operation = new NetworkNodeOperation(_op); + } + + public NetworkTreeOperation(NetworkNodePath _p, NodeOperation _op) { + path = _p; + operation = new NetworkNodeOperation(_op); + } + + public NetworkTreeOperation(NetworkNodePath _p, NetworkNodeOperation _op) { path = _p; operation = _op; } - - @Override + @Override public NodePath getNodePath() { return path; } @Override public NodeOperation getNodeOperation() { - return operation; + Command c = operation.getCommand(); + if (c == Command.PUT_ATTRIBUTE) { + return new PutAttributeOperation(operation.getKey(), operation.getValue()); + } else if (c == Command.APPEND_CHILD) { + return new AppendChildAtOperation(operation.getPosition()); + } else if (c == Command.DELETE_CHILD) { + return new DeleteChildAtOperation(operation.getPosition()); + } else if (c == Command.DELETE_ATTRIBUTE){ + return new DeleteAttributeOperation(operation.getKey()); + } + return null; } }