net.jxta.search.util
Interface StringMatcher
- All Known Implementing Classes:
- KMP, BM
- public interface StringMatcher
Interface for string-matching algorithms.
Usage:
StringMatcher foo = new some_class_implementing_StringMatcher ();
StringMatcher.CompiledPattern pattern = foo.compile (searchPhrase);
int index = foo.match (text, 0, pattern);
System.out.println ("First location of " + searchPhrase + " at " + index);
compile
public StringMatcher.CompiledPattern compile(java.lang.String pattern)
- Compile the pattern into some algorithm-specific data structure.
match
public int match(char[] doc,
int docStart,
StringMatcher.CompiledPattern pat)
- Find the first instance of the pattern in the document starting
at index docStart.