Mercurial > hg > Members > nobuyasu > jungle-network
comparison src/main/java/alice/jungle/operations/NetworkAppendChildAtOperation.java @ 105:f9e29a52efd3
Move some files
author | one |
---|---|
date | Tue, 26 Nov 2013 06:43:10 +0900 |
parents | src/alice/jungle/operations/NetworkAppendChildAtOperation.java@0055d917c796 |
children | 6f104ab4eb81 |
comparison
equal
deleted
inserted
replaced
104:03bf62bb699e | 105:f9e29a52efd3 |
---|---|
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; | |
10 import alice.jungle.datasegment.transformer.NetworkAppendChildAt; | |
11 | |
12 import org.msgpack.annotation.Message; | |
13 | |
14 | |
15 @Message | |
16 public class NetworkAppendChildAtOperation implements NodeOperation { | |
17 | |
18 /* MessagePack cannot handle final.*/ | |
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 } |