Class PluginLocaleEntry


  • public class PluginLocaleEntry
    extends Object
    The Locale entry on the plugin has a localeTag (e.g. en, en-US, or *) and an associated set of Header Entries. These Header entries are used to match against the stream name and indicate a confidence in the value of the match.
    • Constructor Summary

      Constructors 
      Constructor Description
      PluginLocaleEntry()  
      PluginLocaleEntry​(String localeTag)
      Simple Constructor for use when have a single Language tag and no header information.
      PluginLocaleEntry​(String localeTag, String headerRegExp, int confidence, String regExpReturned)
      Simple Constructor for use when have a single Language tag and a single header (regular expression, confidence pair).
    • Field Detail

      • localeTag

        public String localeTag
      • headerRegExps

        public HeaderEntry[] headerRegExps
    • Constructor Detail

      • PluginLocaleEntry

        public PluginLocaleEntry()
      • PluginLocaleEntry

        public PluginLocaleEntry​(String localeTag,
                                 String headerRegExp,
                                 int confidence,
                                 String regExpReturned)
        Simple Constructor for use when have a single Language tag and a single header (regular expression, confidence pair).
        Parameters:
        localeTag - The localeTag we are using to construct the Locale Entry.
        headerRegExp - The Regular Expression used to match against the stream name.
        confidence - The confidence in our assessment that this is the Semantic Type if the regular expression matches.
        regExpReturned - The Regular Expressed returned in the case of a successful match.
      • PluginLocaleEntry

        public PluginLocaleEntry​(String localeTag)
        Simple Constructor for use when have a single Language tag and no header information.
        Parameters:
        localeTag - The localeTag we are using to construct the Locale Entry.
    • Method Detail

      • isRegExpComplete

        public boolean isRegExpComplete​(int matchEntry)
        Is the returned Regular Expression a true and complete representation of the Semantic Type. For example, \\d{5} is not for US ZIP codes (e.g. 00000 is not a valid Zip), whereas (?i)(male|female) could be valid for a Gender.
        Parameters:
        matchEntry - The MatchEntry we have concluded is the correct one.
        Returns:
        The Java Regular Expression that most closely matches this Semantic Type.
      • getRegExpReturned

        public String getRegExpReturned​(int matchEntry)
      • getMatchEntryIndex

        public int getMatchEntryIndex​(String regExp,
                                      int matchEntry)
      • simple

        public static PluginLocaleEntry[] simple​(String[] localeTags)
        Parameters:
        localeTags - Construct an array of simple Locale Entries based on a set of locale tags.
        Returns:
        An array of Locale Entries with only the tag set - no header information.
      • getHeaderConfidence

        public int getHeaderConfidence​(String dataStreamName)
        Determine the confidence that the name of the data stream is likely a valid header for this PluginLocaleEntry.
        Parameters:
        dataStreamName - The name of this data stream
        Returns:
        An integer between 0 and 100 reflecting the confidence that this stream name is a valid header.
      • toString

        public String toString()
        Overrides:
        toString in class Object