Class XCoord

  • All Implemented Interfaces:
    Extractor

    public class XCoord
    extends AbstractFlexPat
    Use this XCoord class for both test and development of patterns, as well as to extract coordinates at runtime.
    Author:
    ubaldino
    • Field Detail

      • RUNTIME_FLAGS

        public static long RUNTIME_FLAGS
        Reserved. This is a bit mask for caller to use. DEFAULTS: (a) enable all false-positive filters for coordinate types; (b) extract context around coordinate.
      • DEFAULT_XCOORD_CFG

        protected static final java.lang.String DEFAULT_XCOORD_CFG
        See Also:
        Constant Field Values
    • Constructor Detail

      • XCoord

        public XCoord​(boolean debugmode)
        Debugging constructor -- if debugmode = True, enable debugging else if log4j debug mode is enabled, respect that.
        Parameters:
        debugmode -
      • XCoord

        public XCoord()
        Default constructor, debugging off.
    • Method Detail

      • cleanup

        public void cleanup()
        Extractor interface: extractors are responsible for cleaning up after themselves.
      • getName

        public java.lang.String getName()
        Extractor interface: getName
        Returns:
        name of extractor
      • createPatternManager

        protected RegexPatternManager createPatternManager​(java.io.InputStream s,
                                                           java.lang.String n)
                                                    throws java.io.IOException
        Description copied from class: AbstractFlexPat
        Create a pattern manager given the input stream and the file name.
        Specified by:
        createPatternManager in class AbstractFlexPat
        Parameters:
        s - stream of patterns config file
        n - app name
        Returns:
        the regex pattern manager
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • extract

        public java.util.List<TextMatch> extract​(TextInput input)
        Support the standard Extractor interface. This provides access to the most common extraction;
        Parameters:
        input - text input
        Returns:
        the list of matches
      • extract

        public java.util.List<TextMatch> extract​(java.lang.String input_buf)
        Support the standard Extractor interface. This provides access to the most common extraction;
        Parameters:
        input_buf - text
        Returns:
        the list of matches
      • match_DMS

        public void match_DMS​(boolean flag)
        Enable matching of DMS patterns
        Parameters:
        flag - on/off
      • match_DM

        public void match_DM​(boolean flag)
        Enable matching of DM patterns
        Parameters:
        flag - on/off
      • match_DD

        public void match_DD​(boolean flag)
        Enable matching of DD patterns
        Parameters:
        flag - on/off
      • match_MGRS

        public void match_MGRS​(boolean flag)
        Enable matching of MGRS patterns
        Parameters:
        flag - on/off
      • match_UTM

        public void match_UTM​(boolean flag)
        Enable matching of UTM patterns
        Parameters:
        flag - on/off
      • extract_coordinates

        public TextMatchResult extract_coordinates​(java.lang.String text,
                                                   java.lang.String text_id)
        Assess all enabled patterns against the given text. Resulting TextMatch objects carry both the original text ID and their own match ID
        Parameters:
        text - text to match against
        text_id - identifier for text.
        Returns:
      • extract_coordinates

        public TextMatchResult extract_coordinates​(java.lang.String text,
                                                   java.lang.String text_id,
                                                   int family)
        Limit the extraction to a particular family of coordinates. Diagnostic messages appear in TextMatchResultSet only when debug = ON.
        Parameters:
        text - text to match
        text_id - id for text
        family - pattern family or XConstants.ALL_PATTERNS
        Returns:
        TextMatchResultSet result set. If input is null, result set is null