Package com.googlecode.javaewah
Class BitCounter
- java.lang.Object
-
- com.googlecode.javaewah.BitCounter
-
- All Implemented Interfaces:
BitmapStorage
public final class BitCounter extends java.lang.Object implements BitmapStorage
BitCounter is a fake bitset data structure. Instead of storing the actual data, it only records the number of set bits.- Since:
- 0.4.0
- Author:
- David McIntosh
-
-
Constructor Summary
Constructors Constructor Description BitCounter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(long newdata)Virtually add words directly to the bitmapvoidaddStreamOfEmptyWords(boolean v, long number)virtually add many zeroes or ones.voidaddStreamOfLiteralWords(long[] data, int start, int number)virtually add several literal words.voidaddStreamOfNegatedLiteralWords(long[] data, int start, int number)virtually add several negated literal words.intgetCount()As you act on this class, it records the number of set (true) bits.voidsetSizeInBits(int bits)should directly set the sizeinbits field, but is effectively ignored in this class.
-
-
-
Method Detail
-
add
public void add(long newdata)
Virtually add words directly to the bitmap- Specified by:
addin interfaceBitmapStorage- Parameters:
newdata- the word
-
addStreamOfLiteralWords
public void addStreamOfLiteralWords(long[] data, int start, int number)virtually add several literal words.- Specified by:
addStreamOfLiteralWordsin interfaceBitmapStorage- Parameters:
data- the literal wordsstart- the starting point in the arraynumber- the number of literal words to add
-
addStreamOfEmptyWords
public void addStreamOfEmptyWords(boolean v, long number)virtually add many zeroes or ones.- Specified by:
addStreamOfEmptyWordsin interfaceBitmapStorage- Parameters:
v- zeros or onesnumber- how many to words add
-
addStreamOfNegatedLiteralWords
public void addStreamOfNegatedLiteralWords(long[] data, int start, int number)virtually add several negated literal words.- Specified by:
addStreamOfNegatedLiteralWordsin interfaceBitmapStorage- Parameters:
data- the literal wordsstart- the starting point in the arraynumber- the number of literal words to add
-
getCount
public int getCount()
As you act on this class, it records the number of set (true) bits.- Returns:
- number of set bits
-
setSizeInBits
public void setSizeInBits(int bits)
should directly set the sizeinbits field, but is effectively ignored in this class.- Specified by:
setSizeInBitsin interfaceBitmapStorage- Parameters:
bits- number of bits
-
-