|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsparsebitmap.SparseBitmap
public class SparseBitmap
The purpose of this class is to provide a compressed alternative to the Java BitSet class that can scale to much larger bit ranges. It also offers good processing performance while remaining simple.
| Field Summary | |
|---|---|
IntArray |
buffer
buffer is where the data is store. |
int |
sizeinwords
sizeinwords*32 is the the number of bits represented by this bitmap. |
static int |
WORDSIZE
We have a 32-bit implementation (ints are 32-bit in Java). |
| Constructor Summary | |
|---|---|
SparseBitmap()
Constructs a SparseBitmap object with default parameters. |
|
SparseBitmap(int expectedstoragesize)
Constructs a SparseBitmap object. |
|
| Method Summary | |
|---|---|
void |
add(int wo,
int off)
For expert use: add a literal bitmap word so that the resulting bitmap will cover off+1 words. |
static SkippableIterator |
and(SkippableIterator... bitmap)
And. |
static SparseBitmap |
and(SparseBitmap... bitmaps)
Computes the bit-wise and aggregate over several bitmaps. |
SparseBitmap |
and(SparseBitmap o)
Compute the bit-wise logical and with another bitmap. |
static void |
and2by2(BitmapContainer container,
SparseBitmap bitmap1,
SparseBitmap bitmap2)
Computes the bit-wise logical exclusive and of two bitmaps. |
static SkippableIterator |
and2by2(SkippableIterator bitmap1,
SkippableIterator bitmap2)
And2by2. |
static SparseBitmap |
bitmapOf(int... k)
Convenience method: will construct a bitmap with the specified bit sets. |
int |
cardinality()
Compute the cardinality. |
static int |
cardinality(SkippableIterator i)
Cardinality. |
void |
clear()
Reinitialize this bitmap. |
Object |
clone()
|
void |
deserialize(DataInput in)
Deserialize. |
boolean |
equals(Object o)
Checks whether two SparseBitmap have the same bit sets. |
static SkippableIterator |
fastand(SkippableIterator... bitmap)
Fastand. |
static SkippableIterator |
fastand(SparseBitmap... bitmaps)
|
static SkippableIterator |
flatand(SkippableIterator... bitmap)
Flatand. |
IntIterator |
getIntIterator()
Build a fast iterator over the set bits. |
SkippableIterator |
getSkippableIterator()
Gets the skippable iterator. |
int |
hashCode()
Return a hash value for this object. |
Iterator<Integer> |
iterator()
Allow you to iterate over the set bits. |
static boolean |
match(SkippableIterator o1,
SkippableIterator o2)
Synchronize two iterators |
static SparseBitmap |
materialize(SkippableIterator i)
Materialize. |
static SparseBitmap |
or(SparseBitmap... bitmaps)
Computes the bit-wise or aggregate over several bitmaps. |
SparseBitmap |
or(SparseBitmap o)
Computes the bit-wise logical or with another bitmap. |
static void |
or2by2(BitmapContainer container,
SparseBitmap bitmap1,
SparseBitmap bitmap2)
Computes the bit-wise logical or of two bitmaps. |
void |
readExternal(ObjectInput in)
|
static SkippableIterator |
reverseflatand(SkippableIterator... bitmap)
Reverseflatand. |
void |
serialize(DataOutput out)
Serialize. |
void |
set(int i)
Set the bit at position i to true. |
int |
sizeInBytes()
Return how much space is used by data (in bytes). |
int[] |
toArray()
Convenience method: returns an array containing the set bits. |
String |
toString()
A string describing the bitmap. |
static SkippableIterator |
treeand(SkippableIterator... bitmap)
Treeand. |
int |
trim()
Minimizes the memory usage by copying over the data on a smaller array. |
void |
writeExternal(ObjectOutput out)
|
static SparseBitmap |
xor(SparseBitmap... bitmaps)
Computes the bit-wise exclusive or aggregate over several bitmaps. |
SparseBitmap |
xor(SparseBitmap o)
Computes the bit-wise logical exclusive or with another bitmap. |
static void |
xor2by2(BitmapContainer container,
SparseBitmap bitmap1,
SparseBitmap bitmap2)
Computes the bit-wise logical exclusive or of two bitmaps. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public int sizeinwords
public IntArray buffer
public static final int WORDSIZE
| Constructor Detail |
|---|
public SparseBitmap()
public SparseBitmap(int expectedstoragesize)
expectedstoragesize - this parameter corresponds to the initial memory allocation| Method Detail |
|---|
public void add(int wo,
int off)
add in interface BitmapContainerwo - literal bitmap word to addoff - position at (total size will be off+1)public boolean equals(Object o)
equals in class Objecto - the o
public int hashCode()
hashCode in class Objectpublic int[] toArray()
public String toString()
toString in class Objectpublic static SparseBitmap bitmapOf(int... k)
k - the list of bits to set
public void set(int i)
i - the ipublic Iterator<Integer> iterator()
iterator in interface Iterable<Integer>public IntIterator getIntIterator()
public SparseBitmap and(SparseBitmap o)
o - another bitmap
public static void and2by2(BitmapContainer container,
SparseBitmap bitmap1,
SparseBitmap bitmap2)
container - where the data will be storedbitmap1 - the first bitmapbitmap2 - the second bitmappublic static SkippableIterator and(SkippableIterator... bitmap)
bitmap - the bitmap
public static SkippableIterator fastand(SkippableIterator... bitmap)
bitmap - the bitmap
public static SkippableIterator treeand(SkippableIterator... bitmap)
bitmap - the bitmap
public static SkippableIterator flatand(SkippableIterator... bitmap)
bitmap - the bitmap
public static SkippableIterator reverseflatand(SkippableIterator... bitmap)
bitmap - the bitmap
public static SparseBitmap materialize(SkippableIterator i)
i - the i
public static int cardinality(SkippableIterator i)
i - the i
public static SkippableIterator and2by2(SkippableIterator bitmap1,
SkippableIterator bitmap2)
bitmap1 - the bitmap1bitmap2 - the bitmap2
public SparseBitmap or(SparseBitmap o)
o - another bitmap
public static void or2by2(BitmapContainer container,
SparseBitmap bitmap1,
SparseBitmap bitmap2)
container - where the data will be storedbitmap1 - the first bitmapbitmap2 - the second bitmappublic SparseBitmap xor(SparseBitmap o)
o - another bitmap
public static void xor2by2(BitmapContainer container,
SparseBitmap bitmap1,
SparseBitmap bitmap2)
container - where the data will be storedbitmap1 - the first bitmapbitmap2 - the second bitmappublic static SparseBitmap and(SparseBitmap... bitmaps)
bitmaps - the bitmaps to aggregate
public static SkippableIterator fastand(SparseBitmap... bitmaps)
public static SparseBitmap or(SparseBitmap... bitmaps)
bitmaps - the bitmaps to aggregate
public static SparseBitmap xor(SparseBitmap... bitmaps)
bitmaps - the bitmaps to aggregate
public int sizeInBytes()
public int trim()
public SkippableIterator getSkippableIterator()
public static boolean match(SkippableIterator o1,
SkippableIterator o2)
o1 - the first iteratoro2 - the second iterator
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOException
public void serialize(DataOutput out)
throws IOException
out - the stream
IOException - Signals that an I/O exception has occurred.
public void deserialize(DataInput in)
throws IOException
in - the stream
IOException - Signals that an I/O exception has occurred.public int cardinality()
public void clear()
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||