Mercurial > hg > Members > nobuyasu > jungle-network
view src/main/java/alice/jungle/operations/NetworkAppendChildAtOperation.java @ 195:82698be06c6c default tip
change index TreeMap
author | tatsuki |
---|---|
date | Tue, 28 Apr 2015 07:51:41 +0900 |
parents | 2828205bdc3a |
children |
line wrap: on
line source
package alice.jungle.operations; import java.nio.ByteBuffer; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import org.msgpack.annotation.Message; @Message public class NetworkAppendChildAtOperation implements NodeOperation { /* MessagePack cannot handle final.*/ // private final int pos; private int pos; /* Position -1 represent root position. */ public NetworkAppendChildAtOperation() { pos = -2; } public NetworkAppendChildAtOperation(int _pos) { pos = _pos; } public Command getCommand() { return Command.APPEND_CHILD; } @Override public Either<Error,TreeNode> invoke(TreeNode _target) { return _target.getChildren().addNewChildAt(pos); } @Override public int getPosition() { return pos; } @Override public String getKey() { return null; } @Override public ByteBuffer getValue() { return null; } }