Package org.geotools.filter
Class CompareFilterImpl
- Object
-
- FilterAbstract
-
- AbstractFilter
-
- BinaryComparisonAbstract
-
- CompareFilterImpl
-
- All Implemented Interfaces:
Filter
,MultiValuedFilter
,FilterType
- Direct Known Subclasses:
IsBetweenImpl
,IsNilImpl
,IsNullImpl
,MultiCompareFilterImpl
public abstract class CompareFilterImpl extends BinaryComparisonAbstract
Defines a comparison filter (can be a math comparison or generic equals). This filter implements a comparison - of some sort - between two expressions. The comparison may be a math comparison or a generic equals comparison. If it is a math comparison, only math expressions are allowed; if it is an equals comparison, any expression types are allowed. Note that this comparison does not attempt to restrict its expressions to be meaningful. This means that it considers itself a valid filter as long as the expression comparison returns a valid result. It does no checking to see whether or not the expression comparison is meaningful with regard to checking feature attributes. In other words, this is a valid filter: 52 = 92, even though it will always return the same result and could be simplified away. It is up the the filter creator, therefore, to attempt to simplify/make meaningful filter logic.- Author:
- Rob Hranac, Vision for New York
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface MultiValuedFilter
MultiValuedFilter.MatchAction
-
-
Field Summary
-
Fields inherited from class BinaryComparisonAbstract
expression1, expression2
-
Fields inherited from interface FilterType
ALL, 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, NONE, NULL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CompareFilterImpl(Expression e1, Expression e2)
protected
CompareFilterImpl(Expression e1, Expression e2, boolean matchCase)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Object
accept(FilterVisitor visitor, Object extraData)
Used by FilterVisitors to perform some action on this filter instance.protected int
compare(Comparable leftObj, Comparable rightObj)
Subclass convenience method which compares to instances of comparables in a pretty lax way, converting types among String, Number, Double when appropriate.boolean
equals(Object obj)
Compares this filter to the specified object.int
hashCode()
Override of hashCode method.void
setExpression1(Expression leftValue)
void
setExpression2(Expression rightValue)
String
toString()
Returns a string representation of this filter.-
Methods inherited from class BinaryComparisonAbstract
comparable, eval, eval, getExpression1, getExpression2, getMatchAction, isMatchingCase
-
Methods inherited from class AbstractFilter
isCompareFilter, isGeometryDistanceFilter, isGeometryFilter, isLogicFilter, isMathFilter, isSimpleFilter
-
Methods inherited from class FilterAbstract
accepts, eval, eval
-
-
-
-
Constructor Detail
-
CompareFilterImpl
protected CompareFilterImpl(Expression e1, Expression e2)
-
CompareFilterImpl
protected CompareFilterImpl(Expression e1, Expression e2, boolean matchCase)
-
-
Method Detail
-
setExpression1
public void setExpression1(Expression leftValue)
- Overrides:
setExpression1
in classBinaryComparisonAbstract
-
setExpression2
public void setExpression2(Expression rightValue)
- Overrides:
setExpression2
in classBinaryComparisonAbstract
-
compare
protected int compare(Comparable leftObj, Comparable rightObj)
Subclass convenience method which compares to instances of comparables in a pretty lax way, converting types among String, Number, Double when appropriate.- Returns:
- same contract as
Comparable.compareTo(java.lang.Object)
.
-
toString
public String toString()
Returns a string representation of this filter.
-
equals
public boolean equals(Object obj)
Compares this filter to the specified object. Returns true if the passed in object is the same as this filter. Checks to make sure the filter types are the same as well as both of the values.
-
hashCode
public int hashCode()
Override of hashCode method.
-
accept
public abstract Object accept(FilterVisitor visitor, Object extraData)
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);
-
-