Class 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 Detail

      • AndEventFilter

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

        public AndEventFilter​(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:
        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