Package eu.bandm.tools.message
Class MessageLatch<M extends Message>
java.lang.Object
eu.bandm.tools.message.MessageLatch<M>
- Type Parameters:
M- the message type.
- All Implemented Interfaces:
MessageReceiver<M>
A simple register which save the most recenly received message.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) MInternal store for the last received message. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the last received message.voidReceive the given message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.bandm.tools.message.MessageReceiver
ifSubcriticalThen, ifSubcriticalThen, ifSubcriticalThenElse
-
Field Details
-
lastMessage
Internal store for the last received message.
-
-
Constructor Details
-
MessageLatch
public MessageLatch()Only constructor.
-
-
Method Details
-
receive
Receive the given message. Store the message internally.- Specified by:
receivein interfaceMessageReceiver<M extends Message>- Parameters:
m- the message to receive.
-
getLastMessage
Return the last received message. Can be null only before the very first reception.- Returns:
- the last received message.
-