public class PrefixStringMatcher extends TrieStringMatcher
Strings against a set
of prefixes.TrieStringMatcher.TrieNoderoot| Constructor and Description |
|---|
PrefixStringMatcher(Collection prefixes)
Creates a new
PrefixStringMatcher which will match
Strings with any prefix in the supplied
Collection. |
PrefixStringMatcher(String[] prefixes)
Creates a new
PrefixStringMatcher which will match
Strings with any prefix in the supplied array. |
| Modifier and Type | Method and Description |
|---|---|
String |
longestMatch(String input)
Returns the longest prefix of
input |
static void |
main(String[] argv) |
boolean |
matches(String input)
Returns true if the given
String is matched by a
prefix in the trie |
String |
shortestMatch(String input)
Returns the shortest prefix of
input |
addPatternBackward, addPatternForward, matchCharpublic PrefixStringMatcher(String[] prefixes)
PrefixStringMatcher which will match
Strings with any prefix in the supplied array.
Zero-length Strings are ignored.public PrefixStringMatcher(Collection prefixes)
PrefixStringMatcher which will match
Strings with any prefix in the supplied
Collection.ClassCastException - if any Objects in the
collection are not Stringspublic boolean matches(String input)
String is matched by a
prefix in the triematches in class TrieStringMatcherpublic String shortestMatch(String input)
input that is matched,
or null if no match exists.shortestMatch in class TrieStringMatcherpublic String longestMatch(String input)
input that is matched,
or null if no match exists.longestMatch in class TrieStringMatcherpublic static final void main(String[] argv)
Copyright © 2007, 2014, Oracle and/or its affiliates. All rights reserved.