Mercurial > hg > Members > nobuyasu > jungle-network
comparison src/alice/jungle/operations/NetworkAppendChildAtOperation.java @ 71:f1aef52c0611
Added NetworkAppendChildAtTest
author | one |
---|---|
date | Fri, 11 Oct 2013 18:24:46 +0900 |
parents | |
children | 9e3198bf9547 |
comparison
equal
deleted
inserted
replaced
70:892bac9ac118 | 71:f1aef52c0611 |
---|---|
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 | |
11 import org.msgpack.annotation.Message; | |
12 | |
13 import alice.jungle.datasegment.store.transformer.NetworkAppendChildAt; | |
14 | |
15 | |
16 @Message | |
17 public class NetworkAppendChildAtOperation implements NodeOperation { | |
18 | |
19 // private final int pos; | |
20 /* MessagePack can not handle final.*/ | |
21 private int pos; | |
22 | |
23 /* Position -1 represent root position. */ | |
24 public NetworkAppendChildAtOperation() { pos = -2; } | |
25 | |
26 public NetworkAppendChildAtOperation(int _pos) { | |
27 pos = _pos; | |
28 } | |
29 | |
30 @Override | |
31 public Command getCommand() { | |
32 return Command.APPEND_CHILD; | |
33 } | |
34 | |
35 @Override | |
36 public <T extends EditableNode<T>> Either<Error, T> invoke(T _target) { | |
37 NetworkAppendChildAt appendChildAt = new NetworkAppendChildAt(pos); | |
38 return appendChildAt.edit(_target); | |
39 } | |
40 | |
41 @Override | |
42 public int getPosition() { | |
43 return pos; | |
44 } | |
45 | |
46 @Override | |
47 public String getKey() { | |
48 return null; | |
49 } | |
50 | |
51 @Override | |
52 public ByteBuffer getValue() { | |
53 return null; | |
54 } | |
55 } |