Package libsidutils.stringsearch
Klasse MismatchSearch
java.lang.Object
libsidutils.stringsearch.StringSearch
libsidutils.stringsearch.MismatchSearch
Subclasses of MismatchSearch allow for searching with a fixed number of
possible errors. Subclasses of this class return a
Example:
int array
with the first int being the position at which the hit occurred
and the second int being the number of mismatches at the
position. Example:
int[] positions = new ShiftOrMismatches().searchString("this is null", "nall", 1);
positions[0] would be 8, positions[1] (the number of mismatches) would be 1.- Version:
- 1.2
- Autor:
- Johann Burkard
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungfinal ObjectprocessBytes(byte[] pattern) Pre-process the pattern, allowing zero errors.abstract ObjectprocessBytes(byte[] pattern, int k) Pre-processes the pattern, allowing k errors.final ObjectprocessChars(char[] pattern) Pre-processes the pattern, allowing zero errors.abstract ObjectprocessChars(char[] pattern, int k) Pre-processes achararray, allowing k errors.final ObjectprocessString(String pattern, int k) Pre-processes a String, allowing k errors.final int[]searchBytes(byte[] text, byte[] pattern, int k) Returns the position in the text at which the pattern was found.final int[]searchBytes(byte[] text, byte[] pattern, Object processed, int k) Returns the position in the text at which the pattern was found.final int[]searchBytes(byte[] text, int textEnd, byte[] pattern, int k) Returns the position in the text at which the pattern was found.final int[]searchBytes(byte[] text, int textEnd, byte[] pattern, Object processed, int k) Returns the position in the text at which the pattern was found.final int[]searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, int k) Returns the position in the text at which the pattern was found.final intsearchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, Object processed) Returns the position in the text at which the pattern was found.abstract int[]searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, Object processed, int k) Returns the position in the text at which the pattern was found.final int[]searchChars(char[] text, char[] pattern, int k) Finder for the given pattern in the text, allowing k errors.final int[]searchChars(char[] text, char[] pattern, Object processed, int k) Finder for the given pattern in the text, allowing k errors.final int[]searchChars(char[] text, int textStart, char[] pattern, int k) Finder for the given pattern in the text, starting at textStart, allowing k errors.final int[]searchChars(char[] text, int textStart, char[] pattern, Object processed, int k) Finder for the given pattern in the text, starting at textStart, allowing k errors.final int[]searchChars(char[] text, int textStart, int textEnd, char[] pattern, int k) Finder for the given pattern in the text, starting at textStart and comparing to at most textEnd, allowing k errors.final intsearchChars(char[] text, int textStart, int textEnd, char[] pattern, Object processed) Finder for the given pattern in the text, starting at textStart and comparing to at most textEnd, allowing zero errors.abstract int[]searchChars(char[] text, int textStart, int textEnd, char[] pattern, Object processed, int k) Finder for the given pattern in the text, starting at textStart and comparing to at most textEnd, allowing k errors.Von Klasse geerbte Methoden libsidutils.stringsearch.StringSearch
createCharIntMap, createCharIntMap, equals, hashCode, index, searchBytes, searchBytes, searchBytes, searchBytes, searchBytes, searchChars, searchChars, searchChars, searchChars, searchChars, toString, toStringBuffer
-
Konstruktordetails
-
MismatchSearch
MismatchSearch()
-
-
Methodendetails
-
processBytes
Pre-process the pattern, allowing zero errors.
Identical toprocess(pattern, 0)- Angegeben von:
processBytesin KlasseStringSearch- Parameter:
pattern- thebytearray containing the pattern, may not benull- Gibt zurück:
- an Object
- Siehe auch:
-
processBytes
Pre-processes the pattern, allowing k errors.- Parameter:
pattern- thebytearray containing the pattern, may not benullk- the editing distance- Gibt zurück:
- an Object
-
processChars
Pre-processes the pattern, allowing zero errors.
Identical toprocess(pattern, 0).- Angegeben von:
processCharsin KlasseStringSearch- Parameter:
pattern- achararray containing the pattern, may not benull- Gibt zurück:
- an Object
- Siehe auch:
-
processChars
Pre-processes achararray, allowing k errors.- Parameter:
pattern- achararray containing the pattern, may not benullk- the editing distance- Gibt zurück:
- an Object
-
processString
Pre-processes a String, allowing k errors. This method should not be used directly because it is implicitly called in theStringSearch.searchChars(char[], char[])methods.- Parameter:
pattern- the String containing the pattern, may not benullk- the editing distance- Gibt zurück:
- an Object
-
searchBytes
public final int searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, Object processed) Beschreibung aus Klasse kopiert:StringSearchReturns the position in the text at which the pattern was found. Returns -1 if the pattern was not found.- Angegeben von:
searchBytesin KlasseStringSearch- Parameter:
text- text thebytearray containing the text, may not benulltextStart- 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 benullprocessed- an Object as returned fromStringSearch.processBytes(byte[]), may not benull- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchBytes
public final int[] searchBytes(byte[] text, byte[] pattern, int k) Returns the position in the text at which the pattern was found. Returns -1 if the pattern was not found.- Parameter:
text- thebytearray containing the text, may not benullpattern- thebytearray containing the pattern, may not benullk- the editing distance- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchBytes
Returns the position in the text at which the pattern was found. Returns -1 if the pattern was not found.- Parameter:
text- thebytearray containing the text, may not benullpattern- thebytearray containing the pattern, may not benullprocessed- an Object as returned fromprocessBytes(byte[], int), may not benullk- the editing distance- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchBytes
public final int[] searchBytes(byte[] text, int textEnd, byte[] pattern, int k) Returns the position in the text at which the pattern was found. Returns -1 if the pattern was not found.- Parameter:
text- thebytearray containing the text, may not benulltextEnd- at which position in the text the comparing should endpattern- thebytearray containing the pattern, may not benullk- the editing distance- Gibt zurück:
- int the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchBytes
Returns the position in the text at which the pattern was found. Returns -1 if the pattern was not found.- Parameter:
text- thebytearray containing the text, may not benulltextEnd- at which position in the text the comparing should endpattern- the pattern to search for, may not benullprocessed-k- the editing distance- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchBytes
public final int[] searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, int k) Returns the position in the text at which the pattern was found. Returns -1 if the pattern was not found.- Parameter:
text- text thebytearray containing the text, may not benulltextStart- at which position in the text the comparing should starttextEnd- at which position in the text comparing should stoppattern- thebytearray containing the pattern, may not benullk- the editing distance- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchBytes
public abstract int[] searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, Object processed, int k) Returns the position in the text at which the pattern was found. Returns -1 if the pattern was not found.- Parameter:
text- text thebytearray containing the text, may not benulltextStart- 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 benullprocessed- an Object as returned fromprocessBytes(byte[], int), may not benullk- the editing distance- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchChars
public final int searchChars(char[] text, int textStart, int textEnd, char[] pattern, Object processed) Finder for the given pattern in the text, starting at textStart and comparing to at most textEnd, allowing zero errors.- Angegeben von:
searchCharsin KlasseStringSearch- Parameter:
text- the String containing the text, may not benulltextStart- 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 benullprocessed- an Object as returned fromStringSearch.processChars(char[]), may not benull- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchChars
public final int[] searchChars(char[] text, char[] pattern, int k) Finder for the given pattern in the text, allowing k errors.- Parameter:
text- the String containing the text, may not benullpattern- the pattern to search for, may not benullk- the maximum number of mismatches (the editing distance)- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchChars
Finder for the given pattern in the text, allowing k errors.- Parameter:
text- the String containing the text, may not benullpattern- the pattern to search for, may not benullprocessed- an Object as returned fromprocessChars(char[], int)orprocessString(String, int), may not benullk- the maximum number of mismatches (the editing distance)- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchChars
public final int[] searchChars(char[] text, int textStart, char[] pattern, int k) Finder for the given pattern in the text, starting at textStart, allowing k errors.- Parameter:
text- the String containing the text, may not benulltextStart- at which position in the text the comparing should startpattern- the pattern to search for, may not benullk- the maximum number of mismatches (the editing distance)- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchChars
Finder for the given pattern in the text, starting at textStart, allowing k errors.- Parameter:
text- the String containing the text, may not benulltextStart- at which position in the text the comparing should startpattern- the pattern to search for, may not benullprocessed- an Object as returned fromprocessChars(char[], int)orprocessString(String, int), may not benullk- the maximum number of mismatches (the editing distance)- Gibt zurück:
- the position in the text or -1 if the pattern was not found
- Siehe auch:
-
searchChars
public final int[] searchChars(char[] text, int textStart, int textEnd, char[] pattern, int k) Finder for the given pattern in the text, starting at textStart and comparing to at most textEnd, allowing k errors.- Parameter:
text- the String containing the text, may not benulltextStart- 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 benullk- the maximum number of mismatches (the editing distance)- Gibt zurück:
- the position in the text or -1 if the pattern was not found
-
searchChars
public abstract int[] searchChars(char[] text, int textStart, int textEnd, char[] pattern, Object processed, int k) Finder for the given pattern in the text, starting at textStart and comparing to at most textEnd, allowing k errors.- Parameter:
text- the String containing the text, may not benulltextStart- 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 benullprocessed- an Object as returned fromprocessChars(char[], int)orprocessString(String, int), may not benullk- the maximum number of mismatches (the editing distance)- Gibt zurück:
- the position in the text or -1 if the pattern was not found
-