org.apache.awf.util
Class KnuthMorrisPrattAlgorithm
java.lang.Object
org.apache.awf.util.KnuthMorrisPrattAlgorithm
public class KnuthMorrisPrattAlgorithm
- extends Object
The Knuth Morris Pratt string searching algorithm (or KMP algorithm) searches
for occurrences of a "word" W within a main "text string" S by employing the
observation that when a mismatch occurs, the word itself embodies sufficient
information to determine where the next match could begin, thus bypassing
re-examination of previously matched characters.
The algorithm was conceived by Donald Knuth and Vaughan Pratt and
independently by James H. Morris in 1977, but the three published it jointly.
|
Method Summary |
static int |
indexOf(byte[] data,
int start,
int end,
byte[] pattern)
Search for pattern in data, [start, end). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KnuthMorrisPrattAlgorithm
public KnuthMorrisPrattAlgorithm()
indexOf
public static int indexOf(byte[] data,
int start,
int end,
byte[] pattern)
- Search for pattern in data, [start, end). Returns -1 if no match is found
or if pattern is of length 0.
Copyright © 2012. All Rights Reserved.