73
|
1 package alice.jungle.operations;
|
|
2
|
|
3 import java.nio.ByteBuffer;
|
|
4
|
|
5 import org.msgpack.annotation.Message;
|
|
6
|
|
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command;
|
180
|
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode;
|
73
|
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation;
|
|
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.DeleteChildAt;
|
|
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
|
|
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
|
|
13
|
|
14 @Message
|
|
15 public class NetworkDeleteChildAtOperation implements NodeOperation
|
|
16 {
|
76
|
17 /* MessagePack cannot handle final.*/
|
73
|
18 //private final int pos;
|
|
19 private int pos;
|
|
20
|
|
21
|
109
|
22 public NetworkDeleteChildAtOperation() {}
|
|
23
|
73
|
24 /* Position -1 represent root position. */
|
|
25 public NetworkDeleteChildAtOperation(int _pos)
|
|
26 {
|
|
27 pos = _pos;
|
|
28 }
|
|
29
|
|
30 @Override
|
|
31 public Command getCommand()
|
|
32 {
|
|
33 return Command.DELETE_CHILD;
|
|
34 }
|
|
35
|
180
|
36 @Override
|
|
37 public Either<Error, TreeNode> invoke(TreeNode _target)
|
73
|
38 {
|
180
|
39 return _target.getChildren().deleteChildAt(pos);
|
|
40 }
|
73
|
41
|
|
42 @Override
|
|
43 public int getPosition()
|
|
44 {
|
|
45 return pos;
|
|
46 }
|
|
47
|
|
48 @Override
|
|
49 public String getKey()
|
|
50 {
|
|
51 return null;
|
|
52 }
|
|
53
|
|
54 @Override
|
|
55 public ByteBuffer getValue()
|
|
56 {
|
|
57 return null;
|
|
58 }
|
|
59 }
|