Package org.roaringbitmap
Class BitmapContainer
- java.lang.Object
-
- org.roaringbitmap.Container
-
- org.roaringbitmap.BitmapContainer
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,Iterable<Short>,WordStorage<Container>
public final class BitmapContainer extends Container implements Cloneable
Simple bitset-like container.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static intMAX_CAPACITYstatic booleanUSE_BRANCHLESSoptimization flag: whether the cardinality of the bitmaps is maintained through branchless operations-
Fields inherited from class org.roaringbitmap.Container
ContainerNames
-
-
Constructor Summary
Constructors Constructor Description BitmapContainer()Create a bitmap container with all bits set to falseBitmapContainer(int firstOfRun, int lastOfRun)Create a bitmap container with a run of ones from firstOfRun to lastOfRun.BitmapContainer(long[] newBitmap, int newCardinality)Create a new container, no copy is made.BitmapContainer(MappeableBitmapContainer bc)Creates a new non-mappeable container from a mappeable one.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Containeradd(int begin, int end)Return a new container with all shorts in [begin,end) added using an unsigned interpretation.Containeradd(short i)Add a short to the container.ArrayContainerand(ArrayContainer value2)Computes the bitwise AND of this container with another (intersection).Containerand(BitmapContainer value2)Computes the bitwise AND of this container with another (intersection).Containerand(RunContainer x)Computes the bitwise AND of this container with another (intersection).intandCardinality(ArrayContainer value2)intandCardinality(BitmapContainer value2)intandCardinality(RunContainer x)ContainerandNot(ArrayContainer value2)Computes the bitwise ANDNOT of this container with another (difference).ContainerandNot(BitmapContainer value2)Computes the bitwise ANDNOT of this container with another (difference).ContainerandNot(RunContainer x)Computes the bitwise ANDNOT of this container with another (difference).protected longbitValue(short i)protected intcardinalityInRange(int start, int end)voidclear()Empties the containerBitmapContainerclone()protected voidcomputeCardinality()Recomputes the cardinality of the bitmap.booleancontains(int minimum, int supremum)Checks whether the container contains the entire rangebooleancontains(short i)Checks whether the contain contains the provided valueprotected booleancontains(ArrayContainer arrayContainer)protected booleancontains(BitmapContainer bitmapContainer)protected booleancontains(RunContainer runContainer)voiddeserialize(DataInput in)Deserialize (recover) the container.booleanequals(Object o)protected voidfillArray(short[] array)Fill the array with set bitsvoidfillLeastSignificant16bits(int[] x, int i, int mask)Fill the least significant 16 bits of the integer array, starting at index i, with the short values from this container.intfirst()Get the first integer held in the containerContainerflip(short i)Add a short to the container if it is not present, otherwise remove it.voidforEach(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 intgetArraySizeInBytes()Size of the underlying arrayContainerBatchIteratorgetBatchIterator()Gets an iterator to visit the contents of the container in batchesintgetCardinality()Computes the distinct number of short values in the container.ShortIteratorgetReverseShortIterator()Iterator to visit the short values in the container in descending order.static ShortIteratorgetReverseShortIterator(long[] bitmap)Return a bitmap iterator over this arrayPeekableShortIteratorgetShortIterator()Iterator to visit the short values in the container in ascending order.static PeekableShortIteratorgetShortIterator(long[] bitmap)Return a bitmap iterator over this arrayPeekableShortRankIteratorgetShortRankIterator()Iterator to visit the short values in container and pre-compute ranksintgetSizeInBytes()Computes an estimate of the memory usage of this container.inthashCode()Containeriadd(int begin, int end)Add all shorts in [begin,end) using an unsigned interpretation.Containeriand(ArrayContainer b2)Computes the in-place bitwise AND of this container with another (intersection).Containeriand(BitmapContainer b2)Computes the in-place bitwise AND of this container with another (intersection).Containeriand(RunContainer x)Computes the in-place bitwise AND of this container with another (intersection).ContaineriandNot(ArrayContainer b2)Computes the in-place bitwise ANDNOT of this container with another (difference).ContaineriandNot(BitmapContainer b2)Computes the in-place bitwise ANDNOT of this container with another (difference).ContaineriandNot(RunContainer x)Computes the in-place bitwise ANDNOT of this container with another (difference).protected Containerilazyor(ArrayContainer value2)protected Containerilazyor(BitmapContainer x)protected Containerilazyor(RunContainer x)Containerinot(int firstOfRange, int lastOfRange)Computes the in-place bitwise NOT of this container (complement).booleanintersects(int minimum, int supremum)Checks if the container intersects with a rangebooleanintersects(ArrayContainer value2)Returns true if the current container intersects the other container.booleanintersects(BitmapContainer value2)Returns true if the current container intersects the other container.booleanintersects(RunContainer x)Returns true if the current container intersects the other container.BitmapContainerior(ArrayContainer value2)Computes the in-place bitwise OR of this container with another (union).Containerior(BitmapContainer b2)Computes the in-place bitwise OR of this container with another (union).Containerior(RunContainer x)Computes the in-place bitwise OR of this container with another (union).Containeriremove(int begin, int end)Remove shorts in [begin,end) using an unsigned interpretation.booleanisEmpty()Checks whether the container is empty or not.protected booleanisFull()Iterator<Short>iterator()Containerixor(ArrayContainer value2)Computes the in-place bitwise XOR of this container with another (symmetric difference).Containerixor(BitmapContainer b2)Computes the in-place bitwise XOR of this container with another (symmetric difference).Containerixor(RunContainer x)Computes the in-place bitwise XOR of this container with another (symmetric difference).intlast()Get the last integer held in the containerprotected Containerlazyor(ArrayContainer value2)protected Containerlazyor(BitmapContainer x)protected Containerlazyor(RunContainer x)Containerlimit(int maxcardinality)Create a new Container containing at most maxcardinality integers.protected voidloadData(ArrayContainer arrayContainer)intnextAbsentValue(short fromValue)Gets the first absent value greater than or equal to the lower bound.intnextClearBit(int i)Find the index of the next clear bit greater or equal to i.intnextSetBit(int i)Find the index of the next set bit greater or equal to i, returns -1 if none found.intnextValue(short fromValue)Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.Containernot(int firstOfRange, int lastOfRange)Computes the bitwise NOT of this container (complement).intnumberOfRunsAdjustment()Computes the number of runsintnumberOfRunsLowerBound(int mustNotExceed)Counts how many runs there is in the bitmap, up to a maximumContaineror(ArrayContainer value2)Computes the bitwise OR of this container with another (union).Containeror(BitmapContainer value2)Computes the bitwise OR of this container with another (union).Containeror(RunContainer x)Computes the bitwise OR of this container with another (union).intprevClearBit(int i)Find the index of the previous clear bit less than or equal to i.intpreviousAbsentValue(short fromValue)Gets the last value less than or equal to the upper bound.intpreviousValue(short fromValue)Gets the last value less than or equal to the upper bound, or -1 if no such value exists.intprevSetBit(int i)Find the index of the previous set bit less than or equal to i, returns -1 if none found.intrank(short lowbits)Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).voidreadExternal(ObjectInput in)Containerremove(int begin, int end)Return a new container with all shorts in [begin,end) remove using an unsigned interpretation.Containerremove(short i)Remove the short from this container.ContainerrepairAfterLazy()The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.ContainerrunOptimize()Convert to RunContainers, when the result is smaller.shortselect(int j)Return the jth valuevoidserialize(DataOutput out)Serialize the container.intserializedSizeInBytes()Report the number of bytes required to serialize this container.protected static intserializedSizeInBytes(int unusedCardinality)ArrayContainertoArrayContainer()Copies the data to an array containerBitmapContainertoBitmapContainer()Convert the current container to a BitmapContainer, if a conversion is needed.LongBuffertoLongBuffer()Return the content of this container as a LongBuffer.MappeableContainertoMappeableContainer()Convert to a mappeable container.StringtoString()voidtrim()If possible, recover wasted memory.protected voidupdateCardinality(int prevOnes, int newOnes)protected voidwriteArray(DataOutput out)Write just the underlying array.voidwriteExternal(ObjectOutput out)Containerxor(ArrayContainer value2)Computes the bitwise XOR of this container with another (symmetric difference).Containerxor(BitmapContainer value2)Computes the bitwise XOR of this container with another (symmetric difference).Containerxor(RunContainer x)Computes the bitwise XOR of this container with another (symmetric difference).-
Methods inherited from class org.roaringbitmap.Container
and, andCardinality, andNot, assertNonEmpty, contains, getContainerName, iand, iandNot, intersects, ior, ixor, lazyIOR, lazyOR, or, rangeOfOnes, xor, xorCardinality
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
MAX_CAPACITY
protected static final int MAX_CAPACITY
- See Also:
- Constant Field Values
-
USE_BRANCHLESS
public static final boolean USE_BRANCHLESS
optimization flag: whether the cardinality of the bitmaps is maintained through branchless operations- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BitmapContainer
public BitmapContainer()
Create a bitmap container with all bits set to false
-
BitmapContainer
public BitmapContainer(int firstOfRun, int lastOfRun)Create a bitmap container with a run of ones from firstOfRun to lastOfRun. Caller must ensure that the range isn't so small that an ArrayContainer should have been created instead- Parameters:
firstOfRun- first indexlastOfRun- last index (range is exclusive)
-
BitmapContainer
public BitmapContainer(long[] newBitmap, int newCardinality)Create a new container, no copy is made.- Parameters:
newBitmap- contentnewCardinality- desired cardinality.
-
BitmapContainer
public BitmapContainer(MappeableBitmapContainer bc)
Creates a new non-mappeable container from a mappeable one. This copies the data.- Parameters:
bc- the original container
-
-
Method Detail
-
getReverseShortIterator
public static ShortIterator getReverseShortIterator(long[] bitmap)
Return a bitmap iterator over this array- Parameters:
bitmap- array to be iterated over- Returns:
- an iterator
-
getShortIterator
public static PeekableShortIterator getShortIterator(long[] bitmap)
Return a bitmap iterator over this array- Parameters:
bitmap- array to be iterated over- Returns:
- an iterator
-
serializedSizeInBytes
protected static int serializedSizeInBytes(int unusedCardinality)
-
add
public Container add(int begin, int end)
Description copied from class:ContainerReturn a new container with all shorts in [begin,end) added using an unsigned interpretation.
-
add
public Container add(short i)
Description copied from class:ContainerAdd a short to the container. May generate a new container.- Specified by:
addin interfaceWordStorage<Container>- Specified by:
addin classContainer- Parameters:
i- short to be added- Returns:
- the new container
-
and
public ArrayContainer and(ArrayContainer value2)
Description copied from class:ContainerComputes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
-
and
public Container and(BitmapContainer value2)
Description copied from class:ContainerComputes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
-
and
public Container and(RunContainer x)
Description copied from class:ContainerComputes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
-
andCardinality
public int andCardinality(ArrayContainer value2)
- Specified by:
andCardinalityin classContainer
-
andCardinality
public int andCardinality(BitmapContainer value2)
- Specified by:
andCardinalityin classContainer
-
andCardinality
public int andCardinality(RunContainer x)
- Specified by:
andCardinalityin classContainer
-
andNot
public Container andNot(ArrayContainer value2)
Description copied from class:ContainerComputes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.
-
andNot
public Container andNot(BitmapContainer value2)
Description copied from class:ContainerComputes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.
-
andNot
public Container andNot(RunContainer x)
Description copied from class:ContainerComputes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.
-
clear
public void clear()
Description copied from class:ContainerEmpties the container
-
clone
public BitmapContainer clone()
-
isEmpty
public boolean isEmpty()
Description copied from class:ContainerChecks whether the container is empty or not.- Specified by:
isEmptyin interfaceWordStorage<Container>- Specified by:
isEmptyin classContainer- Returns:
- true if the container is empty.
-
computeCardinality
protected void computeCardinality()
Recomputes the cardinality of the bitmap.
-
cardinalityInRange
protected int cardinalityInRange(int start, int end)
-
updateCardinality
protected void updateCardinality(int prevOnes, int newOnes)
-
contains
public boolean contains(short i)
Description copied from class:ContainerChecks whether the contain contains the provided value
-
contains
public boolean contains(int minimum, int supremum)Description copied from class:ContainerChecks whether the container contains the entire range
-
contains
protected boolean contains(BitmapContainer bitmapContainer)
-
contains
protected boolean contains(RunContainer runContainer)
-
contains
protected boolean contains(ArrayContainer arrayContainer)
-
bitValue
protected long bitValue(short i)
-
deserialize
public void deserialize(DataInput in) throws IOException
Description copied from class:ContainerDeserialize (recover) the container.- Specified by:
deserializein classContainer- Parameters:
in- the DataInput stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
fillArray
protected void fillArray(short[] array)
Fill the array with set bits- Parameters:
array- container (should be sufficiently large)
-
fillLeastSignificant16bits
public void fillLeastSignificant16bits(int[] x, int i, int mask)Description copied from class:ContainerFill the least significant 16 bits of the integer array, starting at index i, with the short values from this container. The caller is responsible to allocate enough room. The most significant 16 bits of each integer are given by the most significant bits of the provided mask.- Specified by:
fillLeastSignificant16bitsin classContainer- Parameters:
x- provided arrayi- starting indexmask- indicates most significant bits
-
flip
public Container flip(short i)
Description copied from class:ContainerAdd a short to the container if it is not present, otherwise remove it. May generate a new container.
-
getArraySizeInBytes
protected int getArraySizeInBytes()
Description copied from class:ContainerSize of the underlying array- Specified by:
getArraySizeInBytesin classContainer- Returns:
- size in bytes
-
getCardinality
public int getCardinality()
Description copied from class:ContainerComputes the distinct number of short values in the container. Can be expected to run in constant time.- Specified by:
getCardinalityin classContainer- Returns:
- the cardinality
-
getReverseShortIterator
public ShortIterator getReverseShortIterator()
Description copied from class:ContainerIterator to visit the short values in the container in descending order.- Specified by:
getReverseShortIteratorin classContainer- Returns:
- iterator
-
getShortIterator
public PeekableShortIterator getShortIterator()
Description copied from class:ContainerIterator to visit the short values in the container in ascending order.- Specified by:
getShortIteratorin classContainer- Returns:
- iterator
-
getShortRankIterator
public PeekableShortRankIterator getShortRankIterator()
Description copied from class:ContainerIterator to visit the short values in container and pre-compute ranks- Specified by:
getShortRankIteratorin classContainer- Returns:
- iterator
-
getBatchIterator
public ContainerBatchIterator getBatchIterator()
Description copied from class:ContainerGets an iterator to visit the contents of the container in batches- Specified by:
getBatchIteratorin classContainer- Returns:
- iterator
-
getSizeInBytes
public int getSizeInBytes()
Description copied from class:ContainerComputes an estimate of the memory usage of this container. The estimate is not meant to be exact.- Specified by:
getSizeInBytesin classContainer- Returns:
- estimated memory usage in bytes
-
iadd
public Container iadd(int begin, int end)
Description copied from class:ContainerAdd all shorts in [begin,end) using an unsigned interpretation. May generate a new container.
-
iand
public Container iand(ArrayContainer b2)
Description copied from class:ContainerComputes the in-place bitwise AND of this container with another (intersection). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
iand
public Container iand(BitmapContainer b2)
Description copied from class:ContainerComputes the in-place bitwise AND of this container with another (intersection). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
iand
public Container iand(RunContainer x)
Description copied from class:ContainerComputes the in-place bitwise AND of this container with another (intersection). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
iandNot
public Container iandNot(ArrayContainer b2)
Description copied from class:ContainerComputes the in-place bitwise ANDNOT of this container with another (difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
iandNot
public Container iandNot(BitmapContainer b2)
Description copied from class:ContainerComputes the in-place bitwise ANDNOT of this container with another (difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
iandNot
public Container iandNot(RunContainer x)
Description copied from class:ContainerComputes the in-place bitwise ANDNOT of this container with another (difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
ilazyor
protected Container ilazyor(ArrayContainer value2)
-
ilazyor
protected Container ilazyor(BitmapContainer x)
-
ilazyor
protected Container ilazyor(RunContainer x)
-
inot
public Container inot(int firstOfRange, int lastOfRange)
Description copied from class:ContainerComputes the in-place bitwise NOT of this container (complement). Only those bits within the range are affected. The current container is generally modified. May generate a new container.
-
intersects
public boolean intersects(ArrayContainer value2)
Description copied from class:ContainerReturns true if the current container intersects the other container.- Specified by:
intersectsin classContainer- Parameters:
value2- other container- Returns:
- whether they intersect
-
intersects
public boolean intersects(BitmapContainer value2)
Description copied from class:ContainerReturns true if the current container intersects the other container.- Specified by:
intersectsin classContainer- Parameters:
value2- other container- Returns:
- whether they intersect
-
intersects
public boolean intersects(RunContainer x)
Description copied from class:ContainerReturns true if the current container intersects the other container.- Specified by:
intersectsin classContainer- Parameters:
x- other container- Returns:
- whether they intersect
-
intersects
public boolean intersects(int minimum, int supremum)Description copied from class:ContainerChecks if the container intersects with a range- Specified by:
intersectsin classContainer- Parameters:
minimum- the inclusive unsigned lower bound of the rangesupremum- the exclusive unsigned upper bound of the range- Returns:
- true if the container intersects the range
-
ior
public BitmapContainer ior(ArrayContainer value2)
Description copied from class:ContainerComputes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
ior
public Container ior(BitmapContainer b2)
Description copied from class:ContainerComputes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
ior
public Container ior(RunContainer x)
Description copied from class:ContainerComputes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
iremove
public Container iremove(int begin, int end)
Description copied from class:ContainerRemove shorts in [begin,end) using an unsigned interpretation. May generate a new container.
-
ixor
public Container ixor(ArrayContainer value2)
Description copied from class:ContainerComputes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
ixor
public Container ixor(BitmapContainer b2)
Description copied from class:ContainerComputes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
ixor
public Container ixor(RunContainer x)
Description copied from class:ContainerComputes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
-
lazyor
protected Container lazyor(ArrayContainer value2)
-
lazyor
protected Container lazyor(BitmapContainer x)
-
lazyor
protected Container lazyor(RunContainer x)
-
limit
public Container limit(int maxcardinality)
Description copied from class:ContainerCreate a new Container containing at most maxcardinality integers.
-
loadData
protected void loadData(ArrayContainer arrayContainer)
-
nextSetBit
public int nextSetBit(int i)
Find the index of the next set bit greater or equal to i, returns -1 if none found.- Parameters:
i- starting index- Returns:
- index of the next set bit
-
nextClearBit
public int nextClearBit(int i)
Find the index of the next clear bit greater or equal to i.- Parameters:
i- starting index- Returns:
- index of the next clear bit
-
not
public Container not(int firstOfRange, int lastOfRange)
Description copied from class:ContainerComputes the bitwise NOT of this container (complement). Only those bits within the range are affected. The current container is left unaffected.
-
numberOfRunsAdjustment
public int numberOfRunsAdjustment()
Computes the number of runs- Returns:
- the number of runs
-
numberOfRunsLowerBound
public int numberOfRunsLowerBound(int mustNotExceed)
Counts how many runs there is in the bitmap, up to a maximum- Parameters:
mustNotExceed- maximum of runs beyond which counting is pointless- Returns:
- estimated number of courses
-
or
public Container or(ArrayContainer value2)
Description copied from class:ContainerComputes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
-
isFull
protected boolean isFull()
-
or
public Container or(BitmapContainer value2)
Description copied from class:ContainerComputes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
-
or
public Container or(RunContainer x)
Description copied from class:ContainerComputes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
-
prevSetBit
public int prevSetBit(int i)
Find the index of the previous set bit less than or equal to i, returns -1 if none found.- Parameters:
i- starting index- Returns:
- index of the previous set bit
-
prevClearBit
public int prevClearBit(int i)
Find the index of the previous clear bit less than or equal to i.- Parameters:
i- starting index- Returns:
- index of the previous clear bit
-
rank
public int rank(short lowbits)
Description copied from class:ContainerRank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
remove
public Container remove(int begin, int end)
Description copied from class:ContainerReturn a new container with all shorts in [begin,end) remove using an unsigned interpretation.
-
remove
public Container remove(short i)
Description copied from class:ContainerRemove the short from this container. May create a new container.
-
repairAfterLazy
public Container repairAfterLazy()
Description copied from class:ContainerThe output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.- Specified by:
repairAfterLazyin classContainer- Returns:
- a new valid container
-
runOptimize
public Container runOptimize()
Description copied from class:ContainerConvert to RunContainers, when the result is smaller. Overridden by RunContainer to possibility switch from RunContainer to a smaller alternative. Overridden by BitmapContainer with a more efficient approach.- Specified by:
runOptimizein interfaceWordStorage<Container>- Specified by:
runOptimizein classContainer- Returns:
- the new container
-
select
public short select(int j)
Description copied from class:ContainerReturn the jth value
-
serialize
public void serialize(DataOutput out) throws IOException
Description copied from class:ContainerSerialize the container.- Specified by:
serializein classContainer- Parameters:
out- the DataOutput stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
serializedSizeInBytes
public int serializedSizeInBytes()
Description copied from class:ContainerReport the number of bytes required to serialize this container.- Specified by:
serializedSizeInBytesin classContainer- Returns:
- the size in bytes
-
toArrayContainer
public ArrayContainer toArrayContainer()
Copies the data to an array container- Returns:
- the array container
-
toLongBuffer
public LongBuffer toLongBuffer()
Return the content of this container as a LongBuffer. This creates a copy and might be relatively slow.- Returns:
- the LongBuffer
-
toMappeableContainer
public MappeableContainer toMappeableContainer()
Description copied from class:ContainerConvert to a mappeable container.- Specified by:
toMappeableContainerin classContainer- Returns:
- the mappeable container
-
trim
public void trim()
Description copied from class:ContainerIf possible, recover wasted memory.
-
writeArray
protected void writeArray(DataOutput out) throws IOException
Description copied from class:ContainerWrite just the underlying array.- Specified by:
writeArrayin classContainer- Parameters:
out- output stream- Throws:
IOException- in case of failure
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
xor
public Container xor(ArrayContainer value2)
Description copied from class:ContainerComputes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
-
xor
public Container xor(BitmapContainer value2)
Description copied from class:ContainerComputes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
-
xor
public Container xor(RunContainer x)
Description copied from class:ContainerComputes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
-
forEach
public void forEach(short msb, IntConsumer ic)Description copied from class:ContainerIterate through the values of this container and pass them along to the IntConsumer, using msb as the 16 most significant bits.
-
toBitmapContainer
public BitmapContainer toBitmapContainer()
Description copied from class:ContainerConvert the current container to a BitmapContainer, if a conversion is needed. If the container is already a bitmap, the container is returned unchanged.- Specified by:
toBitmapContainerin classContainer- Returns:
- a bitmap container
-
nextValue
public int nextValue(short fromValue)
Description copied from class:ContainerGets the first value greater than or equal to the lower bound, or -1 if no such value exists.
-
previousValue
public int previousValue(short fromValue)
Description copied from class:ContainerGets the last value less than or equal to the upper bound, or -1 if no such value exists.- Specified by:
previousValuein classContainer- Parameters:
fromValue- the upper bound (inclusive)- Returns:
- the previous value
-
nextAbsentValue
public int nextAbsentValue(short fromValue)
Description copied from class:ContainerGets the first absent value greater than or equal to the lower bound.- Specified by:
nextAbsentValuein classContainer- Parameters:
fromValue- the lower bound (inclusive)- Returns:
- the next absent value
-
previousAbsentValue
public int previousAbsentValue(short fromValue)
Description copied from class:ContainerGets the last value less than or equal to the upper bound.- Specified by:
previousAbsentValuein classContainer- Parameters:
fromValue- the upper bound (inclusive)- Returns:
- the previous absent value
-
first
public int first()
Description copied from class:ContainerGet the first integer held in the container
-
-