71
|
1 package alice.jungle.operations;
|
|
2
|
|
3 import java.nio.ByteBuffer;
|
|
4
|
|
5 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command;
|
|
6 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation;
|
|
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode;
|
|
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
|
|
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
|
105
|
10 import alice.jungle.datasegment.transformer.NetworkAppendChildAt;
|
71
|
11
|
|
12 import org.msgpack.annotation.Message;
|
|
13
|
|
14
|
|
15 @Message
|
|
16 public class NetworkAppendChildAtOperation implements NodeOperation {
|
|
17
|
78
|
18 /* MessagePack cannot handle final.*/
|
71
|
19 // private final int pos;
|
|
20 private int pos;
|
|
21
|
|
22 /* Position -1 represent root position. */
|
|
23 public NetworkAppendChildAtOperation() { pos = -2; }
|
|
24
|
|
25 public NetworkAppendChildAtOperation(int _pos) {
|
|
26 pos = _pos;
|
|
27 }
|
|
28
|
|
29 @Override
|
|
30 public Command getCommand() {
|
|
31 return Command.APPEND_CHILD;
|
|
32 }
|
|
33
|
|
34 @Override
|
|
35 public <T extends EditableNode<T>> Either<Error, T> invoke(T _target) {
|
|
36 NetworkAppendChildAt appendChildAt = new NetworkAppendChildAt(pos);
|
|
37 return appendChildAt.edit(_target);
|
|
38 }
|
|
39
|
|
40 @Override
|
|
41 public int getPosition() {
|
|
42 return pos;
|
|
43 }
|
|
44
|
|
45 @Override
|
|
46 public String getKey() {
|
|
47 return null;
|
|
48 }
|
|
49
|
|
50 @Override
|
|
51 public ByteBuffer getValue() {
|
|
52 return null;
|
|
53 }
|
|
54 }
|