view src/alice/jungle/operations/NetworkNodeOperation.java @ 77:2dba7e1cf9fa

Added NetworknodeOperation and Test
author one
date Tue, 15 Oct 2013 16:01:11 +0900
parents
children 0055d917c796
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.operations.NodeOperation;

import org.msgpack.annotation.Message;


@Message
public class NetworkNodeOperation {

	public int pos;
	public String key = null;
	public ByteBuffer value = null;
	public Command command = null;

	public NetworkNodeOperation() {
		pos = -2;
	}
	
	public NetworkNodeOperation(NodeOperation _op) {
		pos = _op.getPosition();
		key = _op.getKey();
		value = _op.getValue();
		command= _op.getCommand();
		
	}
	
	public NetworkNodeOperation(int _pos, Command _command) {
		pos = _pos;
		command = _command;
	}
	
	public NetworkNodeOperation(String _key, Command _command) {
		key = _key;
		command = _command;
	}
	
	public NetworkNodeOperation(String _key, ByteBuffer _value, Command _command) {
		key = _key;
		value = _value;
		command = _command;
	}

	public NetworkNodeOperation(Command _command) {
		command = _command;
	}
	
	public int getPosition() {
		return pos;
	}
	
	public String getKey() {
		return key;
	}
	
	public ByteBuffer getValue() {
		return value;
	}

	public Command getCommand() {
		return command;
	}
}