Class SuffixStringMatcher


  • public class SuffixStringMatcher
    extends TrieStringMatcher
    A class for efficiently matching Strings against a set of suffixes. Zero-length Strings are ignored.
    • Constructor Detail

      • SuffixStringMatcher

        public SuffixStringMatcher​(String[] suffixes)
        Creates a new PrefixStringMatcher which will match Strings with any suffix in the supplied array.
        Parameters:
        suffixes - A array containing string suffixes
      • SuffixStringMatcher

        public SuffixStringMatcher​(Collection<String> suffixes)
        Creates a new PrefixStringMatcher which will match Strings with any suffix in the supplied Collection
        Parameters:
        suffixes - A Collection containing string suffixes
    • Method Detail

      • matches

        public boolean matches​(String input)
        Returns true if the given String is matched by a suffix in the trie
        Specified by:
        matches in class TrieStringMatcher
        Parameters:
        input - A String to be matched by a pattern
        Returns:
        true if there is a match, flase otherwise
      • shortestMatch

        public String shortestMatch​(String input)
        Returns the shortest suffix of input that is matched, or null if no match exists.
        Specified by:
        shortestMatch in class TrieStringMatcher
        Parameters:
        input - A String to be matched by a pattern
        Returns:
        shortest string match or null if no match is made
      • longestMatch

        public String longestMatch​(String input)
        Returns the longest suffix of input that is matched, or null if no match exists.
        Specified by:
        longestMatch in class TrieStringMatcher
        Parameters:
        input - A String to be matched by a pattern
        Returns:
        longest string match or null if no match is made
      • main

        public static final void main​(String[] argv)