Lines Matching defs:bits

57     private long[] bits;
66 * Create a new {@code BitSet} with size equal to 64 bits.
77 bits = new long[1];
103 bits = new long[(nbits >> OFFSET) + ((nbits & RIGHT_BITS) > 0 ? 1 : 0)];
111 * @param bits
114 private BitSet(long[] bits, boolean needClear, int actualArrayLength,
116 this.bits = bits;
131 clone.bits = bits.clone();
141 * bits set.
155 long[] bsBits = ((BitSet) obj).bits;
162 // any of its extra bits are set. If so return false.
165 if (bits[i] != bsBits[i]) {
176 if (bits[i] != bsBits[i]) {
181 if (bits[i] != 0) {
192 * Increase the size of the internal array to accommodate {@code pos} bits.
199 long[] tempBits = new long[Math.max(len, bits.length * 2)];
200 System.arraycopy(bits, 0, tempBits, 0, this.actualArrayLength);
201 bits = tempBits;
217 x ^= bits[i] * (i + 1);
248 return (bits[arrayPos] & TWO_N_ARRAY[pos & RIGHT_BITS]) != 0;
254 * Retrieves the bits starting from {@code pos1} to {@code pos2} and returns
255 * back a new bitset made of these bits. Grows the {@code BitSet} if
287 long result = (bits[idx1] & (factor1 & factor2)) >>> (pos1 % ELM_SIZE);
295 newbits[0] = bits[idx1] & factor1;
296 newbits[newbits.length - 1] = bits[idx2] & factor2;
300 newbits[i] = bits[idx1 + i];
313 // apply the last x bits of newbits[i+1] to the current
345 if (len > bits.length) {
348 bits[len - 1] |= TWO_N_ARRAY[pos & RIGHT_BITS];
377 * Sets the bits starting from {@code pos1} to {@code pos2}. Grows the
398 if (len2 > bits.length) {
408 bits[idx1] |= (factor1 & factor2);
410 bits[idx1] |= factor1;
411 bits[idx2] |= factor2;
413 bits[i] |= (~0L);
428 * Sets the bits starting from {@code pos1} to {@code pos2} to the given
436 * value to set these bits.
451 * Clears all the bits in this {@code BitSet}.
458 for (int i = 0; i < bits.length; i++) {
459 bits[i] = 0L;
488 bits[arrayPos] &= ~(TWO_N_ARRAY[pos & RIGHT_BITS]);
489 if (bits[actualArrayLength - 1] == 0) {
496 * Clears the bits starting from {@code pos1} to {@code pos2}. Grows the
530 bits[idx1] &= ~(factor1 & factor2);
532 bits[idx1] &= ~factor1;
533 bits[idx2] &= ~factor2;
535 bits[i] = 0L;
538 if ((actualArrayLength > 0) && (bits[actualArrayLength - 1] == 0)) {
559 if (len > bits.length) {
562 bits[len - 1] ^= TWO_N_ARRAY[pos & RIGHT_BITS];
566 isLengthActual = !((actualArrayLength > 0) && (bits[actualArrayLength - 1] == 0));
571 * Flips the bits starting from {@code pos1} to {@code pos2}. Grows the
592 if (len2 > bits.length) {
602 bits[idx1] ^= (factor1 & factor2);
604 bits[idx1] ^= factor1;
605 bits[idx2] ^= factor2;
607 bits[i] ^= (~0L);
613 isLengthActual = !((actualArrayLength > 0) && (bits[actualArrayLength - 1] == 0));
627 long[] bsBits = bs.bits;
632 if ((bits[i] & bsBits[i]) != 0L) {
638 if ((bits[i] & bsBits[i]) != 0L) {
657 long[] bsBits = bs.bits;
664 bits[i] &= bsBits[i];
668 bits[i] &= bsBits[i];
671 bits[i] = 0;
675 isLengthActual = !((actualArrayLength > 0) && (bits[actualArrayLength - 1] == 0));
679 * Clears all bits in the receiver which are also set in the parameter
686 long[] bsBits = bs.bits;
693 bits[i] &= ~bsBits[i];
699 isLengthActual = !((actualArrayLength > 0) && (bits[actualArrayLength - 1] == 0));
713 if (bsActualLen > bits.length) {
715 System.arraycopy(bs.bits, 0, tempBits, 0, bs.actualArrayLength);
717 tempBits[i] |= bits[i];
719 bits = tempBits;
723 long[] bsBits = bs.bits;
725 bits[i] |= bsBits[i];
746 if (bsActualLen > bits.length) {
748 System.arraycopy(bs.bits, 0, tempBits, 0, bs.actualArrayLength);
750 tempBits[i] ^= bits[i];
752 bits = tempBits;
754 isLengthActual = !((actualArrayLength > 0) && (bits[actualArrayLength - 1] == 0));
756 long[] bsBits = bs.bits;
758 bits[i] ^= bsBits[i];
769 * Returns the number of bits this {@code BitSet} has.
771 * @return the number of bits contained in this {@code BitSet}.
775 return bits.length << OFFSET;
779 * Returns the number of bits up to and including the highest bit set.
785 while (idx >= 0 && bits[idx] == 0) {
793 long val = bits[idx];
805 while (idx >= 0 && bits[idx] == 0) {
817 * @return a comma delimited list of the indices of all bits that are set.
821 StringBuilder sb = new StringBuilder(bits.length / 2);
825 for (int i = 0; i < bits.length; i++) {
826 if (bits[i] == 0) {
831 if (((bits[i] & (TWO_N_ARRAY[j])) != 0)) {
850 * @return -1 if there is no bits that are set to {@code true} on or after {@code pos}.
863 if (bits[idx] != 0L) {
865 if (((bits[idx] & (TWO_N_ARRAY[j])) != 0)) {
872 while (idx < actualArrayLength && bits[idx] == 0L) {
882 if (((bits[idx] & (TWO_N_ARRAY[j])) != 0)) {
911 if (bits[idx] != (~0L)) {
913 if (((bits[idx] & (TWO_N_ARRAY[j])) == 0)) {
919 while (idx < length && bits[idx] == (~0L)) {
929 if (((bits[idx] & (TWO_N_ARRAY[j])) == 0)) {
938 * Returns true if all the bits in this {@code BitSet} are set to false.
947 int length = bits.length;
949 if (bits[idx] != 0L) {
957 * Returns the number of bits that are {@code true} in this {@code BitSet}.
959 * @return the number of {@code true} bits in the set.
966 int length = bits.length;
968 // 256-bits table based
970 count += pop(bits[idx] & 0xffffffffL);
971 count += pop(bits[idx] >>> 32);
992 this.actualArrayLength = bits.length;