|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.pogamut.Client.HistoryBatch
public class HistoryBatch
HistoryBatch is a class that stores one batch of messages from Gamebots it therefore has a structure to save them to it is indexed by type of item and on this index, you can find HashMap with all items saved at the current batch - so some of them are mostly empty
Special attention should be payed to items without ID, those are stored under fantom ID which is negative and goes down from -1 to MIN_VALUE of int.
note that messages are mostly synchronized to ensure synchronized access to it
Field Summary | |
---|---|
java.util.logging.Logger |
batchLogger
|
static int |
counterForAnonymousID
Counter for items without ID, which needs ID - like sounds for instance every sound has its ID, as integer got about at least 65536 values, there is no chance, that there will be two different objects of the same type with the same ID |
private java.util.HashMap<MessageType,java.util.HashMap<java.lang.Integer,MessageObject>> |
messages
|
private HistoryBatch |
next
|
Constructor Summary | |
---|---|
HistoryBatch(java.util.logging.Logger logger)
|
Method Summary | |
---|---|
void |
addMessage(MessageObject newMsg)
This method is synchronized! |
HistoryBatch |
copyVisibleObjects()
this method soft copies synchronous messages batch is used in History. |
java.util.HashMap<java.lang.Integer,MessageObject> |
getAllObjectsOfType(MessageType type)
returns HashMap with objects of desired type, could return null for empty HashMaps |
MessageObject |
getFirstObjectOfType(MessageType type)
returns first object of desired type or null if there is not any |
MessageObject |
getMessage(MessageType type,
int ID)
Returns message of type 'type' and id 'ID' if present in the batch, null otherwise. |
HistoryBatch |
getNext()
for move to the next batch |
boolean |
hasObjectOfType(int type)
indicates whether there is at least one object of desired type |
void |
remove(MessageType type,
int id)
|
void |
setNext(HistoryBatch next)
set next batch |
java.lang.String |
toFormatedString()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.HashMap<MessageType,java.util.HashMap<java.lang.Integer,MessageObject>> messages
private HistoryBatch next
public static int counterForAnonymousID
public java.util.logging.Logger batchLogger
Constructor Detail |
---|
public HistoryBatch(java.util.logging.Logger logger)
Method Detail |
---|
public HistoryBatch getNext()
public void setNext(HistoryBatch next)
next
- public MessageObject getMessage(MessageType type, int ID)
type
- ID
-
public void addMessage(MessageObject newMsg)
newMsg
- public HistoryBatch copyVisibleObjects()
batch is used in History. Batch is storing all messages from Gamebots in the structure composed of ArrayList and HashMap. Messages are from one batch, there are both synchronous and asynchronous messages, but after the end of the batch, it is not necessary to send all synchronous messages again, so the synchronous messages are copied and asynchronous ommited
and exatly that is a purpose of this method
public boolean hasObjectOfType(int type)
public MessageObject getFirstObjectOfType(MessageType type)
public java.util.HashMap<java.lang.Integer,MessageObject> getAllObjectsOfType(MessageType type)
type
-
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toFormatedString()
public void remove(MessageType type, int id)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |