# Interface Filter<R>

Type Parameters:
  `R` - the type of resources (e.g. `AbstractFeature`) to filter.

All Superinterfaces:
  `Predicate<R>`

All Known Subinterfaces:
  `Optimization​.OnFilter<R>`

public interface Filter<R> extends Predicate<R>
Identification of a subset of resources from a collection of resources whose property values satisfy a set of logically connected predicates.
Upcoming API change
This is a placeholder for a GeoAPI 3.1 interface not yet released. In a future version, all usages of this interface may be replaced by an interface of the same name but in the `org​.opengis​.filter` package instead of `org​.apache​.sis​.filter`.

Since:
  1.1

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <R> Filter<R>`
  `exclude()`
  A filter that always evaluates to `false`.
  `List<Expression<R,?>>`
  `getExpressions()`
  Returns the expressions used as arguments for this filter.
  `Enum<?>`
  `getOperatorType()`
  Returns the nature of the operator.
  `Class<? super R>`
  `getResourceClass()`
  Returns the class of resources expected by this filter.
  `static <R> Filter<R>`
  `include()`
  A filter that always evaluates to `true`.
  `boolean`
  `test(R object)`
  Given an object, determines if the test(s) represented by this filter are passed.

  ### Methods inherited from interface Predicate

  `and, negate, or`

- ## Method Details

  - ### include

    static <R> Filter<R> include()
    A filter that always evaluates to `true`.
    Type Parameters:
      `R` - the type of resources to filter.
    Returns:
      the "no filtering" filter.

  - ### exclude

    static <R> Filter<R> exclude()
    A filter that always evaluates to `false`.
    Type Parameters:
      `R` - the type of resources to filter.
    Returns:
      the "exclude all" filter.

  - ### getOperatorType

    Enum<?> getOperatorType()
    Returns the nature of the operator.
    Returns:
      the nature of this operator.

  - ### getResourceClass

    Class<? super R> getResourceClass()
    Returns the class of resources expected by this filter.
    Returns:
      type of resources accepted by this filter.
    Since:
      1.4

  - ### getExpressions

    List<Expression<R,?>> getExpressions()
    Returns the expressions used as arguments for this filter.
    Returns:
      the expressions used as inputs, or an empty list if none.

  - ### test

    boolean test(R object)
    Given an object, determines if the test(s) represented by this filter are passed.
    Specified by:
      `test` in interface `Predicate<R>`
    Parameters:
      `object` - the object (often a `Feature` instance) to evaluate.
    Returns:
      `true` if the test(s) are passed for the provided object.
    Throws:
      `NullPointerException` - if `object` is null.
      `IllegalArgumentException` - if the filter can not be applied on the given object.