Public Member Functions | |
KnownMessages (Vehicle vehicle) | |
synchronized void | addMessage (Message message, boolean doExecute, boolean doForward) |
synchronized void | deleteForwardMessage (int position, boolean addToOld) |
synchronized void | deleteAllForwardMessages (boolean addToOld) |
synchronized void | deleteAllFloodingForwardMessages (boolean addToOld) |
void | processMessages () |
void | checkOutdatedMessages (boolean addToOld) |
Message[] | getForwardMessages () |
boolean | hasNewMessages () |
int | getSize () |
int | getOldMessagesSize () |
int | getFailedForwardCount () |
void | clear () |
This class stores various messages in multiple separate arrays:
The arrays are not resized on every operation. Deletion of an element only changes the corresponding size variable, addition only leads to a larger array if there's not enough space left.
|
inline |
Constructor.
vehicle | the vehicle this data structure belongs to |
|
inline |
Adds a message.
message | the message |
doExecute | true if you want the message to be executed, else false |
doForward | true if you want the message to be forwarded, else false |
|
inline |
Checks for outdated messages and deletes them. Note that this function is not synchronized! You need to make sure that no other thread uses any function on this object at the same time!
addToOld | true to add all to outdated forward messages to the old messages, else false |
|
inline |
Clears everything from this data structure.
|
inline |
Deletes all forward messages which are in flooding/broadcast mode and optionally adds them to the old messages.
addToOld | true to add the removed flooding messages to the old messages, else false |
|
inline |
Deletes all forward messages and optionally adds them to the old messages.
addToOld | true to add all to the old messages, else false |
|
inline |
Deletes a forward message and optionally adds it to the old messages.
position | the position |
addToOld | true to add it to the old messages, else false |
|
inline |
Gets the amount of messages which failed to be forwarded.
|
inline |
Gets all messages which shall be forwarded. Note that there might be garbage at the end so use the getSize()-methode to get the real size!
|
inline |
Gets the amount of old messages stored.
|
inline |
Gets the amount of known messages stored (=forward messages).
|
inline |
Returns if there are news messages which need to be processed.
true
if there are new messages, else false
|
inline |
Process messages. Note that this function is not synchronized! You need to make sure that no other thread uses any function on this object at the same time!