public class PingPongPacket extends ProtocolPacket<java.lang.Integer,PingPongPacket.PacketType>
Modifier and Type | Class and Description |
---|---|
static class |
PingPongPacket.PacketType
Packet type used by PingPong example.
|
ProtocolPacket.Keys
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COUNTER |
java.lang.String |
field1 |
static java.lang.String |
FIELD1 |
static Stringifiable<java.lang.Integer> |
unstringer |
type
Constructor and Description |
---|
PingPongPacket(int initiator,
PingPongPacket.PacketType t) |
PingPongPacket(org.json.JSONObject json) |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
flip(int rcvr) |
int |
getCounter() |
java.lang.Object |
getMessage() |
PingPongPacket.PacketType |
getPacketType(org.json.JSONObject json) |
void |
incrCounter() |
void |
putPacketType(org.json.JSONObject json,
PingPongPacket.PacketType type) |
org.json.JSONObject |
toJSONObjectImpl() |
flip, getInitiator, getKey, getSender, getType, setKey, setSender, setType, toJSONObject, toString
public static final java.lang.String FIELD1
public static final java.lang.String COUNTER
public static final Stringifiable<java.lang.Integer> unstringer
public final java.lang.String field1
public PingPongPacket(int initiator, PingPongPacket.PacketType t)
public PingPongPacket(org.json.JSONObject json) throws org.json.JSONException
org.json.JSONException
public void incrCounter()
public int getCounter()
public java.lang.Integer flip(int rcvr)
public org.json.JSONObject toJSONObjectImpl() throws org.json.JSONException
toJSONObjectImpl
in class ProtocolPacket<java.lang.Integer,PingPongPacket.PacketType>
org.json.JSONException
public java.lang.Object getMessage()
getMessage
in interface ProtocolEvent<PingPongPacket.PacketType,java.lang.String>
getMessage
in class ProtocolPacket<java.lang.Integer,PingPongPacket.PacketType>
public PingPongPacket.PacketType getPacketType(org.json.JSONObject json) throws org.json.JSONException
getPacketType
in class ProtocolPacket<java.lang.Integer,PingPongPacket.PacketType>
org.json.JSONException
public void putPacketType(org.json.JSONObject json, PingPongPacket.PacketType type) throws org.json.JSONException
putPacketType
in class ProtocolPacket<java.lang.Integer,PingPongPacket.PacketType>
org.json.JSONException