org.geotools.filter
Class FidFilterImpl

java.lang.Object
  extended by org.geotools.filter.FilterAbstract
      extended by org.geotools.filter.AbstractFilter
          extended by org.geotools.filter.AbstractFilterImpl
              extended by org.geotools.filter.FidFilterImpl
All Implemented Interfaces:
FidFilter, FilterType, org.opengis.filter.Filter, org.opengis.filter.Id

public class FidFilterImpl
extends AbstractFilterImpl
implements FidFilter

Defines a ID filter, which holds a list of IDs ( usually feature id;s ). This filter stores a series of IDs, which are used to distinguish features uniquely.

Please note that addAllFids( Collection ) may be a performance hog; uDig makes use of its own implementation of FidFilter in order to reuse the internal set of fids between uses.

Version:
$Id: FidFilterImpl.java 31682 2008-10-19 13:23:25Z aaime $
Author:
Rob Hranac, TOPP, Justin Deoliveira, TOPP TODO: this class shoul be renamed to IdFilterImpl

Field Summary
 
Fields inherited from class org.geotools.filter.AbstractFilter
filterType, permissiveConstruction
 
Fields inherited from class org.geotools.filter.FilterAbstract
factory
 
Fields inherited from interface org.geotools.filter.Filter
ALL, NONE
 
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
 
Fields inherited from interface org.opengis.filter.Filter
EXCLUDE, INCLUDE
 
Constructor Summary
protected FidFilterImpl()
          Deprecated. use FidFilterImpl(Set)
protected FidFilterImpl(java.util.Set fids)
          Constructor which takes Identifier, not String.
protected FidFilterImpl(java.lang.String initialFid)
          Deprecated. use FidFilterImpl(Set)
 
Method Summary
 java.lang.Object accept(org.opengis.filter.FilterVisitor visitor, java.lang.Object extraData)
          Used by FilterVisitors to perform some action on this filter instance.
 void addAllFids(java.util.Collection fidsToAdd)
          Adds a collection of feature IDs to the filter.
 void addFid(java.lang.String fid)
          Deprecated.  
 boolean equals(java.lang.Object filter)
          Returns a flag indicating object equality.
 boolean evaluate(java.lang.Object feature)
          Determines whether or not the given feature's ID matches this filter.
 java.lang.String[] getFids()
          Deprecated. use getIDs()
 java.util.Set getFidsSet()
          Accessor method for fid set as Strings.
 java.util.Set getIdentifiers()
           
 java.util.Set getIDs()
           
 int hashCode()
          Override of hashCode method.
 void removeAllFids(java.util.Collection fidsToRemove)
          Removes a collection of feature IDs from the filter.
 void removeFid(java.lang.String fid)
          Removes a feature ID from the filter.
 void setIDs(java.util.Set ids)
           
 java.lang.String toString()
          Returns a string representation of this filter.
 
Methods inherited from class org.geotools.filter.AbstractFilterImpl
and, not, or
 
Methods inherited from class org.geotools.filter.AbstractFilter
accept, contains, getFilterType, isCompareFilter, isGeometryDistanceFilter, isGeometryFilter, isLogicFilter, isMathFilter, isSimpleFilter
 
Methods inherited from class org.geotools.filter.FilterAbstract
accepts, eval, eval, eval, evaluate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.filter.FidFilter
contains
 
Methods inherited from interface org.geotools.filter.Filter
accept, and, evaluate, getFilterType, not, or
 

Constructor Detail

FidFilterImpl

protected FidFilterImpl()
Deprecated. use FidFilterImpl(Set)

Empty constructor.


FidFilterImpl

protected FidFilterImpl(java.lang.String initialFid)
Deprecated. use FidFilterImpl(Set)

Constructor with first fid set

Parameters:
initialFid - The type of comparison.

FidFilterImpl

protected FidFilterImpl(java.util.Set fids)
Constructor which takes Identifier, not String.

Method Detail

getFids

public final java.lang.String[] getFids()
Deprecated. use getIDs()

Returns all the fids in this filter.

Specified by:
getFids in interface FidFilter
Returns:
An array of all the fids in this filter.

getIDs

public java.util.Set getIDs()
Specified by:
getIDs in interface org.opengis.filter.Id
See Also:
Id.getIDs()

getIdentifiers

public java.util.Set getIdentifiers()
Specified by:
getIdentifiers in interface org.opengis.filter.Id
See Also:
Id.getIdentifiers()

setIDs

public void setIDs(java.util.Set ids)
See Also:
org.opengis.filter.identity.FeatureId#setIDs(Set)

getFidsSet

public java.util.Set getFidsSet()
Accessor method for fid set as Strings.

Returns:
the internally stored fids.

addFid

public final void addFid(java.lang.String fid)
Deprecated. 

Adds a feature ID to the filter.

Specified by:
addFid in interface FidFilter
Parameters:
fid - A single feature ID.

addAllFids

public void addAllFids(java.util.Collection fidsToAdd)
Adds a collection of feature IDs to the filter.

Specified by:
addAllFids in interface FidFilter
Parameters:
fidsToAdd - A collection of feature IDs as strings.

removeFid

public final void removeFid(java.lang.String fid)
Removes a feature ID from the filter.

Specified by:
removeFid in interface FidFilter
Parameters:
fid - A single feature ID.

removeAllFids

public void removeAllFids(java.util.Collection fidsToRemove)
Removes a collection of feature IDs from the filter.

Specified by:
removeAllFids in interface FidFilter
Parameters:
fidsToRemove - A collection of feature IDs.

evaluate

public boolean evaluate(java.lang.Object feature)
Determines whether or not the given feature's ID matches this filter.

In order to get the object's ID, the PropertyAccessor capable of dealing with feature has to support the request of the expression "@id"

Specified by:
evaluate in interface org.opengis.filter.Filter
Parameters:
feature - Specified feature to examine.
Returns:
true if the feature's ID matches an fid held by this filter, false otherwise.
See Also:
SimpleFeaturePropertyAccessorFactory

toString

public java.lang.String toString()
Returns a string representation of this filter.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the compare filter.

accept

public java.lang.Object accept(org.opengis.filter.FilterVisitor visitor,
                               java.lang.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.

Specified by:
accept in interface org.opengis.filter.Filter
Overrides:
accept in class FilterAbstract
Parameters:
visitor - The visitor which requires access to this filter, the method must call visitor.visit(this);

equals

public boolean equals(java.lang.Object filter)
Returns a flag indicating object equality.

Overrides:
equals in class java.lang.Object
Parameters:
filter - the filter to test equality on.
Returns:
String representation of the compare filter.

hashCode

public int hashCode()
Override of hashCode method.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this fid filter object.


Copyright © 1996-2010 Geotools. All Rights Reserved.