|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jaxfront.core.util.stringSearch.StringSearch
com.jaxfront.core.util.stringSearch.MismatchSearch
com.jaxfront.core.util.stringSearch.ShiftOrMismatches
public class ShiftOrMismatches
An implementation of the Shift-Or algorithm with mismatches. Note that the
pattern length may not be larger than 31 / ⌈ log2 (k + 1)
⌉.
| Editing distance (k) | Maximum pattern length |
| 0 | 31 |
| 1 | 15 |
| 2-3 | 10 |
| 4-5 | 7 |
com.eaio.stringsearch.ShiftOr. In
future versions of this library, faster alternatives are likely to be added.
Preprocessing: O(3n + ∑) time Searching : O(mn / log n) (worst case and average)
processBytes(byte[], int),
processChars(char[], int),
com.eaio.stringsearch.ShiftOr| Constructor Summary | |
|---|---|
ShiftOrMismatches()
Constructor for ShiftOrMismatches. |
|
| Method Summary | |
|---|---|
java.lang.Object |
processBytes(byte[] pattern,
int k)
Pre-processes the pattern, allowing k errors. |
java.lang.Object |
processChars(char[] pattern,
int k)
Pre-processes a char array, allowing k errors. |
int[] |
searchBytes(byte[] text,
int textStart,
int textEnd,
byte[] pattern,
java.lang.Object processed,
int k)
Returns the position in the text at which the pattern was found. |
int[] |
searchChars(char[] text,
int textStart,
int textEnd,
char[] pattern,
java.lang.Object processed,
int k)
Finder for the given pattern in the text, starting at textStart and comparing to at most textEnd, allowing k errors. |
boolean |
usesNative()
This algorithm is currently not using the native library. |
| Methods inherited from class com.jaxfront.core.util.stringSearch.MismatchSearch |
|---|
processBytes, processChars, processString, searchBytes, searchBytes, searchBytes, searchBytes, searchBytes, searchBytes, searchChars, searchChars, searchChars, searchChars, searchChars, searchChars, searchString, searchString, searchString, searchString, searchString, searchString |
| Methods inherited from class com.jaxfront.core.util.stringSearch.StringSearch |
|---|
equals, getAllOccurences, hashCode, processString, searchBytes, searchBytes, searchBytes, searchBytes, searchBytes, searchChars, searchChars, searchChars, searchChars, searchChars, searchString, searchString, searchString, searchString, searchString, searchString, toString, toStringBuffer, usesReflection |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ShiftOrMismatches()
| Method Detail |
|---|
public java.lang.Object processBytes(byte[] pattern,
int k)
MismatchSearch
processBytes in class MismatchSearchpattern - the byte array containing the pattern, may not
be nullk - the editing distance
java.lang.IllegalArgumentException - if the pattern length is larger than 31 /
⌈ log2 (k + 1) ⌉com.eaio.stringsearch.MismatchSearch#processBytes(byte[], int)
public java.lang.Object processChars(char[] pattern,
int k)
MismatchSearchchar array, allowing k errors.
processChars in class MismatchSearchpattern - a char array containing the pattern, may not be
nullk - the editing distance
java.lang.IllegalArgumentException - if the pattern length is larger than 31 /
⌈ log2 (k + 1) ⌉com.eaio.stringsearch.MismatchSearch#processChars(char[], int)
public int[] searchBytes(byte[] text,
int textStart,
int textEnd,
byte[] pattern,
java.lang.Object processed,
int k)
MismatchSearch
searchBytes in class MismatchSearchtext - text the byte array containing the text, may not be
nulltextStart - at which position in the text the comparing should starttextEnd - at which position in the text comparing should stoppattern - the pattern to search for, may not be nullprocessed - an Object as returned from
MismatchSearch.processBytes(byte[], int), may not be nullk - the editing distance
com.eaio.stringsearch.MismatchSearch#searchBytes(byte[], int, int,
byte[], Object, int)
public int[] searchChars(char[] text,
int textStart,
int textEnd,
char[] pattern,
java.lang.Object processed,
int k)
MismatchSearch
searchChars in class MismatchSearchtext - the String containing the text, may not be nulltextStart - at which position in the text the comparing should starttextEnd - at which position in the text comparing should stoppattern - the pattern to search for, may not be nullprocessed - an Object as returned from
MismatchSearch.processChars(char[], int) or MismatchSearch.processString(String, int),
may not be nullk - the maximum number of mismatches (the editing distance)
com.eaio.stringsearch.MismatchSearch#searchChars(char[], int, int,
char[], Object, int)public boolean usesNative()
false.
usesNative in class StringSearchtrue or falsecom.eaio.stringsearch.StringSearch#usesNative()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||