org.apache.nutch.util
Class SuffixStringMatcher
java.lang.Object
org.apache.nutch.util.TrieStringMatcher
org.apache.nutch.util.SuffixStringMatcher
public class SuffixStringMatcher
- extends TrieStringMatcher
A class for efficiently matching String
s against a set
of suffixes. Zero-length Strings
are ignored.
Constructor Summary |
SuffixStringMatcher(Collection suffixes)
Creates a new PrefixStringMatcher which will match
String s with any suffix in the supplied
Collection |
SuffixStringMatcher(String[] suffixes)
Creates a new PrefixStringMatcher which will match
String s with any suffix in the supplied array. |
Method Summary |
String |
longestMatch(String input)
Returns the longest suffix of input that is matched,
or null if no match exists. |
static void |
main(String[] argv)
|
boolean |
matches(String input)
Returns true if the given String is matched by a
suffix in the trie |
String |
shortestMatch(String input)
Returns the shortest 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 |
SuffixStringMatcher
public SuffixStringMatcher(String[] suffixes)
- Creates a new
PrefixStringMatcher
which will match
String
s with any suffix in the supplied array.
SuffixStringMatcher
public SuffixStringMatcher(Collection suffixes)
- Creates a new
PrefixStringMatcher
which will match
String
s with any suffix in the supplied
Collection
matches
public boolean matches(String input)
- Returns true if the given
String
is matched by a
suffix in the trie
- Specified by:
matches
in class TrieStringMatcher
shortestMatch
public String shortestMatch(String input)
- Returns the shortest suffix of
input that is matched,
or null if no match exists.
- Specified by:
shortestMatch
in class TrieStringMatcher
longestMatch
public String longestMatch(String input)
- Returns the longest suffix of
input that is matched,
or null if no match exists.
- Specified by:
longestMatch
in class TrieStringMatcher
main
public static final void main(String[] argv)
Copyright © 2007, 2012, Oracle and/or its affiliates. All rights reserved.