|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.pogamut.Parser.Parser
public class Parser
Gets messages (String) from GameBot translating them via Yylex into MessageObject, doing DeltaCompression and passing them out. Also may be used to send messages to GB. Is configured by GameBotConnection which must be already connected to GameBot!
Field Summary | |
---|---|
private java.util.Queue<MessageObject> |
bufferToSend
Buffer of messages we have to send to the client ... |
private java.util.Set<java.lang.Integer> |
currentBatch
Current batch of messages from GB. |
private java.util.HashMap<java.lang.Integer,MessageObject> |
dbInt2Msg
Map for storing MessageObjects with hasID() true - ITEMS, NAVS, MOVERS... = basically objects |
boolean |
dontDiff
Should Parser create batches and do diffs? |
private GameBotConnection |
gb
|
private java.util.Set<java.lang.Integer> |
lastBatch
Last batch of messages from GB. |
Yylex |
lex
Lexical engine for recognizing GameBot messages. |
private java.util.logging.Logger |
log
|
protected boolean |
pushIntoBatch
Flag which tells us whether we have to put the message int batch, needed for processing initial nav points / items from the map. |
private TranslateUnrealID2IntID |
unrealID
|
Constructor Summary | |
---|---|
Parser(GameBotConnection gb,
TranslateUnrealID2IntID unrealID,
java.util.logging.Logger log)
|
Method Summary | |
---|---|
void |
closeGB()
Close the connection to the GameBots, if any exists. |
void |
closeParser()
Close the connection to the parser (if any exists). |
private MessageObject |
diffMessage(MessageObject msg)
Creates DELTA MESSAGE out of msg and writes new informations into dbInt2Msg message object |
private MessageObject |
getMessageFromYylex()
|
private void |
handleEndMessage()
Push some messages to bufferToSend if they should be removed from current batch of the client. |
MessageObject |
receiveParsedMessage()
May block. |
void |
sendMessageToGB(java.lang.String msg)
Sends data through GameBotConnection. |
int |
translateUnrealID2IntID(java.lang.String unrealId)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private GameBotConnection gb
private TranslateUnrealID2IntID unrealID
private java.util.logging.Logger log
public Yylex lex
private java.util.HashMap<java.lang.Integer,MessageObject> dbInt2Msg
private java.util.Set<java.lang.Integer> lastBatch
private java.util.Set<java.lang.Integer> currentBatch
private java.util.Queue<MessageObject> bufferToSend
protected boolean pushIntoBatch
public boolean dontDiff
Constructor Detail |
---|
public Parser(GameBotConnection gb, TranslateUnrealID2IntID unrealID, java.util.logging.Logger log)
Method Detail |
---|
private MessageObject getMessageFromYylex() throws CantReadException
CantReadException
private void handleEndMessage()
private MessageObject diffMessage(MessageObject msg)
msg
- public MessageObject receiveParsedMessage() throws CantReadException
receiveParsedMessage
in interface MediatorParserInterface
CantReadException
- Unable to read from GameBot connectionpublic void sendMessageToGB(java.lang.String msg) throws CantWriteException
sendMessageToGB
in interface MediatorGBInterface
CantWriteException
- Unable to send data to GameBot.public int translateUnrealID2IntID(java.lang.String unrealId)
translateUnrealID2IntID
in interface TranslateUnrealID2IntID
public void closeGB() throws CantCloseConnectionException
MediatorGBInterface
closeGB
in interface MediatorGBInterface
CantCloseConnectionException
public void closeParser() throws CantCloseConnectionException
MediatorParserInterface
closeParser
in interface MediatorParserInterface
CantCloseConnectionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |