net.sf.jguiraffe.gui.builder.event.filter
Class AndEventFilter

java.lang.Object
  extended by net.sf.jguiraffe.gui.builder.event.filter.ChainedEventFilter
      extended by 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 154 2009-02-09 21:07:07Z oheger $
Author:
Oliver Heger

Constructor Summary
AndEventFilter()
          Creates a new, empty instance of AndEventFilter.
AndEventFilter(java.util.Collection<EventFilter> childFilters)
          Creates a new instance of AndEventFilter and initializes it with the given list of child filters.
 
Method Summary
 boolean accept(java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndEventFilter

public AndEventFilter()
Creates a new, empty instance of AndEventFilter.


AndEventFilter

public AndEventFilter(java.util.Collection<EventFilter> childFilters)
Creates a new instance of AndEventFilter and initializes it with the given list of child filters. The collection must contain non null objects implementing the EventFilter interface.

Parameters:
childFilters - the child filters (must not be null
Throws:
java.lang.IllegalArgumentException - if the collection with child filters is null or contains null references
Method Detail

accept

public boolean accept(java.lang.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


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.