public class SparseBitmap
extends java.lang.Object
implements java.lang.Iterable<java.lang.Integer>
| Modifier and Type | Method and Description |
|---|---|
SparseBitmap |
and(SparseBitmap rhs)
Computes the logical
and of the context bitmap
(this) and the given bitmap. |
int |
andCardinality(SparseBitmap rhs)
Size of the intersection of
this bitmap and
the given bitmap. |
SparseBitmap |
andNot(SparseBitmap rhs)
Computes the logical
and not of the context bitmap
(this) and the given bitmap. |
static SparseBitmap |
batchOr(SparseBitmap... bitmaps)
Creates a new SparseBitmap that is the logical
or of all the given bitmaps. |
int |
cardinality()
The number of bits that are set.
|
void |
clear()
Clears all the bits in this sparse bitmap.
|
static SparseBitmap |
createEmpty()
Creates a new
SparseBitmap that is empty. |
static SparseBitmap |
createFromSortedData(int... bitsToSet)
Creates a new
SparseBitmap from data that are already sorted
in strictly ascending order (duplicate values are okay). |
static SparseBitmap |
createFromUnsortedData(int... bitsToSet)
Creates a new
SparseBitmap from unsorted data. |
boolean |
equals(java.lang.Object obj) |
boolean |
get(int bitToGet)
Gets the value of the bit at the given index.
|
int |
getHighestBit()
Gets the highest bit that is set in the bitmap.
|
int |
hashCode() |
java.util.Iterator<java.lang.Integer> |
iterator() |
SparseBitmap |
or(SparseBitmap rhs)
Computes the logical
or of the context bitmap
(this) and the given bitmap. |
void |
set(int bitToSet)
Set the bit at the given index.
|
void |
setWithoutAscendingCheck(int bitToSet)
For speed, this method sets bits at the given index, without checking that the bits
are set in strictly ascending order.
|
java.util.List<java.lang.Integer> |
toList()
Creates a binary list representation of this sparse bitmap.
|
java.lang.String |
toString() |
public static SparseBitmap createEmpty()
SparseBitmap that is empty.SparseBitmap that is empty (no bits set).public static SparseBitmap createFromSortedData(int... bitsToSet)
SparseBitmap from data that are already sorted
in strictly ascending order (duplicate values are okay).bitsToSet - The bits to set.SparseBitmap with the given bits set.public static SparseBitmap createFromUnsortedData(int... bitsToSet)
SparseBitmap from unsorted data.bitsToSet - The bits to set.SparseBitmap with the given bits set.public static SparseBitmap batchOr(SparseBitmap... bitmaps)
or of all the given bitmaps.bitmaps - Bitmaps to compute the logical or foror of the given bitmaps.public boolean get(int bitToGet)
bitToGet - The index of the bit to get.bitToGet index.public void setWithoutAscendingCheck(int bitToSet)
bitToSet - index of the bit to setpublic void set(int bitToSet)
bitToSet - The index of the bit to set.public void clear()
public SparseBitmap or(SparseBitmap rhs)
or of the context bitmap
(this) and the given bitmap.rhs - Bitmap to compute the logical or with.or of this bitmap
(context object) and the given bitmap.public SparseBitmap and(SparseBitmap rhs)
and of the context bitmap
(this) and the given bitmap.rhs - Bitmap to compute the logical and with.and of this bitmap
(context object) and the given bitmap.public SparseBitmap andNot(SparseBitmap rhs)
and not of the context bitmap
(this) and the given bitmap.rhs - Bitmap to compute the logical and not with.and not of this bitmap
(context object) and the given bitmap.public int getHighestBit()
public int andCardinality(SparseBitmap rhs)
this bitmap and
the given bitmap.rhs - given sparse bitmap to compute the size of the intersection ofthis bitmap and the given bitmap.public int cardinality()
public java.util.List<java.lang.Integer> toList()
public java.util.Iterator<java.lang.Integer> iterator()
iterator in interface java.lang.Iterable<java.lang.Integer>public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object