}
private void fixStuff() {
- if (!isMultiObject) {
- arity=ARITY_ONE;
- }
+ //This is an evil hack...we should fix this stuff elsewhere...
+ if (!isMultiObject) {
+ arity=ARITY_ONE;
+ } else {
+ if (arity==ARITY_ONEORMORE)
+ arity=ARITY_ZEROORMORE;
+ }
}
arity == tt.getArity();
}
- private boolean oldHashSet = false;
- private int oldHash = 0;
public int hashCode() {
- int currentHash = token.intValue()*31 + arity;
-
- if( oldHashSet == false ) {
- oldHash = currentHash;
- oldHashSet = true;
- } else {
- if( oldHash != currentHash ) {
- System.out.println("IF YOU SEE THIS A CANONICAL TokenTuple CHANGED");
- Integer x = null;
- x.toString();
- }
- }
-
- return currentHash;
+ return (token.intValue() << 2) ^ arity;
}
return tokenTuples.equals(tts.tokenTuples);
}
+ boolean hashcodecomputed;
+ int ourhashcode;
- private boolean oldHashSet = false;
- private int oldHash = 0;
public int hashCode() {
- int currentHash = tokenTuples.hashCode();
-
- if( oldHashSet == false ) {
- oldHash = currentHash;
- oldHashSet = true;
- } else {
- if( oldHash != currentHash ) {
- System.out.println("IF YOU SEE THIS A CANONICAL TokenTupleSet CHANGED");
- Integer x = null;
- x.toString();
+ if (hashcodecomputed)
+ return ourhashcode;
+ else {
+ ourhashcode=tokenTuples.hashCode();
+ return ourhashcode;
}
- }
-
- return currentHash;
}