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, MessageLevelFilter, MessageLocationFilter, MessageMapper, MessagePasser, MessagePrinter, MessagePrinter.Indenting, MessageStore, MessageStore_, MessageStoreSorted, MessageStripExceptions, MessageSync, MessageTee, MessageThrower, 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.

@FunctionalInterface public interface MessageReceiver<M extends Message>
Everything which can receive a message. The value for the message must be never be null.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    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.
    void
    receive(M message)
    Evident.
  • Method Details

    • receive

      void receive(M message)
      Evident.
      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 subcriticalBranch is 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
      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 computation is called with a message receiver that is not identical to this, but forwards all messages to it and performs tracking.

      This method has no explicit data flow between the steps: The function object subcriticalBranch is 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.
      Type Parameters:
      V - the result of the computation.
      Parameters:
      computation - the computation which delivers a value from <V> and / or sends messages to this MessageReceiver.
      subcriticalBranch - second computation which is performed when no errors or failures have been sent by the first computation
      criticalBranch - is executed when errors or failures have been sent by the first computation.
      See Also: