com.sun.labs.minion
Class CompositeResultsFilter

java.lang.Object
  extended by com.sun.labs.minion.CompositeResultsFilter
All Implemented Interfaces:
ResultsFilter, java.io.Serializable

public class CompositeResultsFilter
extends java.lang.Object
implements ResultsFilter, java.io.Serializable

A class that composes a number of individual results filter. In order for a result to pass this filter, it must pass each of the individual filters. Note that in order for this class to really be serializable, the filters it's holding must be serializable!

See Also:
Serialized Form

Constructor Summary
CompositeResultsFilter(java.util.List<ResultsFilter> filters)
          Creates a composite filter.
CompositeResultsFilter(ResultsFilter f1, ResultsFilter f2)
          Creates a composite of two filters.
 
Method Summary
 void addFilter(ResultsFilter rf)
          Adds a filter to the list of filters to apply.
 boolean filter(ResultAccessor ra)
          Runs the filter against the result currently under consideration.
 int getPassed()
          Gets the number of times that a result passed the filter.
 int getTested()
          Gets the number of times that the filter was used during the collection of search results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeResultsFilter

public CompositeResultsFilter(java.util.List<ResultsFilter> filters)
Creates a composite filter.

Parameters:
filters - the filters to apply

CompositeResultsFilter

public CompositeResultsFilter(ResultsFilter f1,
                              ResultsFilter f2)
Creates a composite of two filters.

Method Detail

addFilter

public void addFilter(ResultsFilter rf)
Adds a filter to the list of filters to apply.

Parameters:
rf - the filter to add.

filter

public boolean filter(ResultAccessor ra)
Description copied from interface: ResultsFilter
Runs the filter against the result currently under consideration.

Specified by:
filter in interface ResultsFilter
Parameters:
ra - an accessor that can be used to get information about the current result. Note that the accessor is only valid for this call of the filter.
Returns:
true if the current result should be included in the results returned to the user, false if it should not.

getTested

public int getTested()
Description copied from interface: ResultsFilter
Gets the number of times that the filter was used during the collection of search results.

Specified by:
getTested in interface ResultsFilter

getPassed

public int getPassed()
Description copied from interface: ResultsFilter
Gets the number of times that a result passed the filter.

Specified by:
getPassed in interface ResultsFilter