org.geotools.filter
Class FilterFactoryImpl

java.lang.Object
  extended byorg.geotools.filter.Expr
      extended byorg.geotools.filter.FilterFactoryImpl
All Implemented Interfaces:
Factory, FilterFactory, org.opengis.filter.FilterFactory
Direct Known Subclasses:
HsqlFilterFactoryImpl

public class FilterFactoryImpl
extends Expr
implements FilterFactory

Implementation of the FilterFactory, generates the filter implementations in defaultcore.

Version:
$Id: FilterFactoryImpl.java 18021 2006-02-14 20:36:18Z jdeolive $
Author:
Ian Turton, CCG

Constructor Summary
FilterFactoryImpl()
          Creates a new instance of FilterFactoryImpl
 
Method Summary
 Filter and(Filter f1, Filter f2)
           
 AttributeExpression createAttributeExpression(AttributeType at)
          Shortcut the process - will only grab values matching AttributeType.
 AttributeExpression createAttributeExpression(FeatureType schema)
          Creates a Attribute Expression with an initial schema.
 AttributeExpression createAttributeExpression(FeatureType schema, java.lang.String path)
          Creates a Attribute Expression given a schema and attribute path.
 AttributeExpression createAttributeExpression(java.lang.String xpath)
          Creates an AttributeExpression using the supplied xpath.
 BBoxExpression createBBoxExpression(com.vividsolutions.jts.geom.Envelope env)
          Creates a BBox Expression from an envelope.
 BetweenFilter createBetweenFilter()
          Creates an empty Between Filter.
 CompareFilter createCompareFilter(short type)
          Deprecated. @see org.geotools.filter.FilterFactory#createCompareFilter(short)
 EnvironmentVariable createEnvironmentVariable(java.lang.String name)
          Creates an Environment Variable
 FidFilter createFidFilter()
          Creates a new Fid Filter with no initial fids.
 FidFilter createFidFilter(java.lang.String fid)
          Creates a Fid Filter with an initial fid.
 FunctionExpression createFunctionExpression(java.lang.String name)
          Creates a Function Expression.
 GeometryDistanceFilter createGeometryDistanceFilter(short filterType)
          Creates a Geometry Distance Filter
 GeometryFilter createGeometryFilter(short filterType)
          Creates a Geometry Filter.
 LikeFilter createLikeFilter()
          Creates a Like Filter.
 LiteralExpression createLiteralExpression()
          Creates an empty Literal Expression
 LiteralExpression createLiteralExpression(double d)
          Creates a Double Literal Expression
 LiteralExpression createLiteralExpression(int i)
          Creates an Integer Literal Expression.
 LiteralExpression createLiteralExpression(java.lang.Object o)
          Creates a Literal Expression from an Object.
 LiteralExpression createLiteralExpression(java.lang.String s)
          Creates a String Literal Expression
 LogicFilter createLogicFilter(Filter filter1, Filter filter2, short filterType)
          Deprecated. use one of FilterFactory.and(Filter, Filter) FilterFactory.or(Filter, Filter) FilterFactory.not(Filter)
 LogicFilter createLogicFilter(Filter filter, short filterType)
          Deprecated. use one of FilterFactory.and(Filter, Filter) FilterFactory.or(Filter, Filter) FilterFactory.not(Filter)
 LogicFilter createLogicFilter(short filterType)
          Deprecated. use one of FilterFactory.and(Filter, Filter) FilterFactory.or(Filter, Filter) FilterFactory.not(Filter)
 MathExpression createMathExpression()
          Deprecated. use one of FilterFactory.add(Expression, Expression) FilterFactory.subtract(Expression, Expression) FilterFactory.multiply(Expression, Expression) FilterFactory.divide(Expression, Expression)
 MathExpression createMathExpression(short expressionType)
          Creates a Math Expression of the given type.
 NullFilter createNullFilter()
          Creates an empty Null Filter.
 java.util.Map getImplementationHints()
          Map of hints (maybe unmodifiable) used by this factory to customize its use.
 Filter not(Filter f)
           
 Filter or(Filter f1, Filter f2)
           
 org.opengis.filter.sort.SortBy sort(java.lang.String propertyName, org.opengis.filter.sort.SortOrder order)
           
 
