|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jaxfront.core.util.stringSearch.StringSearch
public abstract class StringSearch
The base class for String searching implementations. String searching implementations do not maintain state and are thread safe - one instance can be used by as many threads as required.
Most pattern-matching algorithms pre-process the pattern to search for in some way. Subclasses of StringSearch allow retrieving the pre-processed pattern to save the time required to build up character tables.
Some of the Objects returned from processBytes(byte[])
,
processChars(char[])
, processString(String)
might
implement the Serializable
interface and enable you to
serialize pre-processed Objects to disk, see concrete implementations for
details.
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Returns if the Object's class name matches this Object's class name. |
static java.util.ArrayList |
getAllOccurences(java.lang.String text,
java.lang.String find,
boolean matchCase,
boolean useAsRegex)
Creates a array of Integer containing all occurences of the find string! |
int |
hashCode()
Returns the hashCode of the Object's Class because all instances of this Class are equal. |
abstract java.lang.Object |
processBytes(byte[] pattern)
Pre-processes a byte array. |
abstract java.lang.Object |
processChars(char[] pattern)
Pre-processes a char array |
java.lang.Object |
processString(java.lang.String pattern)
Pre-processes a String. |
int |
searchBytes(byte[] text,
byte[] pattern)
Returns the position in the text at which the pattern was found. |
int |
searchBytes(byte[] text,
byte[] pattern,
java.lang.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,
java.lang.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. |
abstract int |
searchBytes(byte[] text,
int textStart,
int textEnd,
byte[] pattern,
java.lang.Object processed)
Returns the position in the text at which the pattern was found. |
int |
searchChars(char[] text,
char[] pattern)
Returns the position in the text at which the pattern was found. |
int |
searchChars(char[] text,
char[] pattern,
java.lang.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,
java.lang.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. |
abstract int |
searchChars(char[] text,
int textStart,
int textEnd,
char[] pattern,
java.lang.Object processed)
Returns the index of the pattern in the text using the pre-processed Object. |
int |
searchString(java.lang.String text,
int textStart,
int textEnd,
java.lang.String pattern)
Convenience method to search for patterns in Strings. |
int |
searchString(java.lang.String text,
int textStart,
int textEnd,
java.lang.String pattern,
java.lang.Object processed)
Convenience method to search for patterns in Strings. |
int |
searchString(java.lang.String text,
int textStart,
java.lang.String pattern)
Convenience method to search for patterns in Strings. |
int |
searchString(java.lang.String text,
int textStart,
java.lang.String pattern,
java.lang.Object processed)
Convenience method to search for patterns in Strings. |
int |
searchString(java.lang.String text,
java.lang.String pattern)
Convenience method to search for patterns in Strings. |
int |
searchString(java.lang.String text,
java.lang.String pattern,
java.lang.Object processed)
Convenience method to search for patterns in Strings. |
java.lang.String |
toString()
Returns a String representation of this. |
java.lang.StringBuffer |
toStringBuffer(java.lang.StringBuffer in)
Appends a String representation of this to the given StringBuffer
or creates a new one if none is given. |
boolean |
usesNative()
Returns if this algorithm currently uses the native library - if it could be loaded. |
static boolean |
usesReflection()
Returns if Reflection is used to access the underlying char
array in Strings. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static boolean usesReflection()
char
array in Strings.
true
or false
public boolean usesNative()
false
.
true
or false
public abstract java.lang.Object processBytes(byte[] pattern)
byte
array.
pattern
- the byte
array containing the pattern, may not
be null
public abstract java.lang.Object processChars(char[] pattern)
char
array
pattern
- a char
array containing the pattern, may not be
null
public final java.lang.Object processString(java.lang.String pattern)
searchString(String, String)
methods.
pattern
- the String containing the pattern, may not be
null
processChars(char[])
public static java.util.ArrayList getAllOccurences(java.lang.String text, java.lang.String find, boolean matchCase, boolean useAsRegex)
text
- find
-
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, java.lang.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, java.lang.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 abstract int searchBytes(byte[] text, int textStart, int textEnd, byte[] pattern, java.lang.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 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, java.lang.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[])
or
processString(String)
, 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, java.lang.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[])
or
processString(String)
, 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 abstract int searchChars(char[] text, int textStart, int textEnd, char[] pattern, java.lang.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[])
or
processString(String)
, may not be null
public final int searchString(java.lang.String text, java.lang.String pattern)
text
- the String containing the text, may not be null
pattern
- the String containing the pattern, may not be
null
searchChars(char[], int, int, char[], Object)
public final int searchString(java.lang.String text, java.lang.String pattern, java.lang.Object processed)
text
- the String containing the text, may not be null
pattern
- the String containing the pattern, may not be
null
processed
- an Object as returned from processChars(char[])
or
processString(String)
, may not be null
searchChars(char[], int, int, char[], Object)
public final int searchString(java.lang.String text, int textStart, java.lang.String pattern)
text
- the String containing the text, may not be null
textStart
- at which position in the text the comparing should startpattern
- the String containing the pattern, may not be
null
searchChars(char[], int, int, char[], Object)
public final int searchString(java.lang.String text, int textStart, java.lang.String pattern, java.lang.Object processed)
text
- the String containing the text, may not be null
textStart
- at which position in the text the comparing should startpattern
- the String containing the pattern, may not be
null
processed
- an Object as returned from processChars(char[])
or
processString(String)
, may not be null
searchChars(char[], int, int, char[], Object)
public final int searchString(java.lang.String text, int textStart, int textEnd, java.lang.String pattern)
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 String containing the pattern, may not be
null
searchChars(char[], int, int, char[])
public final int searchString(java.lang.String text, int textStart, int textEnd, java.lang.String pattern, java.lang.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 String containing the pattern, may not be
null
processed
- an Object as returned from processChars(char[])
or
processString(String)
, may not be null
searchChars(char[], int, int, char[])
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the other Object
Object.equals(Object)
public final int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public final java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.StringBuffer toStringBuffer(java.lang.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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |