public class BNDM extends Object
Preprocessing: O(m) time Searching : O(n/m) (best case) O(n log|∑| m / m) (average) O(mn) (worst case)http://www. dcc.uchile.cl/~gnavarro/ps/cpm98.ps.gz
Constructor and Description |
---|
BNDM()
Constructor for BNDM.
|
Modifier and Type | Method and Description |
---|---|
protected libsidutils.stringsearch.CharIntMap |
createCharIntMap(char[] pattern)
Returns a
CharIntMap of the extent of the given pattern, using no
default value. |
protected libsidutils.stringsearch.CharIntMap |
createCharIntMap(char[] pattern,
int defaultValue)
Returns a
CharIntMap of the extent of the given pattern, using
the specified default value. |
boolean |
equals(Object obj)
Returns if the Object's class name matches this Object's class name.
|
int |
hashCode()
Returns the hashCode of the Object's Class because all instances of this
Class are equal.
|
protected int |
index(byte idx)
Converts the given
byte to an int . |
Object |
processBytes(byte[] pattern)
Pre-processing of the pattern.
|
Object |
processChars(char[] pattern)
Pre-processing of the pattern.
|
int |
searchBytes(byte[] text,
byte[] pattern)
Returns the position in the text at which the pattern was found.
|
int |
searchBytes(byte[] text,
byte[] pattern,
Object processed)
Returns the position in the text at which the pattern was found.
|
int |
searchBytes(byte[] text,
int textStart,
byte[] pattern)
Returns the position in the text at which the pattern was found.
|
int |
searchBytes(byte[] text,
int textStart,
byte[] pattern,
Object processed)
Returns the position in the text at which the pattern was found.
|
int |
searchBytes(byte[] text,
int textStart,
int textEnd,
byte[] pattern)
Returns the position in the text at which the pattern was found.
|
int |
searchBytes(byte[] text,
int textStart,
int textEnd,
byte[] pattern,
Object processed)
com.eaio.stringsearch.StringSearch#searchBytes(byte[], int, int,
byte[], java.lang.Object)
|
int |
searchChars(char[] text,
char[] pattern)
Returns the position in the text at which the pattern was found.
|
int |
searchChars(char[] text,
char[] pattern,
Object processed)
Returns the index of the pattern in the text using the pre-processed
Object.
|
int |
searchChars(char[] text,
int textStart,
char[] pattern)
Returns the position in the text at which the pattern was found.
|
int |
searchChars(char[] text,
int textStart,
char[] pattern,
Object processed)
Returns the index of the pattern in the text using the pre-processed
Object.
|
int |
searchChars(char[] text,
int textStart,
int textEnd,
char[] pattern)
Returns the position in the text at which the pattern was found.
|
int |
searchChars(char[] text,
int textStart,
int textEnd,
char[] pattern,
Object processed)
com.eaio.stringsearch.StringSearch#searchChars(char[], int, int,
char[], Object)
|
String |
toString()
Returns a String representation of this.
|
StringBuffer |
toStringBuffer(StringBuffer in)
Appends a String representation of this to the given
StringBuffer
or creates a new one if none is given. |
public BNDM()
public Object processBytes(byte[] pattern)
int
array.
com.eaio.stringsearch.StringSearch#processBytes(byte[])pattern
- the byte
array containing the pattern, may not be
null
public Object processChars(char[] pattern)
CharIntMap
.
com.eaio.stringsearch.StringSearch#processChars(char[])pattern
- a char
array containing the pattern, may not be
null
public int searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, Object processed)
text
- text the byte
array containing the text, may not
be null
textStart
- 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 null
processed
- an Object as returned from processBytes(byte[])
, may
not be null
processBytes(byte[])
public int searchChars(char[] text, int textStart, int textEnd, char[] pattern, Object processed)
text
- the String containing the text, may not be null
textStart
- 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 null
processed
- an Object as returned from processChars(char[])
, may
not be null
public final int searchBytes(byte[] text, byte[] pattern)
text
- the byte
array containing the text, may not be
null
pattern
- the byte
array containing the pattern, may not be
null
searchBytes(byte[], int, int, byte[], Object)
public final int searchBytes(byte[] text, byte[] pattern, Object processed)
text
- the byte
array containing the text, may not be
null
pattern
- the pattern to search for, may not be null
processed
- an Object as returned from processBytes(byte[])
, may
not be null
searchBytes(byte[], int, int, byte[], Object)
public final int searchBytes(byte[] text, int textStart, byte[] pattern)
text
- the byte
array containing the text, may not be
null
textStart
- at which position in the text the comparing should startpattern
- the byte
array containing the pattern, may not be
null
searchBytes(byte[], int, int, byte[], Object)
public final int searchBytes(byte[] text, int textStart, byte[] pattern, Object processed)
text
- the byte
array containing the text, may not be
null
textStart
- at which position in the text the comparing should startpattern
- the pattern to search for, may not be null
processed
- searchBytes(byte[], int, int, byte[], Object)
public final int searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern)
text
- text the byte
array containing the text, may not
be null
textStart
- at which position in the text the comparing should starttextEnd
- at which position in the text comparing should stoppattern
- the byte
array containing the pattern, may not be
null
searchBytes(byte[], int, int, byte[], Object)
public final int searchChars(char[] text, char[] pattern)
text
- the character array containing the text, may not be
null
pattern
- the char
array containing the pattern, may not be
null
searchChars(char[], int, int, char[], Object)
public final int searchChars(char[] text, char[] pattern, Object processed)
text
- the character array containing the text, may not be
null
pattern
- the char
array containing the pattern, may not be
null
processed
- an Object as returned from processChars(char[])
, may
not be null
searchChars(char[], int, int, char[], Object)
public final int searchChars(char[] text, int textStart, char[] pattern)
text
- the character array containing the text, may not be
null
textStart
- at which position in the text the comparing should startpattern
- the char
array containing the pattern, may not be
null
searchChars(char[], int, int, char[], Object)
public final int searchChars(char[] text, int textStart, char[] pattern, Object processed)
text
- the String containing the text, may not be null
textStart
- at which position in the text the comparing should startpattern
- the char
array containing the pattern, may not be
null
processed
- an Object as returned from processChars(char[])
, may
not be null
searchChars(char[], int, int, char[], Object)
public final int searchChars(char[] text, int textStart, int textEnd, char[] pattern)
text
- the character array containing the text, may not be
null
textStart
- at which position in the text the comparing should starttextEnd
- at which position in the text comparing should stoppattern
- the char
array containing the pattern, may not be
null
searchChars(char[], int, int, char[], Object)
public final boolean equals(Object obj)
equals
in class Object
obj
- the other ObjectObject.equals(Object)
public final int hashCode()
hashCode
in class Object
Object.hashCode()
public final String toString()
toString
in class Object
Object.toString()
public StringBuffer toStringBuffer(StringBuffer in)
StringBuffer
or creates a new one if none is given. This method is not
final
because subclasses might want a different String
format.in
- the StringBuffer to append to, may be null
protected libsidutils.stringsearch.CharIntMap createCharIntMap(char[] pattern)
CharIntMap
of the extent of the given pattern, using no
default value.pattern
- the patternCharIntMap.CharIntMap(int, char)
protected libsidutils.stringsearch.CharIntMap createCharIntMap(char[] pattern, int defaultValue)
CharIntMap
of the extent of the given pattern, using
the specified default value.pattern
- the patterndefaultValue
- the default valueCharIntMap.CharIntMap(int, char, int)
protected final int index(byte idx)
byte
to an int
.idx
- the byteCopyright © 2018 Ken Händel. All rights reserved.