Methods inherited from class org.geotools.filter.Expr
add, and, and, bbox, between, beyond, contains, crosses, disjoint, divide, dwithin, equals, equals, featureId, function, function, function, function, greater, greaterOrEqual, intersects, isNull, less, lessOrEqual, like, like, literal, literal, literal, literal, literal, literal, literal, literal, literal, multiply, not, or, or, overlaps, property, subtract, touches, within
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengis.filter.FilterFactory
add, and, and, bbox, between, beyond, contains, crosses, disjoint, divide, dwithin, equals, equals, featureId, function, function, function, function, greater, greaterOrEqual, intersects, isNull, less, lessOrEqual, like, like, literal, literal, literal, literal, literal, literal, literal, literal, literal, multiply, not, or, or, overlaps, property, subtract, touches, within
 

Constructor Detail

FilterFactoryImpl

public FilterFactoryImpl()
Creates a new instance of FilterFactoryImpl

Method Detail

createAttributeExpression

public AttributeExpression createAttributeExpression(java.lang.String xpath)
Creates an AttributeExpression using the supplied xpath.

The supplied xpath can be used to query a varity of content - most notably Features.

Specified by:
createAttributeExpression in interface FilterFactory
Parameters:
xpath - XPath used to retrive value
Returns:
The new Attribtue Expression

createAttributeExpression

public AttributeExpression createAttributeExpression(FeatureType schema)
Creates a Attribute Expression with an initial schema.

Specified by:
createAttributeExpression in interface FilterFactory
Parameters:
schema - the schema to create with.
Returns:
The new Attribute Expression.

createAttributeExpression

public AttributeExpression createAttributeExpression(FeatureType schema,
                                                     java.lang.String path)
                                              throws IllegalFilterException
Creates a Attribute Expression given a schema and attribute path.

Specified by:
createAttributeExpression in interface FilterFactory
Parameters:
schema - the schema to get the attribute from.
path - the xPath of the attribute to compare.
Returns:
The new Attribute Expression.
Throws:
IllegalFilterException - if there were creation problems.

createAttributeExpression

public AttributeExpression createAttributeExpression(AttributeType at)
                                              throws IllegalFilterException
Description copied from interface: FilterFactory
Shortcut the process - will only grab values matching AttributeType.

Specified by:
createAttributeExpression in interface FilterFactory
Parameters:
at -
Returns:
The new Attribtue Expression
Throws:
IllegalFilterException - if there were creation problems

createBBoxExpression

public BBoxExpression createBBoxExpression(com.vividsolutions.jts.geom.Envelope env)
                                    throws IllegalFilterException
Creates a BBox Expression from an envelope.

Specified by:
createBBoxExpression in interface FilterFactory
Parameters:
env - the envelope to use for this bounding box.
Returns:
The newly created BBoxExpression.
Throws:
IllegalFilterException - if there were creation problems.

createBetweenFilter

public BetweenFilter createBetweenFilter()
                                  throws IllegalFilterException
Creates an empty Between Filter.

Specified by:
createBetweenFilter in interface FilterFactory
Returns:
The new Between Filter.
Throws:
IllegalFilterException - if there were creation problems.

createCompareFilter

public CompareFilter createCompareFilter(short type)
                                  throws IllegalFilterException
Deprecated. @see org.geotools.filter.FilterFactory#createCompareFilter(short)

Creates a new compare filter of the given type.

Specified by:
createCompareFilter in interface FilterFactory
Parameters:
type - the type of comparison - must be a compare type.
Returns:
The new compare filter.
Throws:
IllegalFilterException - if there were creation problems.

createFidFilter

public FidFilter createFidFilter()
Creates a new Fid Filter with no initial fids.

