Package 

Class PrefixStringMatcher

    • Constructor Summary

      Constructors 
      Constructor Description
      PrefixStringMatcher(Array<String> prefixes) Creates a new PrefixStringMatcher which will matchStrings with any prefix in the supplied array.
      PrefixStringMatcher(Collection<String> prefixes) Creates a new PrefixStringMatcher which will matchStrings with any prefix in the suppliedCollection.
    • 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 inthe trie Returns true if the given String is matched by a prefix in thetrie
      String shortestMatch(String input) Returns the shortest substring of input that ismatched by a pattern in the trie, or null if no matchexists. Returns the shortest prefix of input that is matched,or null if no match exists.
      String longestMatch(String input) Returns the longest substring of input that ismatched by a pattern in the trie, or null if no matchexists. Returns the longest prefix 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

      • PrefixStringMatcher

        PrefixStringMatcher(Array<String> prefixes)
        Creates a new PrefixStringMatcher which will matchStrings with any prefix in the supplied array.
        Parameters:
        prefixes - an array of java.lang.String objects.
      • PrefixStringMatcher

        PrefixStringMatcher(Collection<String> prefixes)
        Creates a new PrefixStringMatcher which will matchStrings with any prefix in the suppliedCollection.
        Parameters:
        prefixes - a java.util.Collection object.
    • Method Detail

      • matches

         boolean matches(String input)

        Returns true if the given String is matched by a pattern inthe trie Returns true if the given String is matched by a prefix in thetrie

      • shortestMatch

         String shortestMatch(String input)

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

      • longestMatch

         String longestMatch(String input)

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