Class FilterSAXParser


  • public class FilterSAXParser
    extends Object
    Creates filters from FilterFilter, which reads in a SAX stream and passes the appropriate messages here.
    Author:
    Rob Hranac, Vision for New York
    , Chris Holmes, TOPP
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Filter create()
      Creates the filter held in the parser.
      void expression​(Expression expression)
      Adds the passed in expression to the current filter.
      void setAttributes​(Attributes atts)
      Sets the filter attributes.
      void setDistance​(String distance, String units)
      This sets the distance for a GeometryDistanceFilter.
      void setFilterFactory​(FilterFactory factory)
      Setter injection
      void start​(short filterType)
      Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.
      void value​(String message)
      Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FilterSAXParser

        public FilterSAXParser()
        Constructor which flags the operator as between.
      • FilterSAXParser

        public FilterSAXParser​(FilterFactory factory)
        Constructor injdection
    • Method Detail

      • setFilterFactory

        public void setFilterFactory​(FilterFactory factory)
        Setter injection
      • start

        public void start​(short filterType)
                   throws IllegalFilterException
        Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.
        Parameters:
        filterType - The string from the SAX filter.
        Throws:
        IllegalFilterException - Filter is illegal.
      • value

        public void value​(String message)
                   throws IllegalFilterException
        Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.
        Parameters:
        message - The string from the SAX filter.
        Throws:
        IllegalFilterException - Filter is illegal.
      • expression

        public void expression​(Expression expression)
                        throws IllegalFilterException
        Adds the passed in expression to the current filter. Generally created by the ExpressionSAXParser.
        Parameters:
        expression - The value of the attribute for comparison.
        Throws:
        IllegalFilterException - if the expression does not match what the current filter is expecting.
        TODO:
        REVISIT: split this method up.
      • setDistance

        public void setDistance​(String distance,
                                String units)
                         throws IllegalFilterException
        This sets the distance for a GeometryDistanceFilter. It currently ignores the units, and attempts to convert the distance to a double.
        Parameters:
        distance - the distance - should be a string of a double.
        units - a reference to a units dictionary.
        Throws:
        IllegalFilterException - if the distance string can not be converted to a double.
        TODO:
        TODO: Implement units, probably with org.geotools.units package and a special distance class in the filter package. It would be nice if the distance class could get any type of units, like it would handle the conversion.
      • setAttributes

        public void setAttributes​(Attributes atts)
        Sets the filter attributes. Called when attributes are encountered by the filter filter. Puts them in a hash map by thier name and value.
        Parameters:
        atts - the attributes to set.