Specified by:
createFidFilter in interface FilterFactory
Returns:
The new Fid Filter.

createFidFilter

public FidFilter createFidFilter(java.lang.String fid)
Creates a Fid Filter with an initial fid.

Specified by:
createFidFilter in interface FilterFactory
Parameters:
fid - the feature ID to create with.
Returns:
The new FidFilter.

createGeometryFilter

public GeometryFilter createGeometryFilter(short filterType)
                                    throws IllegalFilterException
Creates a Geometry Filter.

Specified by:
createGeometryFilter in interface FilterFactory
Parameters:
filterType - the type to create, must be a geometry type.
Returns:
The new Geometry Filter.
Throws:
IllegalFilterException - if the filterType is not a geometry.

createGeometryDistanceFilter

public GeometryDistanceFilter createGeometryDistanceFilter(short filterType)
                                                    throws IllegalFilterException
Creates a Geometry Distance Filter

Specified by:
createGeometryDistanceFilter in interface FilterFactory
Parameters:
filterType - the type to create, must be beyond or dwithin.
Returns:
The new Expression
Throws:
IllegalFilterException - if the filterType is not a geometry distance type.

createLikeFilter

public LikeFilter createLikeFilter()
Creates a Like Filter.

Specified by:
createLikeFilter in interface FilterFactory
Returns:
The new Like Filter.

createLiteralExpression

public LiteralExpression createLiteralExpression()
Creates an empty Literal Expression

Specified by:
createLiteralExpression in interface FilterFactory
Returns:
The new Literal Expression.

createLiteralExpression

public LiteralExpression createLiteralExpression(java.lang.Object o)
                                          throws IllegalFilterException
Creates a Literal Expression from an Object.

Specified by:
createLiteralExpression in interface FilterFactory
Parameters:
o - the object to serve as the literal.
Returns:
The new Literal Expression
Throws:
IllegalFilterException - if there were creation problems.

createLiteralExpression

public LiteralExpression createLiteralExpression(int i)
Creates an Integer Literal Expression.

Specified by:
createLiteralExpression in interface FilterFactory
Parameters:
i - the int to serve as literal.
Returns:
The new Literal Expression

createLiteralExpression

public LiteralExpression createLiteralExpression(double d)
Creates a Double Literal Expression

Specified by:
createLiteralExpression in interface FilterFactory
Parameters:
d - the double to serve as the literal.
Returns:
The new Literal Expression

createLiteralExpression

public LiteralExpression createLiteralExpression(java.lang.String s)
Creates a String Literal Expression

Specified by:
createLiteralExpression in interface FilterFactory
Parameters:
s - the string to serve as the literal.
Returns:
The new Literal Expression

createLogicFilter

public LogicFilter createLogicFilter(short filterType)
                              throws IllegalFilterException
Deprecated. use one of FilterFactory.and(Filter, Filter) FilterFactory.or(Filter, Filter) FilterFactory.not(Filter)

Creates an empty logic filter from a type.

Specified by:
createLogicFilter in interface FilterFactory
Parameters:
filterType - must be a logic type.
Returns:
the newly constructed logic filter.
Throws:
IllegalFilterException - If there were any problems creating the filter, including wrong type.

createLogicFilter

public LogicFilter createLogicFilter(Filter filter,
                                     short filterType)
                              throws IllegalFilterException
Deprecated. use one of FilterFactory.and(Filter, Filter) FilterFactory.or(Filter, Filter) FilterFactory.not(Filter)

Creates a logic filter with an initial filter.

Specified by:
createLogicFilter in interface FilterFactory
Parameters:
filter - the initial filter to set.
filterType - Must be a logic type.
Returns:
the newly constructed logic filter.
Throws:
IllegalFilterException - If there were any problems creating the filter, including wrong type.

createLogicFilter

public LogicFilter createLogicFilter(Filter filter1,
                                     Filter filter2,
                                     short filterType)
                              throws IllegalFilterException
