Package ai.platon.pulsar.common
Class SuffixStringMatcher
-
- All Implemented Interfaces:
public class SuffixStringMatcher extends TrieStringMatcher
A class for efficiently matching
Strings against a set of suffixes. Zero-lengthStringsare ignored.vincent
-
-
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 in the trie Returns true if the givenStringis matched by a suffix in the trieStringshortestMatch(String input)Returns the shortest substring of inputthat is matched by a pattern in the trie, ornullif no match exists. Returns the shortest suffix of
that is matched, orinput
if no match exists.nullStringlongestMatch(String input)Returns the longest substring of inputthat is matched by a pattern in the trie, ornullif no match exists. Returns the longest suffix of
that is matched, orinput
if no match exists.null-
-
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 in the trie Returns true if the givenStringis matched by a suffix in the trie
-
shortestMatch
String shortestMatch(String input)
Returns the shortest substring of
inputthat is matched by a pattern in the trie, ornullif no match exists. Returns the shortest suffix of
that is matched, orinput
if no match exists.null
-
longestMatch
String longestMatch(String input)
Returns the longest substring of
inputthat is matched by a pattern in the trie, ornullif no match exists. Returns the longest suffix of
that is matched, orinput
if no match exists.null
-
-
-
-