Methods Summary |
---|
private final char | charAt(int index)
return (s != null) ? s.charAt(index) : buf[index];
|
public boolean | equals(java.lang.Object o)
if (!(o instanceof ANTLRHashString) && !(o instanceof String)) {
return false;
}
ANTLRHashString s;
if (o instanceof String) {
s = new ANTLRHashString((String)o, lexer);
}
else {
s = (ANTLRHashString)o;
}
int l = length();
if (s.length() != l) {
return false;
}
if (lexer.getCaseSensitiveLiterals()) {
for (int i = 0; i < l; i++) {
if (charAt(i) != s.charAt(i)) {
return false;
}
}
}
else {
for (int i = 0; i < l; i++) {
if (lexer.toLower(charAt(i)) != lexer.toLower(s.charAt(i))) {
return false;
}
}
}
return true;
|
public int | hashCode()
int hashval = 0;
int l = length();
if (lexer.getCaseSensitiveLiterals()) {
for (int i = 0; i < l; i++) {
hashval = hashval * prime + charAt(i);
}
}
else {
for (int i = 0; i < l; i++) {
hashval = hashval * prime + lexer.toLower(charAt(i));
}
}
return hashval;
|
private final int | length()
return (s != null) ? s.length() : len;
|
public void | setBuffer(char[] buf, int length)
this.buf = buf;
this.len = length;
s = null;
|
public void | setString(java.lang.String s)
this.s = s;
buf = null;
|