Class MessageStore<M extends Message>

java.lang.Object
eu.bandm.tools.message.MessageStore_<M>
eu.bandm.tools.message.MessageStore<M>
Type Parameters:
M - the type of the messages
All Implemented Interfaces:
MessageReceiver<M>

public class MessageStore<M extends Message> extends MessageStore_<M>
Storage for a sequence of Messages in order of their arrival. All messages received are added to an internal sequential storage in the order of arrival. Additionally the nesting level of Message.Kind.logStart and Message.Kind.logEnd messages is stored, which can be rendered by a GUI.
  • Field Details

    • nestingLevel

      protected int nestingLevel
      Internal state for storing the nesting of Message.Kind.logStart and Message.Kind.logEnd messages. Is always >=0, also in case of inconsistent nesting of incomming messages.
  • Constructor Details

    • MessageStore

      public MessageStore()
      Only constructor
  • Method Details

    • clearNestingLevel

      public void clearNestingLevel()
      Resets nesting level to 0.
    • receive

      public void receive(M message)
      Adds the received message to the internal store and notifies all GUI objects. Counts the nesting level of Message.Kind.logStart and Message.Kind.logEnd messages. Never goes below zero(0).
      Specified by:
      receive in interface MessageReceiver<M extends Message>
      Specified by:
      receive in class MessageStore_<M extends Message>
      Parameters:
      message - the received message.
    • get

      public M get(int i)
      Return the message stored at the given poisition.
      Parameters:
      i - the position of the returned message, >= 0.
      Returns:
      the message stored at the given poisition.