Deprecated. use one of FilterFactory.and(Filter, Filter) FilterFactory.or(Filter, Filter) FilterFactory.not(Filter)

Creates a logic filter from two filters and a type.

Specified by:
createLogicFilter in interface FilterFactory
Parameters:
filter1 - the first filter to join.
filter2 - the second filter to join.
filterType - must be a logic type.
Returns:
the newly constructed logic filter.
Throws:
IllegalFilterException - If there were any problems creating the filter, including wrong type.

createMathExpression

public MathExpression createMathExpression()
Deprecated. use one of FilterFactory.add(Expression, Expression) FilterFactory.subtract(Expression, Expression) FilterFactory.multiply(Expression, Expression) FilterFactory.divide(Expression, Expression)

Creates a Math Expression

Specified by:
createMathExpression in interface FilterFactory
Returns:
The new Math Expression

createMathExpression

public MathExpression createMathExpression(short expressionType)
                                    throws IllegalFilterException
Creates a Math Expression of the given type.

Specified by:
createMathExpression in interface FilterFactory
Parameters:
expressionType - must be a math expression type.
Returns:
The new Math Expression.
Throws:
IllegalFilterException - if there were creation problems.

createFunctionExpression

public FunctionExpression createFunctionExpression(java.lang.String name)
Creates a Function Expression.

Specified by:
createFunctionExpression in interface FilterFactory
Parameters:
name - the function name.
Returns:
The new Function Expression.

createNullFilter

public NullFilter createNullFilter()
Creates an empty Null Filter.

Specified by:
createNullFilter in interface FilterFactory
Returns:
The new Null Filter.

createEnvironmentVariable

public EnvironmentVariable createEnvironmentVariable(java.lang.String name)
Description copied from interface: FilterFactory
Creates an Environment Variable

Specified by:
createEnvironmentVariable in interface FilterFactory
Parameters:
name - the function name.
Returns:
The new Function Expression.

getImplementationHints

public java.util.Map getImplementationHints()
Description copied from interface: Factory
Map of hints (maybe unmodifiable) used by this factory to customize its use. This map is not guaranteed to contains all the hints supplied by the user; it may be only a subset. Consequently, hints provided here are usually not suitable for creating new factories, unless the implementation make some additional garantees (e.g. FactoryUsingVolatileDependencies).

The primary purpose of this method is to determine if an existing factory instance can be reused for a set of user-supplied hints. This method is invoked by FactoryRegistry in order to compare this factory's hints against user's hints. This is dependency introspection only; never invokes this method for creating new factories.

Keys are usually static constants from the Hints class, while values are instances of some key-dependent class. The key set must contains at least all hints impacting functionality. While the key set may contains all hints supplied by the user, it is recommended to limit the set to only the hints used by this particular factory instance. A minimal set will helps FactoryRegistry to compares only hints that matter and avoid the creation of unnecessary instances of this factory.

The hint values may be different than the one supplied by the user. If a user supplied a hint as a Class object, this method shall replace it by the actual instance used, if possible.

Implementations of this method are usually quite simple. For example if a datum authority factory uses an ordinary datum factory, its method could be implemented as below (note that we should not check if the datum factory is null, since key with null value is the expected behaviour in this case). Example:


 Map hints = new HashMap();
 hints.put(Hints.DATUM_FACTORY, datumFactory);
 return hints;
 

Specified by:
getImplementationHints in interface Factory
Returns:
The map of hints, or an empty map if none.

and

public Filter and(Filter f1,
                  Filter f2)
Specified by:
and in interface FilterFactory

or

public Filter or(Filter f1,
                 Filter f2)
Specified by:
or in interface FilterFactory

not

public Filter not(Filter f)
Specified by:
not in interface FilterFactory

sort

public org.opengis.filter.sort.SortBy sort(java.lang.String propertyName,
                                           org.opengis.filter.sort.SortOrder order)
Specified by:
sort in interface org.opengis.filter.FilterFactory


Copyright © GeoTools. All Rights Reserved.