edu.stanford.nlp.util
Class Filters

java.lang.Object
  extended by edu.stanford.nlp.util.Filters

public class Filters
extends Object

Filters contains some simple implementations of the Filter interface.

Author:
Christopher Manning

Method Summary
static Filter acceptFilter()
          The acceptFilter accepts everything.
static Filter andFilter(Filter f1, Filter f2)
          Filter that accepts only when both filters accept (AND).
static Filter collectionAcceptFilter(Collection objs)
          The collectionAcceptFilter accepts a certain collection.
static Filter collectionAcceptFilter(Object[] objs)
          The collectionAcceptFilter accepts a certain collection.
static Filter collectionRejectFilter(Collection objs)
          The collectionRejectFilter rejects a certain collection.
static Filter collectionRejectFilter(Object[] objs)
          The collectionRejectFilter rejects a certain collection.
static Object[] filter(Object[] elems, Filter filter)
          Applies the given filter to each of the given elems, and returns the list of elems that were accepted.
static Filter notFilter(Filter filter)
          Filter that does the opposite of given filter (NOT).
static Filter orFilter(Filter f1, Filter f2)
          Filter that accepts when either filter accepts (OR).
static Filter rejectFilter()
          The rejectFilter accepts nothing.
static void retainAll(Collection elems, Filter filter)
          Removes all elems in the given Collection that aren't accepted by the given Filter.
static Filter switchedFilter(Filter filter, boolean negated)
          Filter that's either negated or normal as specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

acceptFilter

public static Filter acceptFilter()
The acceptFilter accepts everything.


rejectFilter

public static Filter rejectFilter()
The rejectFilter accepts nothing.


collectionAcceptFilter

public static Filter collectionAcceptFilter(Object[] objs)
The collectionAcceptFilter accepts a certain collection.


collectionAcceptFilter

public static Filter collectionAcceptFilter(Collection objs)
The collectionAcceptFilter accepts a certain collection.


collectionRejectFilter

public static Filter collectionRejectFilter(Object[] objs)
The collectionRejectFilter rejects a certain collection.


collectionRejectFilter

public static Filter collectionRejectFilter(Collection objs)
The collectionRejectFilter rejects a certain collection.


andFilter

public static Filter andFilter(Filter f1,
                               Filter f2)
Filter that accepts only when both filters accept (AND).


orFilter

public static Filter orFilter(Filter f1,
                              Filter f2)
Filter that accepts when either filter accepts (OR).


notFilter

public static Filter notFilter(Filter filter)
Filter that does the opposite of given filter (NOT).


switchedFilter

public static Filter switchedFilter(Filter filter,
                                    boolean negated)
Filter that's either negated or normal as specified.


filter

public static Object[] filter(Object[] elems,
                              Filter filter)
Applies the given filter to each of the given elems, and returns the list of elems that were accepted. The runtime type of the returned array is the same as the passed in array.


retainAll

public static void retainAll(Collection elems,
                             Filter filter)
Removes all elems in the given Collection that aren't accepted by the given Filter.



Stanford NLP Group