|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.apache.xerces.utils.StringHasher
Algorithm used to hash char arrays (strings). This class was created after it was discovered that parsing some documents was unexpectedly slow due to many different strings hashing to the same 32-bit value using the java.lang.String hash algorithm. The trick seems to be the shift of the top eight bits of the hashcode back down to the bottom to keep them from being rolled out.
Constructor Summary | |
StringHasher()
|
Method Summary | |
static int |
finishHash(int hashcode)
finish hashing a partically completed character hashcode |
static int |
hashChar(int hashcode,
int ch)
generate partially completed character hashcode. |
static int |
hashChars(char[] chars,
int offset,
int length)
generate a hashcode for a character array |
static int |
hashString(java.lang.String str,
int strLength)
generate a hashcode for a String |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public StringHasher()
Method Detail |
public static int hashString(java.lang.String str, int strLength)
str
- the String to hashstrLength
- the length of the String to hashpublic static int hashChars(char[] chars, int offset, int length)
chars
- the array to hashoffset
- the offset to start hashinglength
- the length of characters to hashpublic static int hashChar(int hashcode, int ch)
hashcode
- a partially completed character hashcodech
- the character to hashfinishHash(int)
public static int finishHash(int hashcode)
hashcode
- a partially completed character hashcodehashChar(int,int)
|
Documentation is available at http://e-docs.bea.com/wls/docs61 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |