## edu.stanford.nlp.util
Class Filters

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

    public class Filters

extends Object

Some simple implementations of the Filter interface.

Author:
  Christopher Manning

Method Summary

`static

`<T> Filter<T>`

`

`acceptFilter()`
The acceptFilter accepts everything.

`static

`<E> Filter<E>`

`

`andFilter(Filter<E> f1, Filter<E> f2)`
Filter that accepts only when both filters accept (AND).

`static

`<E> Filter<E>`

`

`collectionAcceptFilter(Collection<E> objs)`
The collectionAcceptFilter accepts a certain collection.

`static

`<E> Filter<E>`

`

`collectionAcceptFilter(E[] objs)`
The collectionAcceptFilter accepts a certain collection.

`static

`<E> Filter<E>`

`

`collectionRejectFilter(Collection<E> objs)`
The collectionRejectFilter rejects a certain collection.

`static

`<E> Filter<E>`

`

`collectionRejectFilter(E[] objs)`
The collectionRejectFilter rejects a certain collection.

`static

`<E> E[]`

`

`filter(E[] elems, Filter<E> filter)`
Applies the given filter to each of the given elems, and returns the list of elems that were accepted.

`static

`<E> Filter<E>`

`

`notFilter(Filter<E> filter)`
Filter that does the opposite of given filter (NOT).

`static

`<E> Filter<E>`

`

`orFilter(Filter<E> f1, Filter<E> f2)`
Filter that accepts when either filter accepts (OR).

`static

`<T> Filter<T>`

`

`rejectFilter()`
The rejectFilter accepts nothing.

`static

`<E> void`

`

`retainAll(Collection<E> elems, Filter<? super E> filter)`
Removes all elems in the given Collection that aren't accepted by the given Filter.

`static

`<E> Filter<E>`

`

`switchedFilter(Filter<E> 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 <T> Filter<T> acceptFilter()

  The acceptFilter accepts everything.

### rejectFilter

    public static <T> Filter<T> rejectFilter()

  The rejectFilter accepts nothing.

### collectionAcceptFilter

    public static <E> Filter<E> collectionAcceptFilter(E[] objs)

  The collectionAcceptFilter accepts a certain collection.

### collectionAcceptFilter

    public static <E> Filter<E> collectionAcceptFilter(Collection<E> objs)

  The collectionAcceptFilter accepts a certain collection.

### collectionRejectFilter

    public static <E> Filter<E> collectionRejectFilter(E[] objs)

  The collectionRejectFilter rejects a certain collection.

### collectionRejectFilter

    public static <E> Filter<E> collectionRejectFilter(Collection<E> objs)

  The collectionRejectFilter rejects a certain collection.

### andFilter

    public static <E> Filter<E> andFilter(Filter<E> f1,
                                          Filter<E> f2)

  Filter that accepts only when both filters accept (AND).

### orFilter

    public static <E> Filter<E> orFilter(Filter<E> f1,
                                         Filter<E> f2)

  Filter that accepts when either filter accepts (OR).

### notFilter

    public static <E> Filter<E> notFilter(Filter<E> filter)

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

### switchedFilter

    public static <E> Filter<E> switchedFilter(Filter<E> filter,
                                               boolean negated)

  Filter that's either negated or normal as specified.

### filter

    public static <E> E[] filter(E[] elems,
                                 Filter<E> 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 <E> void retainAll(Collection<E> elems,
                                     Filter<? super E> filter)

  Removes all elems in the given Collection that aren't accepted by the given Filter.

Stanford NLP Group