public class QMessages
extends java.lang.Object
QOAgent
,
QCommunication
Modifier and Type | Field and Description |
---|---|
static int |
ACCEPT |
static int |
COMMENT |
static int |
COUNTER_OFFER |
static int |
MESSAGE_RECEIVED |
static int |
MESSAGE_REJECTED |
static int |
OFFER |
static int |
OPT_OUT |
static int |
PROMISE |
static int |
QUERY |
static int |
REGISTER |
static int |
REJECT |
static int |
THREAT |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
formatMessage(int nMessageKind,
java.lang.String sMsgBody)
Formats the message in the predefined structure for sending it
later to the server
|
java.lang.String |
parseMessage(java.lang.String sServerLine)
Parses messages from the server.
|
public static final int MESSAGE_RECEIVED
public static final int MESSAGE_REJECTED
public static final int REGISTER
public static final int THREAT
public static final int COMMENT
public static final int OFFER
public static final int PROMISE
public static final int QUERY
public static final int ACCEPT
public static final int REJECT
public static final int OPT_OUT
public static final int COUNTER_OFFER
public QMessages(QOAgent agent)
agent
- - saves the QOAgent in the member variablepublic java.lang.String formatMessage(int nMessageKind, java.lang.String sMsgBody)
nMessageKind
- - the message kind. Can be either:
REGISTER, THREAT, COMMENT, OFFER, PROMISE, QUERY, ACCEPT, REJECT, OPT_OUT, COUNTER_OFFER.sMsgBody
- - the message body: additional data for creating the message.
sMsgBody differs for the different message typesQOAgent
,
QCommunication
public java.lang.String parseMessage(java.lang.String sServerLine)
sServerLine
- - the server's messageQOAgent
,
QCommunication