Class MessageStoreSorted<M extends Message>

java.lang.Object
eu.bandm.tools.message.MessageStore_<M>
eu.bandm.tools.message.MessageStoreSorted<M>
All Implemented Interfaces:
MessageReceiver<M>

public class MessageStoreSorted<M extends Message> extends MessageStore_<M>
Storage for a sequence of Messages in order of their arrival. The nesting level between Message.Kind.logStart and Message.Kind.logEnd is stored additionally.
  • Field Details

    • order

      @Opt protected @Opt Comparator<? super M extends Message> order
      If set, defines the storage order. Otherwise it is by arrival.
  • Constructor Details

    • MessageStoreSorted

      public MessageStoreSorted()
  • Method Details

    • setOrder

      public void setOrder(@Opt @Opt Comparator<? super M> comp)
      Set the comparator which rules the sequential order of storing. The current content will be re-ordered and the GUI models will be notified.

      If comp==null, then no re-ordering takes place, and future messages will again be appended to the end of the store.
    • getOrder

      public Comparator<? super M> getOrder()
      Returns the comparator which rules the sequential order of storing.
    • receive

      public void receive(M message)
      Adds the received message to the internal store and notifies all GUI objects.
      If a comparator has been defined by setOrder(Comparator) then the new message is inserted directly before those which are of greater value, ie. after all those of equal value, which are older. In the absence of a comparator it is appended at the end.
      Specified by:
      receive in interface MessageReceiver<M extends Message>
      Specified by:
      receive in class MessageStore_<M extends Message>