public class BoyerMooreMatcher extends Object implements SeekableMatcher
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
badCharacterTable
This is the version of a character table that only tracks mismatch on the first instance of a char
There is another approach which uses more memory using
badCharacterTable[byteValueInText][positionOfMisMatch]
|
protected int[] |
goodSuffixTable |
protected boolean |
isFwd |
protected byte[] |
pat |
protected boolean |
returningFromMatch |
| Constructor and Description |
|---|
BoyerMooreMatcher(boolean isFwd,
byte[] pat,
int[] badCharacter,
int[] goodSuffix) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
find(Seekable pn)
Move the position to the next match.
|
protected byte |
getByte(Seekable seekable) |
boolean |
isForward()
Whether the matcher matches in forward direction and thus nextPos() moves towards the end of the match.
|
protected boolean |
nextPos(Seekable seekable,
int delta) |
protected boolean |
prevPos(Seekable seekable,
int delta) |
void |
resetState()
Reset the state of the matcher such that it can be used with a fresh seekable
|
protected boolean isFwd
protected byte[] pat
protected int[] badCharacterTable
protected int[] goodSuffixTable
protected boolean returningFromMatch
public BoyerMooreMatcher(boolean isFwd,
byte[] pat,
int[] badCharacter,
int[] goodSuffix)
public void resetState()
SeekableMatcherresetState in interface SeekableMatcherpublic boolean isForward()
SeekableMatcherisForward in interface SeekableMatcherprotected boolean nextPos(Seekable seekable, int delta) throws IOException
IOExceptionprotected boolean prevPos(Seekable seekable, int delta) throws IOException
IOExceptionprotected byte getByte(Seekable seekable) throws IOException
IOExceptionpublic boolean find(Seekable pn) throws IOException
SeekableMatcherfind in interface SeekableMatcherIOExceptionCopyright © 2020. All rights reserved.