public final class MappeableArrayContainer extends MappeableContainer implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected int |
cardinality |
protected ShortBuffer |
content |
protected static int |
DEFAULT_MAX_SIZE |
ContainerNames| Constructor and Description |
|---|
MappeableArrayContainer()
Create an array container with default capacity
|
MappeableArrayContainer(ArrayContainer bc)
Creates a new container from a non-mappeable one.
|
MappeableArrayContainer(int capacity)
Create an array container with specified capacity
|
MappeableArrayContainer(int firstOfRun,
int lastOfRun)
Create an array container with a run of ones from firstOfRun to lastOfRun, exclusive.
|
MappeableArrayContainer(ShortBuffer array,
int cardinality)
Construct a new ArrayContainer backed by the provided ShortBuffer.
|
| 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 x)
running time is in O(n) time if insert is not in order.
|
MappeableArrayContainer |
and(MappeableArrayContainer value2)
Computes the bitwise AND of this container with another (intersection).
|
MappeableContainer |
and(MappeableBitmapContainer x)
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 x) |
int |
andCardinality(MappeableRunContainer x) |
MappeableArrayContainer |
andNot(MappeableArrayContainer value2)
Computes the bitwise ANDNOT of this container with another (difference).
|
MappeableArrayContainer |
andNot(MappeableBitmapContainer value2)
Computes the bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
andNot(MappeableRunContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
void |
clear()
Empties the container
|
MappeableArrayContainer |
clone() |
static boolean |
contains(ByteBuffer buf,
int position,
short x,
int cardinality)
Checks whether the container contains the value x.
|
protected boolean |
contains(MappeableArrayContainer arrayContainer) |
protected boolean |
contains(MappeableBitmapContainer bitmapContainer) |
protected boolean |
contains(MappeableRunContainer runContainer) |
boolean |
contains(short x)
Checks whether the contain contains the provided value
|
boolean |
equals(Object o) |
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 x)
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
|
protected static int |
getArraySizeInBytes(int cardinality) |
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.
|
MappeableArrayContainer |
iand(MappeableArrayContainer value2)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iand(MappeableBitmapContainer value2)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iand(MappeableRunContainer value2)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableArrayContainer |
iandNot(MappeableArrayContainer value2)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
MappeableArrayContainer |
iandNot(MappeableBitmapContainer value2)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
iandNot(MappeableRunContainer value2)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
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 x)
Returns true if the current container intersects the other container.
|
boolean |
intersects(MappeableRunContainer x)
Returns true if the current container intersects the other container.
|
MappeableContainer |
ior(MappeableArrayContainer value2)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
ior(MappeableBitmapContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
ior(MappeableRunContainer value2)
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() |
Iterator<Short> |
iterator() |
MappeableContainer |
ixor(MappeableArrayContainer value2)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
ixor(MappeableBitmapContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
ixor(MappeableRunContainer value2)
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) |
MappeableContainer |
limit(int maxcardinality)
Create a new MappeableContainer containing at most maxcardinality integers.
|
protected void |
loadData(MappeableBitmapContainer bitmapContainer) |
MappeableContainer |
not(int firstOfRange,
int lastOfRange)
Computes the bitwise NOT of this container (complement).
|
MappeableContainer |
or(MappeableArrayContainer value2)
Computes the bitwise OR of this container with another (union).
|
MappeableContainer |
or(MappeableBitmapContainer x)
Computes the bitwise OR of this container with another (union).
|
MappeableContainer |
or(MappeableRunContainer value2)
Computes the bitwise OR of this container with another (union).
|
protected MappeableContainer |
or(ShortIterator it) |
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 x)
Remove the short from this container.
|
protected void |
removeAtIndex(int loc) |
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 cardinality) |
MappeableBitmapContainer |
toBitmapContainer()
Copies the data in a bitmap container.
|
Container |
toContainer()
Convert to a non-mappeable container.
|
short[] |
toShortArray()
Create a copy of the content of this container as a short array.
|
String |
toString() |
void |
trim()
If possible, recover wasted memory.
|
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 x)
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).
|
protected MappeableContainer |
xor(ShortIterator it) |
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 DEFAULT_MAX_SIZE
protected int cardinality
protected ShortBuffer content
public MappeableArrayContainer()
public MappeableArrayContainer(ArrayContainer bc)
bc - the original containerpublic MappeableArrayContainer(int capacity)
capacity - The capacity of the containerpublic MappeableArrayContainer(int firstOfRun,
int lastOfRun)
firstOfRun - first indexlastOfRun - last index (range is exclusive)public MappeableArrayContainer(ShortBuffer array, int cardinality)
array - ShortBuffer where the data is storedcardinality - cardinality (number of values stored)protected static int getArraySizeInBytes(int cardinality)
protected static int serializedSizeInBytes(int cardinality)
public MappeableContainer add(int begin, int end)
MappeableContaineradd in class MappeableContainerbegin - start of range (inclusive)end - end of range (exclusive)public MappeableContainer add(short x)
add in class MappeableContainerx - short to be addedpublic MappeableArrayContainer and(MappeableArrayContainer value2)
MappeableContainerand in class MappeableContainervalue2 - other containerpublic MappeableContainer and(MappeableBitmapContainer x)
MappeableContainerand in class MappeableContainerx - other containerpublic MappeableContainer and(MappeableRunContainer value2)
MappeableContainerand in class MappeableContainervalue2 - other containerpublic MappeableArrayContainer andNot(MappeableArrayContainer value2)
MappeableContainerandNot in class MappeableContainervalue2 - other containerpublic MappeableArrayContainer andNot(MappeableBitmapContainer value2)
MappeableContainerandNot in class MappeableContainervalue2 - other containerpublic MappeableContainer andNot(MappeableRunContainer x)
MappeableContainerandNot in class MappeableContainerx - other containerpublic void clear()
MappeableContainerclear in class MappeableContainerpublic MappeableArrayContainer clone()
clone in class MappeableContainerpublic boolean contains(short x)
MappeableContainercontains in class MappeableContainerx - value to checkpublic static boolean contains(ByteBuffer buf, int position, short x, int cardinality)
buf - underlying bufferposition - starting position of the container in the ByteBufferx - target value xcardinality - container cardinalitypublic void fillLeastSignificant16bits(int[] x,
int i,
int mask)
MappeableContainerfillLeastSignificant16bits in class MappeableContainerx - provided arrayi - starting indexmask - indicates most significant bitspublic MappeableContainer flip(short x)
MappeableContainerflip in class MappeableContainerx - 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 MappeableArrayContainer iand(MappeableArrayContainer value2)
MappeableContaineriand in class MappeableContainervalue2 - other containerpublic MappeableContainer iand(MappeableBitmapContainer value2)
MappeableContaineriand in class MappeableContainervalue2 - other containerpublic MappeableContainer iand(MappeableRunContainer value2)
MappeableContaineriand in class MappeableContainervalue2 - other containerpublic MappeableArrayContainer iandNot(MappeableArrayContainer value2)
MappeableContaineriandNot in class MappeableContainervalue2 - other containerpublic MappeableArrayContainer iandNot(MappeableBitmapContainer value2)
MappeableContaineriandNot in class MappeableContainervalue2 - other containerpublic MappeableContainer iandNot(MappeableRunContainer value2)
MappeableContaineriandNot in class MappeableContainervalue2 - other containerpublic 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 x)
MappeableContainerintersects in class MappeableContainerx - other containerpublic boolean intersects(MappeableRunContainer x)
MappeableContainerintersects in class MappeableContainerx - other containerpublic MappeableContainer ior(MappeableArrayContainer value2)
MappeableContainerior in class MappeableContainervalue2 - other containerpublic MappeableContainer ior(MappeableBitmapContainer x)
MappeableContainerior in class MappeableContainerx - other containerpublic MappeableContainer ior(MappeableRunContainer value2)
MappeableContainerior in class MappeableContainervalue2 - 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 x)
MappeableContainerixor in class MappeableContainerx - other containerpublic MappeableContainer ixor(MappeableRunContainer value2)
MappeableContainerixor in class MappeableContainervalue2 - other containerpublic MappeableContainer limit(int maxcardinality)
MappeableContainerlimit in class MappeableContainermaxcardinality - maximal cardinalityprotected void loadData(MappeableBitmapContainer bitmapContainer)
public 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 MappeableContainer or(MappeableArrayContainer value2)
MappeableContaineror in class MappeableContainervalue2 - other containerprotected MappeableContainer lazyor(MappeableArrayContainer value2)
public MappeableContainer or(MappeableBitmapContainer x)
MappeableContaineror in class MappeableContainerx - other containerpublic MappeableContainer or(MappeableRunContainer value2)
MappeableContaineror in class MappeableContainervalue2 - other containerprotected MappeableContainer or(ShortIterator it)
public 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)protected void removeAtIndex(int loc)
public MappeableContainer remove(short x)
MappeableContainerremove in class MappeableContainerx - 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 MappeableBitmapContainer toBitmapContainer()
toBitmapContainer in class MappeableContainerpublic int first()
MappeableContainerfirst in class MappeableContainerpublic int last()
MappeableContainerlast in class MappeableContainerpublic Container toContainer()
MappeableContainertoContainer in class MappeableContainerpublic short[] toShortArray()
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 x)
MappeableContainerxor in class MappeableContainerx - other containerpublic MappeableContainer xor(MappeableRunContainer value2)
MappeableContainerxor in class MappeableContainervalue2 - other parameterprotected MappeableContainer xor(ShortIterator it)
public 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 x)
andCardinality in class MappeableContainerpublic int andCardinality(MappeableRunContainer x)
andCardinality in class MappeableContainerprotected boolean contains(MappeableRunContainer runContainer)
contains in class MappeableContainerprotected boolean contains(MappeableArrayContainer arrayContainer)
contains in class MappeableContainerprotected boolean contains(MappeableBitmapContainer bitmapContainer)
contains in class MappeableContainerCopyright © 2017. All rights reserved.