Class SuffixStringMatcher

  • All Implemented Interfaces:

    
    public class SuffixStringMatcher
    extends TrieStringMatcher
                        

    A class for efficiently matching Strings against a set of suffixes. Zero-length Strings are ignored.

    Author:

    vincent

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      SuffixStringMatcher(Array<String> suffixes) Creates a new PrefixStringMatcher which will match Strings with any suffix in the supplied array.
      SuffixStringMatcher(Collection<String> suffixes) Creates a new PrefixStringMatcher which will match Strings with any suffix in the supplied Collection
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static void main(Array<String> argv) main.
      boolean matches(String input) Returns true if the given String is matched by a pattern in the trie Returns true if the given String is matched by a suffix in the trie
      String shortestMatch(String input) Returns the shortest substring of input
       that is 
           matched by a pattern in the trie, or 
      null
       if no match 
           exists.
           
            
           
            Returns the shortest suffix of 
      input
      that is matched, or
      null
      if no match exists.
      String longestMatch(String input) Returns the longest substring of input
       that is 
           matched by a pattern in the trie, or 
      null
       if no match 
           exists.
           
            
           
            Returns the longest suffix of 
      input
      that is matched, or
      null
      if no match exists.
      • Methods inherited from class java.lang.Object

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

      • SuffixStringMatcher

        SuffixStringMatcher(Array<String> suffixes)
        Creates a new PrefixStringMatcher which will match Strings with any suffix in the supplied array.
        Parameters:
        suffixes - an array of java.lang.String objects.
      • SuffixStringMatcher

        SuffixStringMatcher(Collection<String> suffixes)
        Creates a new PrefixStringMatcher which will match Strings with any suffix in the supplied Collection
        Parameters:
        suffixes - a java.util.Collection object.
    • Method Detail

      • matches

         boolean matches(String input)

        Returns true if the given String is matched by a pattern in the trie Returns true if the given String is matched by a suffix in the trie

      • shortestMatch

         String shortestMatch(String input)

        Returns the shortest substring of input

         that is 
             matched by a pattern in the trie, or 
        null
         if no match 
             exists.
             
              
             
              Returns the shortest suffix of 
        input
        that is matched, or
        null
        if no match exists.

      • longestMatch

         String longestMatch(String input)

        Returns the longest substring of input

         that is 
             matched by a pattern in the trie, or 
        null
         if no match 
             exists.
             
              
             
              Returns the longest suffix of 
        input
        that is matched, or
        null
        if no match exists.