Package eu.bandm.tools.message
Class MessageStoreSorted<M extends Message>
java.lang.Object
eu.bandm.tools.message.MessageStore_<M>
eu.bandm.tools.message.MessageStoreSorted<M>
- Type Parameters:
M
- the type of the messages
- All Implemented Interfaces:
MessageReceiver<M>
Storage for a sequence of
Message
s with dynamic sorting.-
Nested Class Summary
Nested classes/interfaces inherited from class eu.bandm.tools.message.MessageStore_
MessageStore_.ListModel, MessageStore_.TableModel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Opt Comparator
<? super M> If set, defines the storage order.Fields inherited from class eu.bandm.tools.message.MessageStore_
indents, listModel, messages, tableModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComparator
<? super M> getOrder()
Returns the comparator which rules the sequential order of storing.void
Adds the received message to the internal store and notifies all GUI objects.void
setOrder
(@Opt Comparator<? super M> comp) Set the comparator which rules the sequential order of storing.Methods inherited from class eu.bandm.tools.message.MessageStore_
clear, drainAndClear, drainTo, getListModel, getMessages, getSize, getTableModel, isEmpty, notifyGuiAdd, notifyGuiChanged_ALL, setListModel, setTableModel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.bandm.tools.message.MessageReceiver
ifSubcriticalThen, ifSubcriticalThen, ifSubcriticalThenElse
-
Field Details
-
order
If set, defines the storage order. Otherwise it is by arrival.
-
-
Constructor Details
-
MessageStoreSorted
public MessageStoreSorted()Only constructor. Constructs a message store without indentation storage.
-
-
Method Details
-
setOrder
Set the comparator which rules the sequential order of storing. The current content will be re-ordered and the GUI models will be notified.- Parameters:
comp
- the comparator to apply. If it is null, then no re-ordering takes place, and future messages will again be appended to the end of the store.
-
getOrder
Returns the comparator which rules the sequential order of storing.- Returns:
- the comparator which rules the sequential order of storing.
-
receive
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 interfaceMessageReceiver<M extends Message>
- Specified by:
receive
in classMessageStore_<M extends Message>
- Parameters:
message
- the message to add to the score
-