Mercurial > hg > Members > nobuyasu > jungle-network
comparison src/main/java/alice/jungle/operations/NetworkTreeOperation.java @ 105:f9e29a52efd3
Move some files
author | one |
---|---|
date | Tue, 26 Nov 2013 06:43:10 +0900 |
parents | src/alice/jungle/operations/NetworkTreeOperation.java@b9dd8ec0e66e |
children |
comparison
equal
deleted
inserted
replaced
104:03bf62bb699e | 105:f9e29a52efd3 |
---|---|
1 package alice.jungle.operations; | |
2 | |
3 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; | |
4 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; | |
5 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.AppendChildAtOperation; | |
6 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteAttributeOperation; | |
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteChildAtOperation; | |
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; | |
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; | |
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; | |
11 | |
12 import org.msgpack.annotation.Message; | |
13 | |
14 @Message | |
15 public class NetworkTreeOperation implements TreeOperation { | |
16 | |
17 public NetworkNodePath path; | |
18 public NetworkNodeOperation operation; | |
19 | |
20 public NetworkTreeOperation() { | |
21 path = null; | |
22 operation = null; | |
23 } | |
24 | |
25 public NetworkTreeOperation(TreeOperation treeOp) { | |
26 path = new NetworkNodePath(treeOp.getNodePath()); | |
27 operation = new NetworkNodeOperation(treeOp.getNodeOperation()); | |
28 } | |
29 | |
30 public NetworkTreeOperation(NodePath _p, NodeOperation _op) { | |
31 path = new NetworkNodePath(_p); | |
32 operation = new NetworkNodeOperation(_op); | |
33 } | |
34 | |
35 public NetworkTreeOperation(NetworkNodePath _p, NodeOperation _op) { | |
36 path = _p; | |
37 operation = new NetworkNodeOperation(_op); | |
38 } | |
39 | |
40 public NetworkTreeOperation(NodePath _p, NetworkNodeOperation _op) { | |
41 path = new NetworkNodePath(_p); | |
42 operation = _op; | |
43 } | |
44 | |
45 public NetworkTreeOperation(NetworkNodePath _p, NetworkNodeOperation _op) { | |
46 path = _p; | |
47 operation = _op; | |
48 } | |
49 | |
50 @Override | |
51 public NodePath getNodePath() { | |
52 return path; | |
53 } | |
54 | |
55 @Override | |
56 public NodeOperation getNodeOperation() { | |
57 Command c = operation.getCommand(); | |
58 switch(c) { | |
59 case PUT_ATTRIBUTE: | |
60 return new PutAttributeOperation(operation.getKey(), operation.getValue()); | |
61 case APPEND_CHILD: | |
62 return new AppendChildAtOperation(operation.getPosition()); | |
63 case DELETE_CHILD: | |
64 return new DeleteChildAtOperation(operation.getPosition()); | |
65 case DELETE_ATTRIBUTE: | |
66 return new DeleteAttributeOperation(operation.getKey()); | |
67 default: | |
68 break; | |
69 } | |
70 return null; | |
71 } | |
72 | |
73 } |