public class MutableRoaringBitmap extends ImmutableRoaringBitmap implements Cloneable, Serializable, Iterable<Integer>, Externalizable, BitmapDataProvider
import org.roaringbitmap.buffer.*;
//...
MutableRoaringBitmap rr = MutableRoaringBitmap.bitmapOf(1,2,3,1000);
MutableRoaringBitmap rr2 = new MutableRoaringBitmap();
for(int k = 4000; k<4255;++k) rr2.add(k);
RoaringBitmap rror = RoaringBitmap.or(rr, rr2);
//...
DataOutputStream wheretoserialize = ...
rr.runOptimize(); // can help compression
rr.serialize(wheretoserialize);
ImmutableRoaringBitmap,
RoaringBitmap,
Serialized Form| Constructor and Description |
|---|
MutableRoaringBitmap()
Create an empty bitmap
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int x)
Add the value to the container (set the value to "true"), whether it already appears or not.
|
void |
add(int rangeStart,
int rangeEnd)
Add to the current bitmap all integers in [rangeStart,rangeEnd).
|
static MutableRoaringBitmap |
add(MutableRoaringBitmap rb,
int rangeStart,
int rangeEnd)
Generate a new bitmap with all integers in [rangeStart,rangeEnd) added.
|
void |
and(ImmutableRoaringBitmap array)
In-place bitwise AND (intersection) operation.
|
static MutableRoaringBitmap |
and(MutableRoaringBitmap x1,
MutableRoaringBitmap x2)
Bitwise AND (intersection) operation.
|
void |
andNot(ImmutableRoaringBitmap x2)
In-place bitwise ANDNOT (difference) operation.
|
static MutableRoaringBitmap |
andNot(MutableRoaringBitmap x1,
MutableRoaringBitmap x2)
Bitwise ANDNOT (difference) operation.
|
static MutableRoaringBitmap |
bitmapOf(int... dat)
Generate a bitmap with the specified values set to true.
|
boolean |
checkedAdd(int x)
Add the value to the container (set the value to "true"), whether it already appears or not.
|
boolean |
checkedRemove(int x)
If present remove the specified integer (effectively, sets its bit value
to false)
|
void |
clear()
reset to an empty bitmap; result occupies as much space a newly created
bitmap.
|
MutableRoaringBitmap |
clone() |
void |
deserialize(DataInput in)
Deserialize the bitmap (retrieve from the input stream).
|
void |
flip(int x)
Add the value if it is not already present, otherwise remove it.
|
void |
flip(int rangeStart,
int rangeEnd)
Modifies the current bitmap by complementing the bits in the given range,
from rangeStart (inclusive) rangeEnd (exclusive).
|
static MutableRoaringBitmap |
flip(MutableRoaringBitmap bm,
int rangeStart,
int rangeEnd)
Complements the bits in the given range, from rangeStart (inclusive)
rangeEnd (exclusive).
|
MutableRoaringArray |
getMappeableRoaringArray() |
int |
hashCode() |
Iterator<Integer> |
iterator()
iterate over the positions of the true values.
|
protected void |
lazyor(ImmutableRoaringBitmap x2) |
protected static MutableRoaringBitmap |
lazyorfromlazyinputs(MutableRoaringBitmap x1,
MutableRoaringBitmap x2) |
static MutableRoaringBitmap |
or(ImmutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps.
|
void |
or(ImmutableRoaringBitmap x2)
In-place bitwise OR (union) operation.
|
static MutableRoaringBitmap |
or(MutableRoaringBitmap x1,
MutableRoaringBitmap x2)
Bitwise OR (union) operation.
|
void |
readExternal(ObjectInput in) |
void |
remove(int x)
If present remove the specified integers (effectively, sets its bit value
to false)
|
void |
remove(int rangeStart,
int rangeEnd)
Remove from the current bitmap all integers in [rangeStart,rangeEnd).
|
static MutableRoaringBitmap |
remove(MutableRoaringBitmap rb,
int rangeStart,
int rangeEnd)
Generate a new bitmap with all integers in [rangeStart,rangeEnd) removed.
|
boolean |
removeRunCompression()
Remove run-length encoding even when it is more space efficient
|
protected void |
repairAfterLazy() |
boolean |
runOptimize()
Use a run-length encoding where it is estimated as more space efficient
|
String |
toString()
A string describing the bitmap.
|
void |
trim()
Recover allocated but unused memory.
|
void |
writeExternal(ObjectOutput out) |
void |
xor(ImmutableRoaringBitmap x2)
In-place bitwise XOR (symmetric difference) operation.
|
static MutableRoaringBitmap |
xor(MutableRoaringBitmap x1,
MutableRoaringBitmap x2)
Bitwise XOR (symmetric difference) operation.
|
and, andNot, contains, equals, flip, getCardinality, getIntIterator, getReverseIntIterator, getSizeInBytes, hasRunCompression, intersects, isEmpty, lazyor, limit, or, or, rank, select, serialize, serializedSizeInBytes, toArray, toMutableRoaringBitmap, xorfinalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorselectcontains, getCardinality, getIntIterator, getReverseIntIterator, getSizeInBytes, isEmpty, limit, rank, serialize, serializedSizeInBytes, toArraypublic static MutableRoaringBitmap and(MutableRoaringBitmap x1, MutableRoaringBitmap x2)
x1 - first bitmapx2 - other bitmappublic static MutableRoaringBitmap andNot(MutableRoaringBitmap x1, MutableRoaringBitmap x2)
x1 - first bitmapx2 - other bitmappublic static MutableRoaringBitmap bitmapOf(int... dat)
dat - set valuespublic static MutableRoaringBitmap flip(MutableRoaringBitmap bm, int rangeStart, int rangeEnd)
bm - bitmap being negatedrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic static MutableRoaringBitmap or(MutableRoaringBitmap x1, MutableRoaringBitmap x2)
x1 - first bitmapx2 - other bitmappublic static MutableRoaringBitmap xor(MutableRoaringBitmap x1, MutableRoaringBitmap x2)
x1 - first bitmapx2 - other bitmappublic boolean checkedAdd(int x)
x - integer valuepublic void add(int x)
add in interface BitmapDataProviderx - integer valuepublic void flip(int x)
x - integer valuepublic void add(int rangeStart,
int rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic static MutableRoaringBitmap add(MutableRoaringBitmap rb, int rangeStart, int rangeEnd)
rb - initial bitmap (will not be modified)rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic void remove(int rangeStart,
int rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic static MutableRoaringBitmap remove(MutableRoaringBitmap rb, int rangeStart, int rangeEnd)
rb - initial bitmap (will not be modified)rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic void and(ImmutableRoaringBitmap array)
array - other bitmappublic void andNot(ImmutableRoaringBitmap x2)
x2 - other bitmappublic void clear()
public MutableRoaringBitmap clone()
clone in class ImmutableRoaringBitmappublic void deserialize(DataInput in) throws IOException
in - the DataInput streamIOException - Signals that an I/O exception has occurred.public void flip(int rangeStart,
int rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic MutableRoaringArray getMappeableRoaringArray()
public int hashCode()
hashCode in class ImmutableRoaringBitmappublic static MutableRoaringBitmap or(ImmutableRoaringBitmap... bitmaps)
BufferFastAggregation.or(org.roaringbitmap.buffer.MutableRoaringBitmap...))bitmaps - input bitmapspublic Iterator<Integer> iterator()
iterator in interface Iterable<Integer>iterator in class ImmutableRoaringBitmappublic void or(ImmutableRoaringBitmap x2)
x2 - other bitmapprotected void repairAfterLazy()
protected static MutableRoaringBitmap lazyorfromlazyinputs(MutableRoaringBitmap x1, MutableRoaringBitmap x2)
protected void lazyor(ImmutableRoaringBitmap x2)
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic boolean checkedRemove(int x)
x - integer value representing the index in a bitmappublic void remove(int x)
remove in interface BitmapDataProviderx - integer value representing the index in a bitmappublic String toString()
toString in class ImmutableRoaringBitmappublic void trim()
trim in interface BitmapDataProviderpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic boolean runOptimize()
public boolean removeRunCompression()
public void xor(ImmutableRoaringBitmap x2)
x2 - other bitmapCopyright © 2015. All Rights Reserved.