Class AndEventFilter
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.event.filter.ChainedEventFilter
-
- net.sf.jguiraffe.gui.builder.event.filter.AndEventFilter
-
- All Implemented Interfaces:
EventFilter
public class AndEventFilter extends ChainedEventFilter
A specialized chained filter implementation that provides an AND or ALL semantics.
This filter class implements the
accept()
method in a way that it returns true only if all of the child filters return true.- Version:
- $Id: AndEventFilter.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description AndEventFilter()
Creates a new, empty instance ofAndEventFilter
.AndEventFilter(Collection<EventFilter> childFilters)
Creates a new instance ofAndEventFilter
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 whether it is accepted by this filter.-
Methods inherited from class net.sf.jguiraffe.gui.builder.event.filter.ChainedEventFilter
addFilter, addFilters, clear, getFilterIterator, getFilters
-
-
-
-
Constructor Detail
-
AndEventFilter
public AndEventFilter()
Creates a new, empty instance ofAndEventFilter
.
-
AndEventFilter
public AndEventFilter(Collection<EventFilter> childFilters)
Creates a new instance ofAndEventFilter
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 collection with child filters is null or contains null references
-
-
Method Detail
-
accept
public boolean accept(Object obj)
Tests the specified object whether it is accepted by this filter. This implementation iterates over the child filters. When the first child returns false iteration is aborted, and the method's result is false. If all child filters return true, or the filter has no child filters, result is true.- Parameters:
obj
- the object to be tested- Returns:
- a flag whether this object is accepted
-
-