Package eu.bandm.tools.message
Class MessageKindFilter<M extends Message>
java.lang.Object
eu.bandm.tools.message.SingleSender<M>
eu.bandm.tools.message.MessageKindFilter<M>
- All Implemented Interfaces:
MessageReceiver<M>
public class MessageKindFilter<M extends Message>
extends SingleSender<M>
implements MessageReceiver<M>
A filter which propagates only those messages the
Message.Kind
of which is currently in the selection.-
Field Summary
Fields inherited from class eu.bandm.tools.message.SingleSender
receiver
-
Constructor Summary
ConstructorDescriptionMessageKindFilter
(MessageReceiver<? super M> d) Constructor with no kind is initially selected.MessageKindFilter
(MessageReceiver<? super M> d, Message.Kind... kk) Constructor with given kinds initially selected. -
Method Summary
Modifier and TypeMethodDescriptionAdds allMessage.Kind
s which are marked as critical.Add allMessage.Kind
to the filter.Adds the kind to selection.addKind
(Message.Kind... kk) Adds the kinds kinds to selection.void
Propagate to theSingleSender.receiver
if message's kind is in selection.Evident.Remove the kind from selectionremoveKind
(Message.Kind... kk) Remove the kinds from selectionMethods inherited from class eu.bandm.tools.message.SingleSender
getReceiver, send, setReceiver
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
-
kinds
The selected kinds.
-
-
Constructor Details
-
MessageKindFilter
Constructor with no kind is initially selected.- Parameters:
d
- the receiver of the messages.
-
MessageKindFilter
Constructor with given kinds initially selected.- Parameters:
d
- the receiver of the messages.kk
- the kinds initially selected.
-
-
Method Details
-
addAllCriticalKinds
Adds allMessage.Kind
s which are marked as critical.- Returns:
- this for message chaining.
- See Also:
-
addKind
Adds the kind to selection.- Parameters:
k
- kind to add.- Returns:
- this for message chaining.
-
addKind
Adds the kinds kinds to selection.- Parameters:
kk
- kinds to add.- Returns:
- this for message chaining.
-
addAllKinds
Add allMessage.Kind
to the filter.- Returns:
- this for message chaining.
-
removeKind
Remove the kind from selection- Parameters:
k
- kind to remove.- Returns:
- this for message chaining.
-
removeKind
Remove the kinds from selection- Parameters:
kk
- kinds to remove.- Returns:
- this for message chaining.
-
removeAllKinds
Evident.- Returns:
- this for message chaining.
-
receive
Propagate to theSingleSender.receiver
if message's kind is in selection.- Specified by:
receive
in interfaceMessageReceiver<M extends Message>
- Parameters:
m
- message to propagate.
-