Class FidFilterImpl

  • All Implemented Interfaces:
    Filter, Id, FilterType
    Direct Known Subclasses:

    public class FidFilterImpl
    extends AbstractFilter
    implements Id
    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.

    Rob Hranac, TOPP, Justin Deoliveira, TOPP

    TODO: this class shoul be renamed to IdFilterImpl

    • Constructor Detail

      • FidFilterImpl

        protected FidFilterImpl​(Set<? extends Identifier> fids)
        Constructor which takes Identifier, not String.
    • Method Detail

      • getIDs

        public Set<Object> getIDs()
        Description copied from interface: Id
        Set of IDs representing the Identifiers used by this filter.
        Specified by:
        getIDs in interface Id
        See Also:
      • setIDs

        public void setIDs​(Set ids)
        See Also:
      • getFidsSet

        public Set<String> getFidsSet()
        Accessor method for fid set as Strings.
        the internally stored fids.
      • addFid

        public final void addFid​(String fid)
        Adds a feature ID to the filter.
        fid - A single feature ID.
      • addAllFids

        public void addAllFids​(Collection fidsToAdd)
        Adds a collection of feature IDs to the filter.
        fidsToAdd - A collection of feature IDs as strings.
      • removeFid

        public final void removeFid​(String fid)
        Removes a feature ID from the filter.
        fid - A single feature ID.
      • removeAllFids

        public void removeAllFids​(Collection fidsToRemove)
        Removes a collection of feature IDs from the filter.
        fidsToRemove - A collection of feature IDs.
      • evaluate

        public boolean evaluate​(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 Filter
        feature - Specified feature to examine.
        true if the feature's ID matches an fid held by this filter, false otherwise.
        See Also:
      • toString

        public String toString()
        Returns a string representation of this filter.
        toString in class Object
        String representation of the compare filter.
      • accept

        public 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.
        Specified by:
        accept in interface Filter
        visitor - The visitor which requires access to this filter, the method must call visitor.visit(this);
      • equals

        public boolean equals​(Object filter)
        Returns a flag indicating object equality.
        equals in class Object
        filter - the filter to test equality on.
        String representation of the compare filter.
      • hashCode

        public int hashCode()
        Override of hashCode method.
        hashCode in class Object
        a hash code value for this fid filter object.