|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.pogamut.Client.History
public class History
History contains a structure which is a compound of couple containers it is an Array of Container of Set
example usage - getSeenMessageObjectsInTime(3,3) - return NavPoints(type = 3) that agent saw in last 3 end messages (last three batches)
another example - getSeenMessageObjectsInTime(7,5) - return Players(type = 7) that agent saw in last 5 batches, but their properties will be same during the time, it doesn't matter that they moved before
Field Summary | |
---|---|
private java.util.ArrayList<HistoryBatch> |
batches
|
private int |
maxLenghtOfStoring
|
private java.util.logging.Logger |
platformLog
|
Constructor Summary | |
---|---|
History(AgentBody body,
java.util.logging.Logger logger)
|
Method Summary | |
---|---|
void |
addMessage(MessageObject newMsg)
This method is synchronized! |
void |
endMessage()
creates new batch and puts it on the first position in messages (most recent) then copy all things from old batch (messages.get(1))... |
HistoryBatch |
getFirstBatch()
|
MessageObject |
getFirstMessageOfType(MessageType type)
|
int |
getMaxLenghtOfStoring()
get maximum number of stored HistoryBatches |
java.util.ArrayList<MessageObject> |
getMessagesOfType(MessageType type)
|
java.util.ArrayList<MessageObject> |
getSeenMessageObjectsInTime(int time,
MessageType type)
gets NavPoints from now to specified time (number of batches) in the past NOTE: number of stored batches is limited, it takes a lot of disk space! |
HistoryIterator |
iterator(int depth,
MessageType type,
boolean unique)
returns HistoryIterator - entity, which could be used to search history for all objects of specified type up to specified depth unique indicates if you need only objects unique according to ID (for true) or all objects of type (for false), no matter that there will be more of one object - that could be useful for quessing opponent tactics or some other issues |
void |
receiveMessage(RcvMsgEvent e)
receiveMessage is a listener method that listens to AgentBody which receives messages from Parser and thus raise Event RcvMsgEvent there I distinguish end message from other messages!!! |
void |
restartHistory()
restarts history after the death of the agent |
void |
setMaxLenghtOfStoring(int maxLenghtOfStoring)
set max number of stored HistoryBatches |
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.ArrayList<HistoryBatch> batches
private java.util.logging.Logger platformLog
private int maxLenghtOfStoring
Constructor Detail |
---|
public History(AgentBody body, java.util.logging.Logger logger)
Method Detail |
---|
public void restartHistory()
public int getMaxLenghtOfStoring()
public void setMaxLenghtOfStoring(int maxLenghtOfStoring)
maxLenghtOfStoring
- public void endMessage()
by copying is ment that it makes shallow copy every synchronous message (NAV, PLR, SLF, INV, etc.)
hard copies are made when different object with same ID comes - Parser sends only different object
with same ID, so it is cloned right after the update - hard copies stands only for synchronous messages
public void addMessage(MessageObject newMsg)
newMsg
- public void receiveMessage(RcvMsgEvent e)
receiveMessage
in interface RcvMsgListener
public java.lang.String toString()
toString
in class java.lang.Object
public MessageObject getFirstMessageOfType(MessageType type)
type
-
public HistoryBatch getFirstBatch()
public java.util.ArrayList<MessageObject> getMessagesOfType(MessageType type)
type
-
public java.util.ArrayList<MessageObject> getSeenMessageObjectsInTime(int time, MessageType type)
type
- time
- - number of batches to the past
public HistoryIterator iterator(int depth, MessageType type, boolean unique)
depth
- type
- unique
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |