public final class MappeableBitmapContainer extends MappeableContainer implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected static int |
MAX_CAPACITY |
static boolean |
USE_BRANCHLESS
optimization flag: whether the cardinality of the bitmaps is maintained through branchless
operation
|
ContainerNames| Constructor and Description |
|---|
MappeableBitmapContainer()
Create a bitmap container with all bits set to false
|
MappeableBitmapContainer(BitmapContainer bc)
Creates a new bitmap container from a non-mappeable one.
|
MappeableBitmapContainer(int firstOfRun,
int lastOfRun)
Create a bitmap container with a run of ones from firstOfRun to lastOfRun, inclusive caller
must ensure that the range isn't so small that an ArrayContainer should have been created
instead
|
MappeableBitmapContainer(LongBuffer array,
int initCardinality)
Construct a new BitmapContainer backed by the provided LongBuffer.
|
| Modifier and Type | Method and Description |
|---|---|
MappeableContainer |
add(int begin,
int end)
Return a new container with all shorts in [begin,end) added using an unsigned interpretation.
|
MappeableContainer |
add(short i)
Add a short to the container.
|
MappeableArrayContainer |
and(MappeableArrayContainer value2)
Computes the bitwise AND of this container with another (intersection).
|
MappeableContainer |
and(MappeableBitmapContainer value2)
Computes the bitwise AND of this container with another (intersection).
|
MappeableContainer |
and(MappeableRunContainer value2)
Computes the bitwise AND of this container with another (intersection).
|
int |
andCardinality(MappeableArrayContainer value2) |
int |
andCardinality(MappeableBitmapContainer value2) |
int |
andCardinality(MappeableRunContainer x) |
MappeableContainer |
andNot(MappeableArrayContainer value2)
Computes the bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
andNot(MappeableBitmapContainer value2)
Computes the bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
andNot(MappeableRunContainer value2)
Computes the bitwise ANDNOT of this container with another (difference).
|
protected long |
bitValue(short i) |
protected int |
cardinalityInRange(int start,
int end) |
void |
clear()
Empties the container
|
MappeableBitmapContainer |
clone() |
protected void |
computeCardinality()
Recomputes the cardinality of the bitmap.
|
static boolean |
contains(ByteBuffer buf,
int position,
short i)
Checks whether the container contains the value i.
|
protected boolean |
contains(MappeableArrayContainer arrayContainer) |
protected boolean |
contains(MappeableBitmapContainer bitmapContainer) |
protected boolean |
contains(MappeableRunContainer runContainer) |
boolean |
contains(short i)
Checks whether the contain contains the provided value
|
boolean |
equals(Object o) |
protected void |
fillArray(short[] array)
Fill the array with set bits
|
void |
fillLeastSignificant16bits(int[] x,
int i,
int mask)
Fill the least significant 16 bits of the integer array, starting at index index, with the
short values from this container.
|
int |
first()
Get the first integer held in the container
|
MappeableContainer |
flip(short i)
Add a short to the container if it is not present, otherwise remove it.
|
void |
forEach(short msb,
IntConsumer ic)
Iterate through the values of this container and pass them
along to the IntConsumer, using msb as the 16 most significant bits.
|
protected int |
getArraySizeInBytes()
Size of the underlying array
|
int |
getCardinality()
Computes the distinct number of short values in the container.
|
ShortIterator |
getReverseShortIterator()
Iterator to visit the short values in the container in descending order.
|
PeekableShortIterator |
getShortIterator()
Iterator to visit the short values in the container in ascending order.
|
int |
getSizeInBytes()
Computes an estimate of the memory usage of this container.
|
int |
hashCode() |
MappeableContainer |
iadd(int begin,
int end)
Add all shorts in [begin,end) using an unsigned interpretation.
|
MappeableContainer |
iand(MappeableArrayContainer b2)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iand(MappeableBitmapContainer b2)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iand(MappeableRunContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iandNot(MappeableArrayContainer b2)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
iandNot(MappeableBitmapContainer b2)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
iandNot(MappeableRunContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
protected MappeableContainer |
ilazyor(MappeableArrayContainer value2) |
protected MappeableContainer |
ilazyor(MappeableBitmapContainer x) |
protected MappeableContainer |
ilazyor(MappeableRunContainer x) |
MappeableContainer |
inot(int firstOfRange,
int lastOfRange)
Computes the in-place bitwise NOT of this container (complement).
|
boolean |
intersects(MappeableArrayContainer value2)
Returns true if the current container intersects the other container.
|
boolean |
intersects(MappeableBitmapContainer value2)
Returns true if the current container intersects the other container.
|
boolean |
intersects(MappeableRunContainer x)
Returns true if the current container intersects the other container.
|
MappeableBitmapContainer |
ior(MappeableArrayContainer value2)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
ior(MappeableBitmapContainer b2)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
ior(MappeableRunContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
iremove(int begin,
int end)
Remove shorts in [begin,end) using an unsigned interpretation.
|
protected boolean |
isArrayBacked() |
protected boolean |
isFull() |
Iterator<Short> |
iterator() |
MappeableContainer |
ixor(MappeableArrayContainer value2)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
ixor(MappeableBitmapContainer b2)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
ixor(MappeableRunContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
int |
last()
Get the last integer held in the container
|
protected MappeableContainer |
lazyor(MappeableArrayContainer value2) |
protected MappeableContainer |
lazyor(MappeableBitmapContainer x) |
protected MappeableContainer |
lazyor(MappeableRunContainer x) |
MappeableContainer |
limit(int maxcardinality)
Create a new MappeableContainer containing at most maxcardinality integers.
|
protected void |
loadData(MappeableArrayContainer arrayContainer) |
int |
nextSetBit(int i)
Find the index of the next set bit greater or equal to i, returns -1 if none found.
|
short |
nextUnsetBit(int i)
Find the index of the next unset bit greater or equal to i, returns -1 if none found.
|
MappeableContainer |
not(int firstOfRange,
int lastOfRange)
Computes the bitwise NOT of this container (complement).
|
int |
numberOfRunsAdjustment()
Computes the number of runs
|
int |
numberOfRunsLowerBound(int mustNotExceed)
Counts how many runs there is in the bitmap, up to a maximum
|
MappeableContainer |
or(MappeableArrayContainer value2)
Computes the bitwise OR of this container with another (union).
|
MappeableContainer |
or(MappeableBitmapContainer value2)
Computes the bitwise OR of this container with another (union).
|
MappeableContainer |
or(MappeableRunContainer value2)
Computes the bitwise OR of this container with another (union).
|
int |
prevSetBit(int i)
Find the index of the previous set bit less than or equal to i, returns -1 if none found.
|
int |
rank(short lowbits)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be
GetCardinality()).
|
void |
readExternal(ObjectInput in) |
MappeableContainer |
remove(int begin,
int end)
Return a new container with all shorts in [begin,end) remove using an unsigned interpretation.
|
MappeableContainer |
remove(short i)
Remove the short from this container.
|
MappeableContainer |
repairAfterLazy()
The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.
|
MappeableContainer |
runOptimize()
Convert to MappeableRunContainers, when the result is smaller.
|
short |
select(int j)
Return the jth value
|
int |
serializedSizeInBytes()
Report the number of bytes required to serialize this container.
|
protected static int |
serializedSizeInBytes(int unusedCardinality) |
MappeableArrayContainer |
toArrayContainer()
Copies the data to an array container
|
MappeableBitmapContainer |
toBitmapContainer()
Convert the current container to a BitmapContainer, if a conversion is needed.
|
Container |
toContainer()
Convert to a non-mappeable container.
|
long[] |
toLongArray()
Create a copy of the content of this container as a long array.
|
String |
toString() |
void |
trim()
If possible, recover wasted memory.
|
protected void |
updateCardinality(int prevOnes,
int newOnes) |
protected void |
writeArray(DataOutput out)
Write just the underlying array.
|
void |
writeExternal(ObjectOutput out) |
MappeableContainer |
xor(MappeableArrayContainer value2)
Computes the bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
xor(MappeableBitmapContainer value2)
Computes the bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
xor(MappeableRunContainer value2)
Computes the bitwise XOR of this container with another (symmetric difference).
|
and, andCardinality, andNot, assertNonEmpty, contains, getContainerName, iand, iandNot, intersects, ior, ixor, lazyIOR, lazyOR, or, rangeOfOnes, xor, xorCardinalityfinalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected static final int MAX_CAPACITY
public static final boolean USE_BRANCHLESS
public MappeableBitmapContainer()
public MappeableBitmapContainer(BitmapContainer bc)
bc - the original containerpublic MappeableBitmapContainer(int firstOfRun,
int lastOfRun)
firstOfRun - first indexlastOfRun - last index (range is exclusive)public MappeableBitmapContainer(LongBuffer array, int initCardinality)
array - LongBuffer where the data is storedinitCardinality - cardinality (number of values stored)protected static int serializedSizeInBytes(int unusedCardinality)
public MappeableContainer add(int begin, int end)
MappeableContaineradd in class MappeableContainerbegin - start of range (inclusive)end - end of range (exclusive)public MappeableContainer add(short i)
MappeableContaineradd in class MappeableContaineri - short to be addedpublic MappeableArrayContainer and(MappeableArrayContainer value2)
MappeableContainerand in class MappeableContainervalue2 - other containerpublic MappeableContainer and(MappeableBitmapContainer value2)
MappeableContainerand in class MappeableContainervalue2 - other containerpublic MappeableContainer and(MappeableRunContainer value2)
MappeableContainerand in class MappeableContainervalue2 - other containerpublic MappeableContainer andNot(MappeableArrayContainer value2)
MappeableContainerandNot in class MappeableContainervalue2 - other containerpublic MappeableContainer andNot(MappeableBitmapContainer value2)
MappeableContainerandNot in class MappeableContainervalue2 - other containerpublic MappeableContainer andNot(MappeableRunContainer value2)
MappeableContainerandNot in class MappeableContainervalue2 - other containerpublic void clear()
MappeableContainerclear in class MappeableContainerpublic MappeableBitmapContainer clone()
clone in class MappeableContainerprotected void computeCardinality()
protected int cardinalityInRange(int start,
int end)
protected void updateCardinality(int prevOnes,
int newOnes)
public boolean contains(short i)
MappeableContainercontains in class MappeableContaineri - value to checkprotected long bitValue(short i)
public static boolean contains(ByteBuffer buf, int position, short i)
buf - underlying bufferposition - position of the container in the bufferi - indexprotected void fillArray(short[] array)
array - container (should be sufficiently large)public void fillLeastSignificant16bits(int[] x,
int i,
int mask)
MappeableContainerfillLeastSignificant16bits in class MappeableContainerx - provided arrayi - starting indexmask - indicates most significant bitspublic MappeableContainer flip(short i)
MappeableContainerflip in class MappeableContaineri - short to be addedprotected int getArraySizeInBytes()
MappeableContainergetArraySizeInBytes in class MappeableContainerpublic int getCardinality()
MappeableContainergetCardinality in class MappeableContainerpublic ShortIterator getReverseShortIterator()
MappeableContainergetReverseShortIterator in class MappeableContainerpublic PeekableShortIterator getShortIterator()
MappeableContainergetShortIterator in class MappeableContainerpublic int getSizeInBytes()
MappeableContainergetSizeInBytes in class MappeableContainerpublic MappeableContainer iadd(int begin, int end)
MappeableContaineriadd in class MappeableContainerbegin - start of range (inclusive)end - end of range (exclusive)public MappeableContainer iand(MappeableArrayContainer b2)
MappeableContaineriand in class MappeableContainerb2 - other containerpublic MappeableContainer iand(MappeableBitmapContainer b2)
MappeableContaineriand in class MappeableContainerb2 - other containerpublic MappeableContainer iand(MappeableRunContainer x)
MappeableContaineriand in class MappeableContainerx - other containerpublic MappeableContainer iandNot(MappeableArrayContainer b2)
MappeableContaineriandNot in class MappeableContainerb2 - other containerpublic MappeableContainer iandNot(MappeableBitmapContainer b2)
MappeableContaineriandNot in class MappeableContainerb2 - other containerpublic MappeableContainer iandNot(MappeableRunContainer x)
MappeableContaineriandNot in class MappeableContainerx - other containerprotected MappeableContainer ilazyor(MappeableArrayContainer value2)
protected MappeableContainer ilazyor(MappeableBitmapContainer x)
protected MappeableContainer ilazyor(MappeableRunContainer x)
public MappeableContainer inot(int firstOfRange, int lastOfRange)
MappeableContainerinot in class MappeableContainerfirstOfRange - beginning of range (inclusive); 0 is beginning of this container.lastOfRange - ending of range (exclusive)public boolean intersects(MappeableArrayContainer value2)
MappeableContainerintersects in class MappeableContainervalue2 - other containerpublic boolean intersects(MappeableBitmapContainer value2)
MappeableContainerintersects in class MappeableContainervalue2 - other containerpublic boolean intersects(MappeableRunContainer x)
MappeableContainerintersects in class MappeableContainerx - other containerpublic MappeableBitmapContainer ior(MappeableArrayContainer value2)
MappeableContainerior in class MappeableContainervalue2 - other containerpublic MappeableContainer ior(MappeableBitmapContainer b2)
MappeableContainerior in class MappeableContainerb2 - other containerprotected boolean isFull()
public MappeableContainer ior(MappeableRunContainer x)
MappeableContainerior in class MappeableContainerx - other containerpublic MappeableContainer iremove(int begin, int end)
MappeableContaineriremove in class MappeableContainerbegin - start of range (inclusive)end - end of range (exclusive)protected boolean isArrayBacked()
isArrayBacked in class MappeableContainerpublic MappeableContainer ixor(MappeableArrayContainer value2)
MappeableContainerixor in class MappeableContainervalue2 - other containerpublic MappeableContainer ixor(MappeableBitmapContainer b2)
MappeableContainerixor in class MappeableContainerb2 - other containerpublic MappeableContainer ixor(MappeableRunContainer x)
MappeableContainerixor in class MappeableContainerx - other containerprotected MappeableContainer lazyor(MappeableArrayContainer value2)
protected MappeableContainer lazyor(MappeableBitmapContainer x)
protected MappeableContainer lazyor(MappeableRunContainer x)
public MappeableContainer limit(int maxcardinality)
MappeableContainerlimit in class MappeableContainermaxcardinality - maximal cardinalityprotected void loadData(MappeableArrayContainer arrayContainer)
public int nextSetBit(int i)
i - starting indexpublic short nextUnsetBit(int i)
i - starting indexpublic MappeableContainer not(int firstOfRange, int lastOfRange)
MappeableContainernot in class MappeableContainerfirstOfRange - beginning of range (inclusive); 0 is beginning of this container.lastOfRange - ending of range (exclusive)public int numberOfRunsAdjustment()
public int numberOfRunsLowerBound(int mustNotExceed)
mustNotExceed - maximum of runs beyond which counting is pointlesspublic MappeableContainer or(MappeableArrayContainer value2)
MappeableContaineror in class MappeableContainervalue2 - other containerpublic MappeableContainer or(MappeableBitmapContainer value2)
MappeableContaineror in class MappeableContainervalue2 - other containerpublic MappeableContainer or(MappeableRunContainer value2)
MappeableContaineror in class MappeableContainervalue2 - other containerpublic int prevSetBit(int i)
i - starting indexpublic int rank(short lowbits)
MappeableContainerrank in class MappeableContainerlowbits - upper limitpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic MappeableContainer remove(int begin, int end)
MappeableContainerremove in class MappeableContainerbegin - start of range (inclusive)end - end of range (exclusive)public MappeableContainer remove(short i)
MappeableContainerremove in class MappeableContaineri - to be removedpublic MappeableContainer repairAfterLazy()
MappeableContainerrepairAfterLazy in class MappeableContainerpublic MappeableContainer runOptimize()
MappeableContainerrunOptimize in class MappeableContainerpublic short select(int j)
MappeableContainerselect in class MappeableContainerj - index of the valuepublic int serializedSizeInBytes()
MappeableContainerserializedSizeInBytes in class MappeableContainerpublic MappeableArrayContainer toArrayContainer()
public Container toContainer()
MappeableContainertoContainer in class MappeableContainerpublic long[] toLongArray()
public void trim()
MappeableContainertrim in class MappeableContainerprotected void writeArray(DataOutput out) throws IOException
MappeableContainerwriteArray in class MappeableContainerout - output streamIOException - in case of failurepublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic MappeableContainer xor(MappeableArrayContainer value2)
MappeableContainerxor in class MappeableContainervalue2 - other containerpublic MappeableContainer xor(MappeableBitmapContainer value2)
MappeableContainerxor in class MappeableContainervalue2 - other containerpublic MappeableContainer xor(MappeableRunContainer value2)
MappeableContainerxor in class MappeableContainervalue2 - other parameterpublic void forEach(short msb,
IntConsumer ic)
MappeableContainerforEach in class MappeableContainermsb - 16 most significant bitsic - consumerpublic int andCardinality(MappeableArrayContainer value2)
andCardinality in class MappeableContainerpublic int andCardinality(MappeableBitmapContainer value2)
andCardinality in class MappeableContainerpublic int andCardinality(MappeableRunContainer x)
andCardinality in class MappeableContainerpublic MappeableBitmapContainer toBitmapContainer()
MappeableContainertoBitmapContainer in class MappeableContainerpublic int first()
MappeableContainerfirst in class MappeableContainerpublic int last()
MappeableContainerlast in class MappeableContainerprotected boolean contains(MappeableBitmapContainer bitmapContainer)
contains in class MappeableContainerprotected boolean contains(MappeableRunContainer runContainer)
contains in class MappeableContainerprotected boolean contains(MappeableArrayContainer arrayContainer)
contains in class MappeableContainerCopyright © 2017. All rights reserved.