/** * Ensure that the long[] is big enough to hold numBits, expanding it if necessary. * getNumWords() is unchanged by this call. * * @param numBits The number of bits to expand to */ public void ensureCapacity(long numBits) { ensureCapacityWords(bits2words(numBits)); }
/** * this = this OR other * @param other The bitset to union with. */ public void union(BitSet other) { int newLen = Math.max(wlen, other.wlen); ensureCapacityWords(newLen); long [] thisArr = this.bits; long [] otherArr = other.bits; int pos = Math.min(wlen, other.wlen); while (--pos >= 0) { thisArr[pos] |= otherArr[pos]; } if (this.wlen < newLen) { System.arraycopy(otherArr, this.wlen, thisArr, this.wlen, newLen - this.wlen); } this.wlen = newLen; }
/** * this = this XOR other * @param other The other bitset. */ public void xor(BitSet other) { int newLen = Math.max(wlen, other.wlen); ensureCapacityWords(newLen); long [] thisArr = this.bits; long [] otherArr = other.bits; int pos = Math.min(wlen, other.wlen); while (--pos >= 0) { thisArr[pos] ^= otherArr[pos]; } if (this.wlen < newLen) { System.arraycopy(otherArr, this.wlen, thisArr, this.wlen, newLen - this.wlen); } this.wlen = newLen; }
/** * Ensure that the long[] is big enough to hold numBits, expanding it if necessary. * getNumWords() is unchanged by this call. * * @param numBits The number of bits to expand to */ public void ensureCapacity(long numBits) { ensureCapacityWords(bits2words(numBits)); }
/** * this = this OR other * @param other The bitset to union with. */ public void union(BitSet other) { int newLen = Math.max(wlen, other.wlen); ensureCapacityWords(newLen); long [] thisArr = this.bits; long [] otherArr = other.bits; int pos = Math.min(wlen, other.wlen); while (--pos >= 0) { thisArr[pos] |= otherArr[pos]; } if (this.wlen < newLen) { System.arraycopy(otherArr, this.wlen, thisArr, this.wlen, newLen - this.wlen); } this.wlen = newLen; }
/** * this = this XOR other * @param other The other bitset. */ public void xor(BitSet other) { int newLen = Math.max(wlen, other.wlen); ensureCapacityWords(newLen); long [] thisArr = this.bits; long [] otherArr = other.bits; int pos = Math.min(wlen, other.wlen); while (--pos >= 0) { thisArr[pos] ^= otherArr[pos]; } if (this.wlen < newLen) { System.arraycopy(otherArr, this.wlen, thisArr, this.wlen, newLen - this.wlen); } this.wlen = newLen; }