Interface MessageReceiver<M extends Message>
- Type Parameters:
M- the message subtype which can be received
- All Known Implementing Classes:
LLJavac.Messager,MessageAsync,MessageCounter,MessageDemux,MessageDemux.All,MessageDemux.ByKind,MessageDialog,MessageDisposer,MessageFormatter,MessageKindFilter,MessageLatch,MessageLevelFilter,MessageLocationFilter,MessageMapper,MessagePasser,MessagePrinter,MessagePrinter.Indenting,MessageStore,MessageStore_,MessageStoreSorted,MessageStripExceptions,MessageSync,MessageTee,MessageThrower,MessageTranslator,MessageTranslator,OffsetIndicationPrinter,PrimitiveMessageDemux,Reducer.Context,SimpleMessage.LocationMapper,SwingMessageField,TrafficMessageReceiver,UMod2format.ThrowCritical
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidifSubcriticalThen(Consumer<MessageReceiver<M>> computation, Runnable subcriticalBranch) Perform a computation using this receiver, and follow up if no critical messages have been received.default <V> voidifSubcriticalThen(Function<MessageReceiver<M>, V> computation, Consumer<V> subcriticalBranch) Perform a message-aware computation using this receiver, and follow up if no critical messages have been received.default <V> voidifSubcriticalThenElse(Function<MessageReceiver<M>, V> computation, Consumer<V> subcriticalBranch, Runnable criticalBranch) Perform a computation using this receiver, and follow up depending on whether critical messages have been received.voidReceive the given message.
-
Method Details
-
receive
Receive the given message.- Parameters:
message- the message to receive.
-
ifSubcriticalThen
default <V> void ifSubcriticalThen(Function<MessageReceiver<M>, V> computation, Consumer<V> subcriticalBranch) Perform a message-aware computation using this receiver, and follow up if no critical messages have been received.The function object computation is called with a message receiver that is not identical to
this, but forwards all messages to it and performs tracking.The two steps may communicate by explicit data flow: The function object
subcriticalBranchis called with the result of the preceding computation, but only if no critical messages have been received.- Type Parameters:
V- the type of values flowing between the steps- Parameters:
computation- the first step, a computation that may send messages as a side effect,subcriticalBranch- the second step, a computation to run only if no critical messages have been received- See Also:
-
ifSubcriticalThen
default void ifSubcriticalThen(Consumer<MessageReceiver<M>> computation, Runnable subcriticalBranch) Perform a computation using this receiver, and follow up if no critical messages have been received.The function object
computation1 is called with a message receiver that is not identical tothis, but forwards all messages to it and performs counting.This method has no explicit data flow between the steps: The function object
subcriticalBranchis called with no arguments, but only if no critical messages have been received.- Parameters:
computation- the first step, a computation that may send messages.subcriticalBranch- the second step, a computation to run only if no critical messages have been received- See Also:
-
ifSubcriticalThenElse
default <V> void ifSubcriticalThenElse(Function<MessageReceiver<M>, V> computation, Consumer<V> subcriticalBranch, Runnable criticalBranch) Perform a computation using this receiver, and follow up depending on whether critical messages have been received.The function object
computation1 is called with a message receiver that is not identical tothis, but forwards all messages to it and performs counting.- Type Parameters:
V- the type of values flowing between the steps- Parameters:
computation- delivers a result and may send messages to the given message receiver as a side effect.subcriticalBranch- second computation which is performed when no errors or failures have been sent by the first computation, the result of which taken as input parameter.criticalBranch- is executed when errors or failures have been sent by the first computation.- See Also:
-