Package com.googlecode.javaewah
Class BitCounter
java.lang.Object
com.googlecode.javaewah.BitCounter
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLiteralWord(long newData)
Virtually add literal words directly to the bitmapvoid
addStreamOfEmptyWords(boolean v, long number)
virtually add many zeroes or ones.void
addStreamOfLiteralWords(com.googlecode.javaewah.Buffer buffer, int start, int number)
virtually add several literal words.void
addStreamOfNegatedLiteralWords(com.googlecode.javaewah.Buffer buffer, int start, int number)
virtually add several negated literal words.void
addWord(long newData)
Virtually add words directly to the bitmapvoid
clear()
Empties the container.int
getCount()
As you act on this class, it records the number of set (true) bits.void
setSizeInBitsWithinLastWord(int bits)
should directly set the sizeInBits field, but is effectively ignored in this class.
-
Constructor Details
-
BitCounter
public BitCounter()
-
-
Method Details
-
addWord
public void addWord(long newData)Virtually add words directly to the bitmap- Specified by:
addWord
in interfaceBitmapStorage
- Parameters:
newData
- the word
-
addLiteralWord
public void addLiteralWord(long newData)Virtually add literal words directly to the bitmap- Specified by:
addLiteralWord
in interfaceBitmapStorage
- Parameters:
newData
- the word
-
addStreamOfLiteralWords
public void addStreamOfLiteralWords(com.googlecode.javaewah.Buffer buffer, int start, int number)virtually add several literal words.- Specified by:
addStreamOfLiteralWords
in interfaceBitmapStorage
- Parameters:
buffer
- the buffer wrapping 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:
addStreamOfEmptyWords
in interfaceBitmapStorage
- Parameters:
v
- zeros or onesnumber
- how many to words add
-
addStreamOfNegatedLiteralWords
public void addStreamOfNegatedLiteralWords(com.googlecode.javaewah.Buffer buffer, int start, int number)virtually add several negated literal words.- Specified by:
addStreamOfNegatedLiteralWords
in interfaceBitmapStorage
- Parameters:
buffer
- the buffer wrapping the literal wordsstart
- the starting point in the arraynumber
- the number of literal words to add
-
clear
public void clear()Description copied from interface:BitmapStorage
Empties the container.- Specified by:
clear
in interfaceBitmapStorage
-
getCount
public int getCount()As you act on this class, it records the number of set (true) bits.- Returns:
- number of set bits
-
setSizeInBitsWithinLastWord
public void setSizeInBitsWithinLastWord(int bits)should directly set the sizeInBits field, but is effectively ignored in this class.- Specified by:
setSizeInBitsWithinLastWord
in interfaceBitmapStorage
- Parameters:
bits
- number of bits
-