Package org.geotools.filter
Class LogicFilterImpl
- Object
-
- FilterAbstract
-
- AbstractFilter
-
- BinaryLogicAbstract
-
- LogicFilterImpl
-
- All Implemented Interfaces:
Filter
,FilterType
public abstract class LogicFilterImpl extends BinaryLogicAbstract
Defines a logic filter (the only filter type that contains other filters). This filter holds one or more filters together and relates them logically with an internally defined type (AND, OR, NOT).- Author:
- Rob Hranac, TOPP
-
-
Field Summary
-
Fields inherited from class BinaryLogicAbstract
children
-
Fields inherited from class AbstractFilter
LOGGER
-
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
LogicFilterImpl(List<Filter> children)
protected
LogicFilterImpl(Filter filter1, Filter filter2, short filterType)
Convenience constructor to create an AND/OR logic filter.
-
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.void
addFilter(Filter filter)
Adds a sub filter to this filter.boolean
equals(Object o)
Compares this filter to the specified object.Iterator
getFilterIterator()
Gets an iterator for the filters held by this logic filter.int
hashCode()
Override of hashCode method.String
toString()
Returns a string representation of this filter.-
Methods inherited from class BinaryLogicAbstract
getChildren, setChildren
-
Methods inherited from class AbstractFilter
isCompareFilter, isGeometryDistanceFilter, isGeometryFilter, isLogicFilter, isMathFilter, isSimpleFilter
-
Methods inherited from class FilterAbstract
accepts, eval, eval
-
-
-
-
Constructor Detail
-
LogicFilterImpl
protected LogicFilterImpl(Filter filter1, Filter filter2, short filterType) throws IllegalFilterException
Convenience constructor to create an AND/OR logic filter.- Parameters:
filter1
- An initial sub filter.filter2
- An initial sub filter.filterType
- The final relation between all sub filters.- Throws:
IllegalFilterException
- Does not conform to logic filter structure
-
-
Method Detail
-
addFilter
public final void addFilter(Filter filter) throws IllegalFilterException
Adds a sub filter to this filter.- Parameters:
filter
- Specified filter to add to the sub filter list.- Throws:
IllegalFilterException
- Does not conform to logic filter structure- TODO:
- REVISIT: make all filters immutable. This should return a new filter.
-
getFilterIterator
public Iterator getFilterIterator()
Gets an iterator for the filters held by this logic filter.- Returns:
- the iterator of the filters.
-
toString
public String toString()
Returns a string representation of this filter.
-
equals
public boolean equals(Object o)
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, and then checks that the subFilters lists are the same size and that one list contains the other. This means that logic filters with different internal orders of subfilters are equal.- Overrides:
equals
in classBinaryLogicAbstract
- Parameters:
o
- - the object to compare this LogicFilter against.- Returns:
- true if specified object is equal to this filter; false otherwise.
-
hashCode
public int hashCode()
Override of hashCode method.- Overrides:
hashCode
in classBinaryLogicAbstract
- Returns:
- a code to hash this object by.
-
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);
-
-