/** * Set the bit at position i to false. * * Though you can clear the bits in any order (e.g., clear(100), clear(10), clear(1), * you will typically get better performance if you clear the bits in increasing order (e.g., clear(1), clear(10), clear(100)). * * Clearing a bit that is larger than the biggest bit is a constant time operation. * Clearing a bit that is smaller than the biggest bit can require time proportional * to the compressed size of the bitmap, as the bitmap may need to be rewritten. * * Since this modifies the bitmap, this method is not thread-safe. * * @param i the index * @return true if the value was unset * @throws IndexOutOfBoundsException if i is negative or greater than Integer.MAX_VALUE - 32 */ public boolean clear(final int i) { return set(i, false); }
/** * Set the bit at position i to true. * * Though you can set the bits in any order (e.g., set(100), set(10), set(1), * you will typically get better performance if you set the bits in increasing order (e.g., set(1), set(10), set(100)). * * Setting a bit that is larger than any of the current set bit * is a constant time operation. Setting a bit that is smaller than an * already set bit can require time proportional to the compressed * size of the bitmap, as the bitmap may need to be rewritten. * * Since this modifies the bitmap, this method is not thread-safe. * * @param i the index * @return true if the value was set * @throws IndexOutOfBoundsException if i is negative or greater than Integer.MAX_VALUE - 32 */ public boolean set(final int i) { return set(i, true); }
/** * Set the bit at position i to false. * * Though you can clear the bits in any order (e.g., clear(100), clear(10), clear(1), * you will typically get better performance if you clear the bits in increasing order (e.g., clear(1), clear(10), clear(100)). * * Clearing a bit that is larger than the biggest bit is a constant time operation. * Clearing a bit that is smaller than the biggest bit can require time proportional * to the compressed size of the bitmap, as the bitmap may need to be rewritten. * * Since this modifies the bitmap, this method is not thread-safe. * * @param i the index * @return true if the value was unset * @throws IndexOutOfBoundsException if i is negative or greater than Integer.MAX_VALUE - 32 */ public boolean clear(final int i) { return set(i, false); }
/** * Set the bit at position i to true. * * Though you can set the bits in any order (e.g., set(100), set(10), set(1), * you will typically get better performance if you set the bits in increasing order (e.g., set(1), set(10), set(100)). * * Setting a bit that is larger than any of the current set bit * is a constant time operation. Setting a bit that is smaller than an * already set bit can require time proportional to the compressed * size of the bitmap, as the bitmap may need to be rewritten. * * Since this modifies the bitmap, this method is not thread-safe. * * @param i the index * @return true if the value was set * @throws IndexOutOfBoundsException if i is negative or greater than Integer.MAX_VALUE - 32 */ public boolean set(final int i) { return set(i, true); }
/** * Return a bitmap with the bit set to true at the given positions. The * positions should be given in sorted order. * * (This is a convenience method.) * * @param setbits list of set bit positions * @return the bitmap * @since 0.4.5 */ public static EWAHCompressedBitmap32 bitmapOf(int... setbits) { EWAHCompressedBitmap32 a = new EWAHCompressedBitmap32(); for (int k : setbits) a.set(k); return a; }
/** * Return a bitmap with the bit set to true at the given positions. The * positions should be given in sorted order. * * (This is a convenience method.) * * @param setbits list of set bit positions * @return the bitmap * @since 0.4.5 */ public static EWAHCompressedBitmap32 bitmapOf(int... setbits) { EWAHCompressedBitmap32 a = new EWAHCompressedBitmap32(); for (int k : setbits) a.set(k); return a; }