-
public class SuffixStringMatcher extends TrieStringMatcher
A class for efficiently matching
Strings against a set of suffixes. Zero-lengthStringsare ignored.
-
-
Constructor Summary
Constructors Constructor Description SuffixStringMatcher(Array<String> suffixes)Creates a new PrefixStringMatcherwhich will matchStrings with any suffix in the supplied array.SuffixStringMatcher(Collection<String> suffixes)Creates a new PrefixStringMatcherwhich will matchStrings with any suffix in the suppliedCollection
-
Method Summary
Modifier and Type Method Description final static voidmain(Array<String> argv)main. booleanmatches(String input)Returns true if the given Stringis matched by a pattern inthe trie Returns true if the givenStringis matched by a suffix in thetrieStringshortestMatch(String input)Returns the shortest substring of inputthat ismatched by a pattern in the trie, ornullif no matchexists. Returns the shortest suffix ofinputthat is matched,ornullif no match exists.StringlongestMatch(String input)Returns the longest substring of inputthat ismatched by a pattern in the trie, ornullif no matchexists. Returns the longest suffix ofinputthat is matched,ornullif no match exists.-
-
Constructor Detail
-
SuffixStringMatcher
SuffixStringMatcher(Array<String> suffixes)
Creates a newPrefixStringMatcherwhich will matchStrings with any suffix in the supplied array.- Parameters:
suffixes- an array of java.lang.String objects.
-
SuffixStringMatcher
SuffixStringMatcher(Collection<String> suffixes)
Creates a newPrefixStringMatcherwhich will matchStrings with any suffix in the suppliedCollection- Parameters:
suffixes- a java.util.Collection object.
-
-
Method Detail
-
main
final static void main(Array<String> argv)
main.
- Parameters:
argv- an array of java.lang.String objects.
-
matches
boolean matches(String input)
Returns true if the given
Stringis matched by a pattern inthe trie Returns true if the givenStringis matched by a suffix in thetrie
-
shortestMatch
String shortestMatch(String input)
Returns the shortest substring of
inputthat ismatched by a pattern in the trie, ornullif no matchexists. Returns the shortest suffix ofinputthat is matched,ornullif no match exists.
-
longestMatch
String longestMatch(String input)
Returns the longest substring of
inputthat ismatched by a pattern in the trie, ornullif no matchexists. Returns the longest suffix ofinputthat is matched,ornullif no match exists.
-
-
-
-