/** * Sets all bits. */ public final void setAll() { expand(0, length() - 1); for (int i = 0; i < bits.length; i++) { bits[i] = MASK; } }
/** * Logically NOT this bit string */ public final void not() { if (offset != 0) { expand(0, offset + length() - 1); } for (int i = 0; i < bits.length; i++) { bits[i] ^= MASK; } }
/** * Sets all bits. */ public final void setAll() { expand(0, length() - 1); for (int i = 0; i < bits.length; i++) { bits[i] = MASK; } }
/** * Logically NOT this bit string */ public final void not() { if (offset != 0) { expand(0, offset + length() - 1); } for (int i = 0; i < bits.length; i++) { bits[i] ^= MASK; } }
/** * Logically NOT this bit string */ public final void not() { if (offset != 0) { expand(0, offset + length() - 1); } for (int i = 0; i < bits.length; i++) { bits[i] ^= MASK; } }
/** * Sets all bits. */ public final void setAll() { expand(0, length() - 1); for (int i = 0; i < bits.length; i++) { bits[i] = MASK; } }
private boolean inDenseRange(int i) { return densePart.getOffset() <= i && densePart.length() > i; }
private boolean inDenseRange(int i) { return densePart.getOffset() <= i && densePart.length() > i; }
private boolean inDenseRange(int i) { return densePart.getOffset() <= i && densePart.length() > i; }
/** * Logically ORs this bit set with the specified set of bits. * * @param set the bit set to be ORed with * @throws IllegalArgumentException if set == null */ @Override public final void or(OffsetBitVector set) throws IllegalArgumentException { if (set == null) { throw new IllegalArgumentException("set == null"); } if (this == set) { // should help alias analysis return; } int newOffset = Math.min(offset, set.offset); int newCapacity = Math.max(length(), set.length()) - newOffset; ensureCapacity(newOffset, newCapacity); int wordDiff = wordDiff(newOffset, set.offset); for (int i = 0; i < set.bits.length; i++) { bits[i - wordDiff] |= set.bits[i]; } }
/** * Logically ORs this bit set with the specified set of bits. * * @param set the bit set to be ORed with * @throws IllegalArgumentException if set == null */ @Override public final void or(OffsetBitVector set) throws IllegalArgumentException { if (set == null) { throw new IllegalArgumentException("set == null"); } if (this == set) { // should help alias analysis return; } int newOffset = Math.min(offset, set.offset); int newCapacity = Math.max(length(), set.length()) - newOffset; ensureCapacity(newOffset, newCapacity); int wordDiff = wordDiff(newOffset, set.offset); for (int i = 0; i < set.bits.length; i++) { bits[i - wordDiff] |= set.bits[i]; } }
/** * Logically ORs this bit set with the specified set of bits. * * @param set the bit set to be ORed with * @throws IllegalArgumentException if set == null */ @Override public final void or(OffsetBitVector set) throws IllegalArgumentException { if (set == null) { throw new IllegalArgumentException("set == null"); } if (this == set) { // should help alias analysis return; } int newOffset = Math.min(offset, set.offset); int newCapacity = Math.max(length(), set.length()) - newOffset; ensureCapacity(newOffset, newCapacity); int wordDiff = wordDiff(newOffset, set.offset); for (int i = 0; i < set.bits.length; i++) { bits[i - wordDiff] |= set.bits[i]; } }
/** * Logically XORs this bit set with the specified set of bits. * * @param set the bit set to be XORed with * @throws IllegalArgumentException if set == null */ @Override public final void xor(OffsetBitVector set) throws IllegalArgumentException { if (set == null) { throw new IllegalArgumentException("set == null"); } if (this == set) { clearAll(); return; } int newOffset = Math.min(offset, set.offset); int newCapacity = Math.max(length(), set.length()) - newOffset; ensureCapacity(newOffset, newCapacity); int wordDiff = wordDiff(newOffset, set.offset); for (int i = 0; i < set.bits.length; i++) { bits[i - wordDiff] ^= set.bits[i]; } }
/** * Logically XORs this bit set with the specified set of bits. * * @param set the bit set to be XORed with * @throws IllegalArgumentException if set == null */ @Override public final void xor(OffsetBitVector set) throws IllegalArgumentException { if (set == null) { throw new IllegalArgumentException("set == null"); } if (this == set) { clearAll(); return; } int newOffset = Math.min(offset, set.offset); int newCapacity = Math.max(length(), set.length()) - newOffset; ensureCapacity(newOffset, newCapacity); int wordDiff = wordDiff(newOffset, set.offset); for (int i = 0; i < set.bits.length; i++) { bits[i - wordDiff] ^= set.bits[i]; } }
/** * Logically XORs this bit set with the specified set of bits. * * @param set the bit set to be XORed with * @throws IllegalArgumentException if set == null */ @Override public final void xor(OffsetBitVector set) throws IllegalArgumentException { if (set == null) { throw new IllegalArgumentException("set == null"); } if (this == set) { clearAll(); return; } int newOffset = Math.min(offset, set.offset); int newCapacity = Math.max(length(), set.length()) - newOffset; ensureCapacity(newOffset, newCapacity); int wordDiff = wordDiff(newOffset, set.offset); for (int i = 0; i < set.bits.length; i++) { bits[i - wordDiff] ^= set.bits[i]; } }
if (bit < offset) { int newOffset = bit & ~LOW_MASK; expand(newOffset, length() - 1 - newOffset); shiftBits = bit & LOW_MASK; subscript = 0;
if (bit < offset) { int newOffset = bit & ~LOW_MASK; expand(newOffset, length() - 1 - newOffset); shiftBits = bit & LOW_MASK; subscript = 0;
if (bit < offset) { int newOffset = bit & ~LOW_MASK; expand(newOffset, length() - 1 - newOffset); shiftBits = bit & LOW_MASK; subscript = 0;
while (thisBit < densePart.length() && sparseBits.hasNext()) { thisBit = sparseBits.next(); if (thisBit >= densePart.length()) { int count = 1; int bits = (thisBit + 1 - densePart.length()); if (32 * count > bits) { newLength = thisBit; thisBit = sparseBits.next(); count++; bits = (thisBit + 1 - densePart.length()); if ((32 * count) > bits) { newLength = thisBit; bits[index++] = bit; if (newLength != -1 && bit >= densePart.length() && bit <= newLength) { bits[index++] = bit; int currentSize = densePart.length() - base; float newSize = 1.1f * (bits[index - 1] - base); float fraction = newSize / currentSize; assert assertDisjoint() : this.toString() + ", densePart.length()=" + densePart.length() + ", newOffset=" + newOffset + ", newLength=" + newLength + ", newCount=" + newCount + ", moveCount=" + moveCount;
while (thisBit < densePart.length() && sparseBits.hasNext()) { thisBit = sparseBits.next(); if (thisBit >= densePart.length()) { int count = 1; int bits = (thisBit + 1 - densePart.length()); if (32 * count > bits) { newLength = thisBit; thisBit = sparseBits.next(); count++; bits = (thisBit + 1 - densePart.length()); if ((32 * count) > bits) { newLength = thisBit; bits[index++] = bit; if (newLength != -1 && bit >= densePart.length() && bit <= newLength) { bits[index++] = bit; int currentSize = densePart.length() - base; float newSize = 1.1f * (bits[index - 1] - base); float fraction = newSize / currentSize; assert assertDisjoint() : this.toString() + ", densePart.length()=" + densePart.length() + ", newOffset=" + newOffset + ", newLength=" + newLength + ", newCount=" + newCount + ", moveCount=" + moveCount;