public void setImmutable() {
immutable = true;
}
+
+ public int hashCode() {
+ int ret = 0;
+ for(int i=0; i<length(); i++)
+ if (get(i))
+ ret ^= (1L << (i % 32));
+ return ret;
+ }
+
+ public boolean equals(Object o) {
+ if (o==null || !(o instanceof BitVector)) return false;
+ BitVector bv = (BitVector)o;
+ if (bv.bits.length != bits.length) return false;
+ for(int i=0; i<bits.length; i++)
+ if (bits[i] != bv.bits[i])
+ return false;
+ return true;
+ }
}