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

      • OrEventFilter

        public OrEventFilter()
        Creates a new instance of OrEventFilter that has no child filters.
      • OrEventFilter

        public OrEventFilter​(Collection<EventFilter> childFilters)
        Creates a new instance of OrEventFilter 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 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