org.geotools.filter
Interface Filter

All Superinterfaces:
org.opengis.filter.Filter, FilterType
All Known Subinterfaces:
BetweenFilter, CompareFilter, FidFilter, GeometryDistanceFilter, GeometryFilter, LikeFilter, LogicFilter, NullFilter
All Known Implementing Classes:
AbstractFilter, BetweenFilterImpl, CartesianDistanceFilter, CompareFilterImpl, FidFilterImpl, GeometryFilterImpl, LikeFilterImpl, LogicFilterImpl, NullFilterImpl

public interface Filter
extends FilterType, org.opengis.filter.Filter

Defines an OpenGIS Filter object, with default behaviors for all methods.

Version:
$Id: Filter.java 18021 2006-02-14 20:36:18Z jdeolive $
Author:
Rob Hranac, Vision for New York

Field Summary
static Filter ALL
          Implements the semantics of "filter all", that is, every call to contains will return false.
static Filter NONE
          Implements the semantics of "no filtering", that is, every call to contains will return true.
 
Fields inherited from interface org.geotools.filter.FilterType
BETWEEN, COMPARE_EQUALS, COMPARE_GREATER_THAN, COMPARE_GREATER_THAN_EQUAL, COMPARE_LESS_THAN, COMPARE_LESS_THAN_EQUAL, COMPARE_NOT_EQUALS, FID, GEOMETRY_BBOX, GEOMETRY_BEYOND, GEOMETRY_CONTAINS, GEOMETRY_CROSSES, GEOMETRY_DISJOINT, GEOMETRY_DWITHIN, GEOMETRY_EQUALS, GEOMETRY_INTERSECTS, GEOMETRY_OVERLAPS, GEOMETRY_TOUCHES, GEOMETRY_WITHIN, LIKE, LOGIC_AND, LOGIC_NOT, LOGIC_OR, NULL
 
Method Summary
 void accept(FilterVisitor visitor)
          Deprecated. use Filter.accept(FilterVisitor, Object).
 Filter and(Filter filter)
          Implements a logical AND with this filter and returns the merged filter.
 boolean contains(Feature feature)
          Deprecated. use evaluate(Feature)
 boolean evaluate(Feature feature)
          Evaluates the filter against an instance of Feature.
 short getFilterType()
          Deprecated. The enumeration base type system is replaced with a class based type system. An 'instanceof' check should be made instead of calling this method.
 Filter not()
          Implements a logical NOT with this filter and returns the negated filter
 Filter or(Filter filter)
          Implements a logical OR with this filter and returns the merged filter.
 
Methods inherited from interface org.opengis.filter.Filter
accept, evaluate
 

Field Detail

NONE

public static final Filter NONE
Implements the semantics of "no filtering", that is, every call to contains will return true. Logic table:
 NONE or Filter -> NONE
 NONE and Filter -> Filter
 not NONE -> ALL
 


ALL

public static final Filter ALL
Implements the semantics of "filter all", that is, every call to contains will return false. Logic table:
 ALL or Filter -> Filter
 ALL and Filter -> ALL
 not ALL -> NONE
 

Method Detail

evaluate

public boolean evaluate(Feature feature)
Evaluates the filter against an instance of Feature.

Parameters:
feature - The feature being tested.
Returns:
True if the feature is filtered, otherwise false.

contains

public boolean contains(Feature feature)
Deprecated. use evaluate(Feature)

Determines whether or not a given feature is 'contained by' this filter.

This is the core function of any filter. 'Contains' isn't a very good term for this method because it implies some sort of spatial relationship between the feature and the filter that may or may not exist. We name this method 'contains' only because the usage of 'contains' in this context is common and better terms are lacking. However, users of this method should keep in mind the non-spatial nature of this meaning of 'contains.' For example, a feature may be 'contained by' a filter if one of the feature's non-spatial property values is equal to that of the filter's.

Although some filters can be checked for validity when they are constructed, it is impossible to impose this check on all expressions because of a special feature of the ExpressionAttribute class. This class must hold the pointer (in XPath) to an attribute, but it is not passed the actual attribute (inside a feature) until it calls the isInside class.

To avoid a run-time Exception, this class is typed (ie. Double, Integer, String) when it is created. If the attribute found inside the feature is found not to conform with its stated type, then a MalformedExpressionException is thrown when contains is called. Since ExpressionAttribute classes may be nested inside any filter, all filters must throw this exception. It is left to callers of this method to deal with it gracefully.

Parameters:
feature - Specified feature to examine.
Returns:
True if filter contains passed feature.

and

public Filter and(Filter filter)
Implements a logical AND with this filter and returns the merged filter.

Parameters:
filter - The filter to AND with this filter.
Returns:
Combined filter.

or

public Filter or(Filter filter)
Implements a logical OR with this filter and returns the merged filter.

Parameters:
filter - The filter to OR with this filter.
Returns:
Combined filter.

not

public Filter not()
Implements a logical NOT with this filter and returns the negated filter

Returns:
Combined filter.

getFilterType

public short getFilterType()
Deprecated. The enumeration base type system is replaced with a class based type system. An 'instanceof' check should be made instead of calling this method.

DOCUMENT ME!

Returns:
DOCUMENT ME!
Task:
Gets a short representation of the type of this filter.

accept

public void accept(FilterVisitor visitor)
Deprecated. use Filter.accept(FilterVisitor, Object).

Used by FilterVisitors to perform some action on this filter instance. Typicaly used by Filter decoders, but may also be used by any thing which needs infomration from filter structure. Implementations should always call: visitor.visit(this); It is importatant that this is not left to a parent class unless the parents API is identical.

Parameters:
visitor - The visitor which requires access to this filter, the method must call visitor.visit(this);


Copyright © GeoTools. All Rights Reserved.