javaewah
Class BitCounter

java.lang.Object
  extended by javaewah.BitCounter
All Implemented Interfaces:
BitmapStorage

public final class BitCounter
extends 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
BitCounter()
           
 
Method Summary
 void add(long newdata)
          Virtually add words directly to the bitmap
 void addStreamOfDirtyWords(long[] data, int start, int number)
          virtually add several dirty words.
 void addStreamOfEmptyWords(boolean v, long number)
          virtually add many zeroes or ones.
 void addStreamOfNegatedDirtyWords(long[] data, int start, int number)
          virtually add several negated dirty words.
 int getCount()
          As you act on this class, it records the number of set (true) bits.
 void setSizeInBits(int bits)
          should directly set the sizeinbits field, but is effectively ignored in this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitCounter

public BitCounter()
Method Detail

add

public void add(long newdata)
Virtually add words directly to the bitmap

Specified by:
add in interface BitmapStorage
Parameters:
newdata - the word

addStreamOfEmptyWords

public void addStreamOfEmptyWords(boolean v,
                                  long number)
virtually add many zeroes or ones.

Specified by:
addStreamOfEmptyWords in interface BitmapStorage
Parameters:
v - zeros or ones
number - how many to words add

addStreamOfDirtyWords

public void addStreamOfDirtyWords(long[] data,
                                  int start,
                                  int number)
virtually add several dirty words.

Specified by:
addStreamOfDirtyWords in interface BitmapStorage
Parameters:
data - the dirty words
start - the starting point in the array
number - the number of dirty words to add

addStreamOfNegatedDirtyWords

public void addStreamOfNegatedDirtyWords(long[] data,
                                         int start,
                                         int number)
virtually add several negated dirty words.

Specified by:
addStreamOfNegatedDirtyWords in interface BitmapStorage
Parameters:
data - the dirty words
start - the starting point in the array
number - the number of dirty words to add

setSizeInBits

public void setSizeInBits(int bits)
should directly set the sizeinbits field, but is effectively ignored in this class.

Specified by:
setSizeInBits in interface BitmapStorage
Parameters:
bits - number of bits

getCount

public int getCount()
As you act on this class, it records the number of set (true) bits.

Returns:
number of set bits


Copyright © 2012. All Rights Reserved.