remove many unused methods from OpenBitSet
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/438e7533 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/438e7533 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/438e7533 Branch: refs/heads/trunk Commit: 438e75335f57d5cb8c60e42c21efa8adbb900346 Parents: f593717 Author: Jonathan Ellis <[email protected]> Authored: Thu Oct 25 22:52:16 2012 -0500 Committer: Jonathan Ellis <[email protected]> Committed: Fri Oct 26 01:06:17 2012 -0700 ---------------------------------------------------------------------- .../org/apache/cassandra/utils/obs/OpenBitSet.java | 126 --------------- 1 files changed, 0 insertions(+), 126 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/438e7533/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java b/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java index 2fa2644..1ddbe8f 100644 --- a/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java +++ b/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java @@ -97,12 +97,6 @@ public class OpenBitSet implements Serializable { return bits[pageIdx]; } - /** Contructs an OpenBitset from a BitSet - */ - public OpenBitSet(BitSet bits) { - this(bits.length()); - } - /** Returns the current capacity in bits (1 greater than the index of the last bit) */ public long capacity() { return ((long)wlen) << 6; } @@ -153,15 +147,6 @@ public class OpenBitSet implements Serializable { return (bits[i / PAGE_SIZE][i % PAGE_SIZE ] & bitmask) != 0; } - /** returns 1 if the bit is set, 0 if not. - * The index should be less than the OpenBitSet size - */ - public int getBit(int index) { - int i = index >> 6; // div 64 - int bit = index & 0x3f; // mod 64 - return ((int)(bits[i / PAGE_SIZE][i % PAGE_SIZE ]>>>bit)) & 0x01; - } - /** * Sets the bit at the specified index. * The index should be less than the OpenBitSet size. @@ -302,75 +287,6 @@ public class OpenBitSet implements Serializable { } } - - - /** Sets a bit and returns the previous value. - * The index should be less than the OpenBitSet size. - */ - public boolean getAndSet(int index) { - int wordNum = index >> 6; // div 64 - int bit = index & 0x3f; // mod 64 - long bitmask = 1L << bit; - boolean val = (bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] & bitmask) != 0; - bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] |= bitmask; - return val; - } - - /** Sets a bit and returns the previous value. - * The index should be less than the OpenBitSet size. - */ - public boolean getAndSet(long index) { - int wordNum = (int)(index >> 6); // div 64 - int bit = (int)index & 0x3f; // mod 64 - long bitmask = 1L << bit; - boolean val = (bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] & bitmask) != 0; - bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] |= bitmask; - return val; - } - - /** flips a bit. - * The index should be less than the OpenBitSet size. - */ - public void flip(int index) { - int wordNum = index >> 6; // div 64 - int bit = index & 0x3f; // mod 64 - long bitmask = 1L << bit; - bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] ^= bitmask; - } - - /** - * flips a bit. - * The index should be less than the OpenBitSet size. - */ - public void flip(long index) { - int wordNum = (int)(index >> 6); // div 64 - int bit = (int)index & 0x3f; // mod 64 - long bitmask = 1L << bit; - bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] ^= bitmask; - } - - /** flips a bit and returns the resulting bit value. - * The index should be less than the OpenBitSet size. - */ - public boolean flipAndGet(int index) { - int wordNum = index >> 6; // div 64 - int bit = index & 0x3f; // mod 64 - long bitmask = 1L << bit; - bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] ^= bitmask; - return (bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] & bitmask) != 0; - } - - /** flips a bit and returns the resulting bit value. - * The index should be less than the OpenBitSet size. - */ - public boolean flipAndGet(long index) { - int wordNum = (int)(index >> 6); // div 64 - int bit = (int)index & 0x3f; // mod 64 - long bitmask = 1L << bit; - bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] ^= bitmask; - return (bits[wordNum / PAGE_SIZE][wordNum % PAGE_SIZE] & bitmask) != 0; - } - /** @return the number of set bits */ public long cardinality() { @@ -381,48 +297,6 @@ public class OpenBitSet implements Serializable { return bitCount; } - /** Returns the index of the first set bit starting at the index specified. - * -1 is returned if there are no more set bits. - */ - public int nextSetBit(int index) { - int i = index>>6; - if (i>=wlen) return -1; - int subIndex = index & 0x3f; // index within the word - long word = bits[i / PAGE_SIZE][ i % PAGE_SIZE] >> subIndex; // skip all the bits to the right of index - - if (word!=0) { - return (i<<6) + subIndex + BitUtil.ntz(word); - } - - while(++i < wlen) { - word = bits[i / PAGE_SIZE][i % PAGE_SIZE]; - if (word!=0) return (i<<6) + BitUtil.ntz(word); - } - - return -1; - } - - /** Returns the index of the first set bit starting at the index specified. - * -1 is returned if there are no more set bits. - */ - public long nextSetBit(long index) { - int i = (int)(index>>>6); - if (i>=wlen) return -1; - int subIndex = (int)index & 0x3f; // index within the word - long word = bits[i / PAGE_SIZE][i % PAGE_SIZE] >>> subIndex; // skip all the bits to the right of index - - if (word!=0) { - return (((long)i)<<6) + (subIndex + BitUtil.ntz(word)); - } - - while(++i < wlen) { - word = bits[i / PAGE_SIZE][i % PAGE_SIZE]; - if (word!=0) return (((long)i)<<6) + BitUtil.ntz(word); - } - - return -1; - } - /** this = this AND other */ public void intersect(OpenBitSet other) { int newLen= Math.min(this.wlen,other.wlen);
