Class OrEventFilter
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.event.filter.ChainedEventFilter
-
- net.sf.jguiraffe.gui.builder.event.filter.OrEventFilter
-
- All Implemented Interfaces:
EventFilter
public class OrEventFilter extends ChainedEventFilter
A specialized chained filter implementation that provides a OR or ANY semantics.
This filter class implements the
accept()
method in a way that it returns true if at least one of the child filters returns true.- Version:
- $Id: OrEventFilter.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description OrEventFilter()
Creates a new instance ofOrEventFilter
that has no child filters.OrEventFilter(Collection<EventFilter> childFilters)
Creates a new instance ofOrEventFilter
and initializes it with the given list of child filters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Object obj)
Tests the specified object.-
Methods inherited from class net.sf.jguiraffe.gui.builder.event.filter.ChainedEventFilter
addFilter, addFilters, clear, getFilterIterator, getFilters
-
-
-
-
Constructor Detail
-
OrEventFilter
public OrEventFilter()
Creates a new instance ofOrEventFilter
that has no child filters.
-
OrEventFilter
public OrEventFilter(Collection<EventFilter> childFilters)
Creates a new instance ofOrEventFilter
and initializes it with the given list of child filters. The collection must contain non null objects implementing theEventFilter
interface.- Parameters:
childFilters
- the child filters (must not be null)- Throws:
IllegalArgumentException
- if the list with child filters is null
-
-
Method Detail
-
accept
public boolean accept(Object obj)
Tests the specified object. This implementation iterates over all child filters and passes the object to be tested to each. When the first child filter returns true, the iteration is aborted and the result true is returned. Otherwise the result is false. This implies that a filter with an empty list of children will return false.- Parameters:
obj
- the object to be tested- Returns:
- a flag if this object is accepted by this filter
-
-