java.lang.Object
org.bzdev.drama.common.MessageFilter
org.bzdev.drama.common.CompoundMessageFilter
A message filter that applies a series of message filters sequentially.
The filters are applied in the order in which they are added by
calls to
addFilter
. By default
and for efficiency reasons regarding the use of this class in
GenericDomain, no test for a circular filter (one in which a filter
is added to itself) is done. A method named circularityTest is
provided for cases in which such a test is necessary. A circularity
test is not needed in the case where a CompoundMessageFilter is
created and never added to another CompoundMessageFilter.-
Field Summary
Fields inherited from class org.bzdev.drama.common.MessageFilter
DELETED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFilter
(MessageFilter filter) Add a filter.boolean
circularityTest
(MessageFilter filter) Test that adding a filter will not create a circular compound filter - one whose filterMessage method will never terminate.filterMessage
(Object msg) Filter a message.
-
Constructor Details
-
CompoundMessageFilter
public CompoundMessageFilter()
-
-
Method Details
-
addFilter
Add a filter.- Parameters:
filter
- the filter to add
-
circularityTest
Test that adding a filter will not create a circular compound filter - one whose filterMessage method will never terminate.- Parameters:
filter
- the message filter that would be added- Returns:
- true if the circularity test passes; false otherwise
-
filterMessage
Description copied from class:MessageFilter
Filter a message.- Overrides:
filterMessage
in classMessageFilter
- Parameters:
msg
- the original message- Returns:
- a modified message; MessageFilter.DELETED if the message should be dropped
-