Package org.roaringbitmap.buffer
Class MappeableArrayContainer
- java.lang.Object
-
- org.roaringbitmap.buffer.MappeableContainer
-
- org.roaringbitmap.buffer.MappeableArrayContainer
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<java.lang.Character>,WordStorage<MappeableContainer>
public final class MappeableArrayContainer extends MappeableContainer implements java.lang.Cloneable
Simple container made of an array of 16-bit integers. Unlike org.roaringbitmap.ArrayContainer, this class uses a CharBuffer to store data.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intcardinalityprotected java.nio.CharBuffercontentprotected static intDEFAULT_MAX_SIZE-
Fields inherited from class org.roaringbitmap.buffer.MappeableContainer
ContainerNames
-
-
Constructor Summary
Constructors Constructor Description MappeableArrayContainer()Create an array container with default capacityMappeableArrayContainer(int capacity)Create an array container with specified capacityMappeableArrayContainer(int firstOfRun, int lastOfRun)Create an array container with a run of ones from firstOfRun to lastOfRun, exclusive.MappeableArrayContainer(java.nio.CharBuffer array, int cardinality)Construct a new ArrayContainer backed by the provided CharBuffer.MappeableArrayContainer(ArrayContainer bc)Creates a new container from a non-mappeable one.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MappeableContaineradd(char x)running time is in O(n) time if insert is not in order.MappeableContaineradd(int begin, int end)Return a new container with all chars in [begin,end) added using an unsigned interpretation.MappeableArrayContainerand(MappeableArrayContainer value2)Computes the bitwise AND of this container with another (intersection).MappeableContainerand(MappeableBitmapContainer x)Computes the bitwise AND of this container with another (intersection).MappeableContainerand(MappeableRunContainer value2)Computes the bitwise AND of this container with another (intersection).intandCardinality(MappeableArrayContainer value2)intandCardinality(MappeableBitmapContainer x)intandCardinality(MappeableRunContainer x)MappeableArrayContainerandNot(MappeableArrayContainer value2)Computes the bitwise ANDNOT of this container with another (difference).MappeableArrayContainerandNot(MappeableBitmapContainer value2)Computes the bitwise ANDNOT of this container with another (difference).MappeableContainerandNot(MappeableRunContainer x)Computes the bitwise ANDNOT of this container with another (difference).voidclear()Empties the containerMappeableArrayContainerclone()booleancontains(char x)Checks whether the contain contains the provided valuebooleancontains(int minimum, int supremum)Checks whether the container contains the entire rangestatic booleancontains(java.nio.ByteBuffer buf, int position, char x, int cardinality)Checks whether the container contains the value x.protected booleancontains(MappeableArrayContainer arrayContainer)protected booleancontains(MappeableBitmapContainer bitmapContainer)protected booleancontains(MappeableRunContainer runContainer)static MappeableArrayContainerempty()booleanequals(java.lang.Object o)voidfillLeastSignificant16bits(int[] x, int i, int mask)Fill the least significant 16 bits of the integer array, starting at index index, with the char values from this container.intfirst()Get the first integer held in the containerMappeableContainerflip(char x)Add a char to the container if it is not present, otherwise remove it.voidforEach(char 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 arrayprotected static intgetArraySizeInBytes(int cardinality)ContainerBatchIteratorgetBatchIterator()Gets an iterator to visit the contents of the container in batchesintgetCardinality()Computes the distinct number of char values in the container.PeekableCharIteratorgetCharIterator()Iterator to visit the char values in the container in ascending order.CharIteratorgetReverseCharIterator()Iterator to visit the char values in the container in descending order.intgetSizeInBytes()Computes an estimate of the memory usage of this container.inthashCode()MappeableContaineriadd(int begin, int end)Add all chars in [begin,end) using an unsigned interpretation.MappeableArrayContaineriand(MappeableArrayContainer value2)Computes the in-place bitwise AND of this container with another (intersection).MappeableContaineriand(MappeableBitmapContainer value2)Computes the in-place bitwise AND of this container with another (intersection).MappeableContaineriand(MappeableRunContainer value2)Computes the in-place bitwise AND of this container with another (intersection).MappeableArrayContaineriandNot(MappeableArrayContainer value2)Computes the in-place bitwise ANDNOT of this container with another (difference).MappeableArrayContaineriandNot(MappeableBitmapContainer value2)Computes the in-place bitwise ANDNOT of this container with another (difference).MappeableContaineriandNot(MappeableRunContainer value2)Computes the in-place bitwise ANDNOT of this container with another (difference).MappeableContainerinot(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(MappeableArrayContainer value2)Returns true if the current container intersects the other container.booleanintersects(MappeableBitmapContainer x)Returns true if the current container intersects the other container.booleanintersects(MappeableRunContainer x)Returns true if the current container intersects the other container.MappeableContainerior(MappeableArrayContainer value2)Computes the in-place bitwise OR of this container with another (union).MappeableContainerior(MappeableBitmapContainer x)Computes the in-place bitwise OR of this container with another (union).MappeableContainerior(MappeableRunContainer value2)Computes the in-place bitwise OR of this container with another (union).MappeableContaineriremove(int begin, int end)Remove chars in [begin,end) using an unsigned interpretation.protected booleanisArrayBacked()booleanisEmpty()Checks whether the container is empty or not.booleanisFull()Checks whether the container is full or not.java.util.Iterator<java.lang.Character>iterator()MappeableContainerixor(MappeableArrayContainer value2)Computes the in-place bitwise XOR of this container with another (symmetric difference).MappeableContainerixor(MappeableBitmapContainer x)Computes the in-place bitwise XOR of this container with another (symmetric difference).MappeableContainerixor(MappeableRunContainer value2)Computes the in-place bitwise XOR of this container with another (symmetric difference).intlast()Get the last integer held in the containerprotected MappeableContainerlazyor(MappeableArrayContainer value2)MappeableContainerlimit(int maxcardinality)Create a new MappeableContainer containing at most maxcardinality integers.intnextAbsentValue(char fromValue)Gets the first absent value greater than or equal to the lower bound.intnextValue(char fromValue)Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.MappeableContainernot(int firstOfRange, int lastOfRange)Computes the bitwise NOT of this container (complement).MappeableContaineror(MappeableArrayContainer value2)Computes the bitwise OR of this container with another (union).MappeableContaineror(MappeableBitmapContainer x)Computes the bitwise OR of this container with another (union).MappeableContaineror(MappeableRunContainer value2)Computes the bitwise OR of this container with another (union).protected MappeableContaineror(CharIterator it)intpreviousAbsentValue(char fromValue)Gets the last value less than or equal to the upper bound.intpreviousValue(char fromValue)Gets the last value less than or equal to the upper bound, or -1 if no such value exists.intrank(char lowbits)Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).voidreadExternal(java.io.ObjectInput in)MappeableContainerremove(char x)Remove the char from this container.MappeableContainerremove(int begin, int end)Return a new container with all chars in [begin,end) remove using an unsigned interpretation.MappeableContainerrepairAfterLazy()The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.MappeableContainerrunOptimize()Convert to MappeableRunContainers, when the result is smaller.charselect(int j)Return the jth valueintserializedSizeInBytes()Report the number of bytes required to serialize this container.protected static intserializedSizeInBytes(int cardinality)MappeableBitmapContainertoBitmapContainer()Copies the data in a bitmap container.ContainertoContainer()Convert to a non-mappeable container.char[]toShortArray()Create a copy of the content of this container as a char array.java.lang.StringtoString()voidtrim()If possible, recover wasted memory.protected voidwriteArray(java.io.DataOutput out)Write just the underlying array.protected voidwriteArray(java.nio.ByteBuffer buffer)Write just the underlying array.voidwriteExternal(java.io.ObjectOutput out)MappeableContainerxor(MappeableArrayContainer value2)Computes the bitwise XOR of this container with another (symmetric difference).MappeableContainerxor(MappeableBitmapContainer x)Computes the bitwise XOR of this container with another (symmetric difference).MappeableContainerxor(MappeableRunContainer value2)Computes the bitwise XOR of this container with another (symmetric difference).protected MappeableContainerxor(CharIterator it)-
Methods inherited from class org.roaringbitmap.buffer.MappeableContainer
and, andCardinality, andNot, assertNonEmpty, contains, getContainerName, iand, iandNot, intersects, ior, iorNot, ixor, lazyIOR, lazyOR, or, orNot, rangeOfOnes, xor, xorCardinality
-
-
-
-
Field Detail
-
DEFAULT_MAX_SIZE
protected static final int DEFAULT_MAX_SIZE
- See Also:
- Constant Field Values
-
cardinality
protected int cardinality
-
content
protected java.nio.CharBuffer content
-
-
Constructor Detail
-
MappeableArrayContainer
public MappeableArrayContainer()
Create an array container with default capacity
-
MappeableArrayContainer
public MappeableArrayContainer(ArrayContainer bc)
Creates a new container from a non-mappeable one. This copies the data.- Parameters:
bc- the original container
-
MappeableArrayContainer
public MappeableArrayContainer(int capacity)
Create an array container with specified capacity- Parameters:
capacity- The capacity of the container
-
MappeableArrayContainer
public MappeableArrayContainer(int firstOfRun, int lastOfRun)Create an array container with a run of ones from firstOfRun to lastOfRun, exclusive. Caller is responsible for making sure the range is small enough that ArrayContainer is appropriate.- Parameters:
firstOfRun- first indexlastOfRun- last index (range is exclusive)
-
MappeableArrayContainer
public MappeableArrayContainer(java.nio.CharBuffer array, int cardinality)Construct a new ArrayContainer backed by the provided CharBuffer. Note that if you modify the ArrayContainer a new CharBuffer may be produced.- Parameters:
array- CharBuffer where the data is storedcardinality- cardinality (number of values stored)
-
-
Method Detail
-
getArraySizeInBytes
protected static int getArraySizeInBytes(int cardinality)
-
serializedSizeInBytes
protected static int serializedSizeInBytes(int cardinality)
-
empty
public static MappeableArrayContainer empty()
-
add
public MappeableContainer add(int begin, int end)
Description copied from class:MappeableContainerReturn a new container with all chars in [begin,end) added using an unsigned interpretation.- Specified by:
addin classMappeableContainer- Parameters:
begin- start of range (inclusive)end- end of range (exclusive)- Returns:
- the new container
-
add
public MappeableContainer add(char x)
running time is in O(n) time if insert is not in order.- Specified by:
addin interfaceWordStorage<MappeableContainer>- Specified by:
addin classMappeableContainer- Parameters:
x- char to be added- Returns:
- the new container
-
isEmpty
public boolean isEmpty()
Description copied from class:MappeableContainerChecks whether the container is empty or not.- Specified by:
isEmptyin interfaceWordStorage<MappeableContainer>- Specified by:
isEmptyin classMappeableContainer- Returns:
- true if the container is empty.
-
isFull
public boolean isFull()
Description copied from class:MappeableContainerChecks whether the container is full or not.- Specified by:
isFullin classMappeableContainer- Returns:
- true if the container is full.
-
and
public MappeableArrayContainer and(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.- Specified by:
andin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
and
public MappeableContainer and(MappeableBitmapContainer x)
Description copied from class:MappeableContainerComputes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.- Specified by:
andin classMappeableContainer- Parameters:
x- other container- Returns:
- aggregated container
-
and
public MappeableContainer and(MappeableRunContainer value2)
Description copied from class:MappeableContainerComputes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.- Specified by:
andin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
andNot
public MappeableArrayContainer andNot(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.- Specified by:
andNotin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
andNot
public MappeableArrayContainer andNot(MappeableBitmapContainer value2)
Description copied from class:MappeableContainerComputes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.- Specified by:
andNotin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
andNot
public MappeableContainer andNot(MappeableRunContainer x)
Description copied from class:MappeableContainerComputes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.- Specified by:
andNotin classMappeableContainer- Parameters:
x- other container- Returns:
- aggregated container
-
clear
public void clear()
Description copied from class:MappeableContainerEmpties the container- Specified by:
clearin classMappeableContainer
-
clone
public MappeableArrayContainer clone()
- Specified by:
clonein classMappeableContainer
-
contains
public boolean contains(char x)
Description copied from class:MappeableContainerChecks whether the contain contains the provided value- Specified by:
containsin classMappeableContainer- Parameters:
x- value to check- Returns:
- whether the value is in the container
-
contains
public static boolean contains(java.nio.ByteBuffer buf, int position, char x, int cardinality)Checks whether the container contains the value x.- Parameters:
buf- underlying bufferposition- starting position of the container in the ByteBufferx- target value xcardinality- container cardinality- Returns:
- whether the container contains the value x
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
fillLeastSignificant16bits
public void fillLeastSignificant16bits(int[] x, int i, int mask)Description copied from class:MappeableContainerFill the least significant 16 bits of the integer array, starting at index index, with the char 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 classMappeableContainer- Parameters:
x- provided arrayi- starting indexmask- indicates most significant bits
-
flip
public MappeableContainer flip(char x)
Description copied from class:MappeableContainerAdd a char to the container if it is not present, otherwise remove it. May generate a new container.- Specified by:
flipin classMappeableContainer- Parameters:
x- char to be added- Returns:
- the new container
-
getArraySizeInBytes
protected int getArraySizeInBytes()
Description copied from class:MappeableContainerSize of the underlying array- Specified by:
getArraySizeInBytesin classMappeableContainer- Returns:
- size in bytes
-
getCardinality
public int getCardinality()
Description copied from class:MappeableContainerComputes the distinct number of char values in the container. Can be expected to run in constant time.- Specified by:
getCardinalityin classMappeableContainer- Returns:
- the cardinality
-
getReverseCharIterator
public CharIterator getReverseCharIterator()
Description copied from class:MappeableContainerIterator to visit the char values in the container in descending order.- Specified by:
getReverseCharIteratorin classMappeableContainer- Returns:
- iterator
-
getCharIterator
public PeekableCharIterator getCharIterator()
Description copied from class:MappeableContainerIterator to visit the char values in the container in ascending order.- Specified by:
getCharIteratorin classMappeableContainer- Returns:
- iterator
-
getBatchIterator
public ContainerBatchIterator getBatchIterator()
Description copied from class:MappeableContainerGets an iterator to visit the contents of the container in batches- Specified by:
getBatchIteratorin classMappeableContainer- Returns:
- iterator
-
getSizeInBytes
public int getSizeInBytes()
Description copied from class:MappeableContainerComputes an estimate of the memory usage of this container. The estimate is not meant to be exact.- Specified by:
getSizeInBytesin classMappeableContainer- Returns:
- estimated memory usage in bytes
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
iadd
public MappeableContainer iadd(int begin, int end)
Description copied from class:MappeableContainerAdd all chars in [begin,end) using an unsigned interpretation. May generate a new container.- Specified by:
iaddin classMappeableContainer- Parameters:
begin- start of range (inclusive)end- end of range (exclusive)- Returns:
- the new container
-
iand
public MappeableArrayContainer iand(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iandin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
iand
public MappeableContainer iand(MappeableBitmapContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iandin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
iand
public MappeableContainer iand(MappeableRunContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iandin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
iandNot
public MappeableArrayContainer iandNot(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iandNotin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
iandNot
public MappeableArrayContainer iandNot(MappeableBitmapContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iandNotin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
iandNot
public MappeableContainer iandNot(MappeableRunContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iandNotin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
inot
public MappeableContainer inot(int firstOfRange, int lastOfRange)
Description copied from class:MappeableContainerComputes 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.- Specified by:
inotin classMappeableContainer- Parameters:
firstOfRange- beginning of range (inclusive); 0 is beginning of this container.lastOfRange- ending of range (exclusive)- Returns:
- (partially) completmented container
-
intersects
public boolean intersects(MappeableArrayContainer value2)
Description copied from class:MappeableContainerReturns true if the current container intersects the other container.- Specified by:
intersectsin classMappeableContainer- Parameters:
value2- other container- Returns:
- whether they intersect
-
intersects
public boolean intersects(MappeableBitmapContainer x)
Description copied from class:MappeableContainerReturns true if the current container intersects the other container.- Specified by:
intersectsin classMappeableContainer- Parameters:
x- other container- Returns:
- whether they intersect
-
intersects
public boolean intersects(MappeableRunContainer x)
Description copied from class:MappeableContainerReturns true if the current container intersects the other container.- Specified by:
intersectsin classMappeableContainer- Parameters:
x- other container- Returns:
- whether they intersect
-
ior
public MappeableContainer ior(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iorin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
ior
public MappeableContainer ior(MappeableBitmapContainer x)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iorin classMappeableContainer- Parameters:
x- other container- Returns:
- aggregated container
-
ior
public MappeableContainer ior(MappeableRunContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
iorin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
iremove
public MappeableContainer iremove(int begin, int end)
Description copied from class:MappeableContainerRemove chars in [begin,end) using an unsigned interpretation. May generate a new container.- Specified by:
iremovein classMappeableContainer- Parameters:
begin- start of range (inclusive)end- end of range (exclusive)- Returns:
- the new container
-
isArrayBacked
protected boolean isArrayBacked()
- Specified by:
isArrayBackedin classMappeableContainer
-
iterator
public java.util.Iterator<java.lang.Character> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Character>
-
ixor
public MappeableContainer ixor(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
ixorin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
ixor
public MappeableContainer ixor(MappeableBitmapContainer x)
Description copied from class:MappeableContainerComputes 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.- Specified by:
ixorin classMappeableContainer- Parameters:
x- other container- Returns:
- aggregated container
-
ixor
public MappeableContainer ixor(MappeableRunContainer value2)
Description copied from class:MappeableContainerComputes 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.- Specified by:
ixorin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
limit
public MappeableContainer limit(int maxcardinality)
Description copied from class:MappeableContainerCreate a new MappeableContainer containing at most maxcardinality integers.- Specified by:
limitin classMappeableContainer- Parameters:
maxcardinality- maximal cardinality- Returns:
- a new bitmap with cardinality no more than maxcardinality
-
not
public MappeableContainer not(int firstOfRange, int lastOfRange)
Description copied from class:MappeableContainerComputes the bitwise NOT of this container (complement). Only those bits within the range are affected. The current container is left unaffected.- Specified by:
notin classMappeableContainer- Parameters:
firstOfRange- beginning of range (inclusive); 0 is beginning of this container.lastOfRange- ending of range (exclusive)- Returns:
- (partially) completmented container
-
or
public MappeableContainer or(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.- Specified by:
orin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
lazyor
protected MappeableContainer lazyor(MappeableArrayContainer value2)
-
or
public MappeableContainer or(MappeableBitmapContainer x)
Description copied from class:MappeableContainerComputes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.- Specified by:
orin classMappeableContainer- Parameters:
x- other container- Returns:
- aggregated container
-
or
public MappeableContainer or(MappeableRunContainer value2)
Description copied from class:MappeableContainerComputes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.- Specified by:
orin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
or
protected MappeableContainer or(CharIterator it)
-
rank
public int rank(char lowbits)
Description copied from class:MappeableContainerRank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).- Specified by:
rankin classMappeableContainer- Parameters:
lowbits- upper limit- Returns:
- the rank
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
remove
public MappeableContainer remove(int begin, int end)
Description copied from class:MappeableContainerReturn a new container with all chars in [begin,end) remove using an unsigned interpretation.- Specified by:
removein classMappeableContainer- Parameters:
begin- start of range (inclusive)end- end of range (exclusive)- Returns:
- the new container
-
remove
public MappeableContainer remove(char x)
Description copied from class:MappeableContainerRemove the char from this container. May create a new container.- Specified by:
removein classMappeableContainer- Parameters:
x- to be removed- Returns:
- New container
-
repairAfterLazy
public MappeableContainer repairAfterLazy()
Description copied from class:MappeableContainerThe output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.- Specified by:
repairAfterLazyin classMappeableContainer- Returns:
- a new valid container
-
runOptimize
public MappeableContainer runOptimize()
Description copied from class:MappeableContainerConvert to MappeableRunContainers, when the result is smaller. Overridden by MappeableRunContainer to possibly switch from MappeableRunContainer to a smaller alternative.- Specified by:
runOptimizein interfaceWordStorage<MappeableContainer>- Specified by:
runOptimizein classMappeableContainer- Returns:
- the new container
-
select
public char select(int j)
Description copied from class:MappeableContainerReturn the jth value- Specified by:
selectin classMappeableContainer- Parameters:
j- index of the value- Returns:
- the value
-
serializedSizeInBytes
public int serializedSizeInBytes()
Description copied from class:MappeableContainerReport the number of bytes required to serialize this container.- Specified by:
serializedSizeInBytesin classMappeableContainer- Returns:
- the size in bytes
-
toBitmapContainer
public MappeableBitmapContainer toBitmapContainer()
Copies the data in a bitmap container.- Specified by:
toBitmapContainerin classMappeableContainer- Returns:
- the bitmap container
-
first
public int first()
Description copied from class:MappeableContainerGet the first integer held in the container- Specified by:
firstin classMappeableContainer- Returns:
- the first integer in the container
-
last
public int last()
Description copied from class:MappeableContainerGet the last integer held in the container- Specified by:
lastin classMappeableContainer- Returns:
- the last integer in the container
-
nextValue
public int nextValue(char fromValue)
Description copied from class:MappeableContainerGets the first value greater than or equal to the lower bound, or -1 if no such value exists.- Specified by:
nextValuein classMappeableContainer- Parameters:
fromValue- the lower bound (inclusive)- Returns:
- the next value
-
previousValue
public int previousValue(char fromValue)
Description copied from class:MappeableContainerGets the last value less than or equal to the upper bound, or -1 if no such value exists.- Specified by:
previousValuein classMappeableContainer- Parameters:
fromValue- the upper bound (inclusive)- Returns:
- the previous value
-
nextAbsentValue
public int nextAbsentValue(char fromValue)
Description copied from class:MappeableContainerGets the first absent value greater than or equal to the lower bound.- Specified by:
nextAbsentValuein classMappeableContainer- Parameters:
fromValue- the lower bound (inclusive)- Returns:
- the next absent value
-
previousAbsentValue
public int previousAbsentValue(char fromValue)
Description copied from class:MappeableContainerGets the last value less than or equal to the upper bound.- Specified by:
previousAbsentValuein classMappeableContainer- Parameters:
fromValue- the upper bound (inclusive)- Returns:
- the previous absent value
-
toContainer
public Container toContainer()
Description copied from class:MappeableContainerConvert to a non-mappeable container.- Specified by:
toContainerin classMappeableContainer- Returns:
- the non-mappeable container
-
toShortArray
public char[] toShortArray()
Create a copy of the content of this container as a char array. This creates a copy.- Returns:
- copy of the content as a char array
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
trim
public void trim()
Description copied from class:MappeableContainerIf possible, recover wasted memory.- Specified by:
trimin classMappeableContainer
-
writeArray
protected void writeArray(java.io.DataOutput out) throws java.io.IOExceptionDescription copied from class:MappeableContainerWrite just the underlying array.- Specified by:
writeArrayin classMappeableContainer- Parameters:
out- output stream- Throws:
java.io.IOException- in case of failure
-
writeArray
protected void writeArray(java.nio.ByteBuffer buffer)
Description copied from class:MappeableContainerWrite just the underlying array.- Specified by:
writeArrayin classMappeableContainer- Parameters:
buffer- the buffer to write to
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
xor
public MappeableContainer xor(MappeableArrayContainer value2)
Description copied from class:MappeableContainerComputes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.- Specified by:
xorin classMappeableContainer- Parameters:
value2- other container- Returns:
- aggregated container
-
xor
public MappeableContainer xor(MappeableBitmapContainer x)
Description copied from class:MappeableContainerComputes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.- Specified by:
xorin classMappeableContainer- Parameters:
x- other container- Returns:
- aggregated container
-
xor
public MappeableContainer xor(MappeableRunContainer value2)
Description copied from class:MappeableContainerComputes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.- Specified by:
xorin classMappeableContainer- Parameters:
value2- other parameter- Returns:
- aggregated container
-
xor
protected MappeableContainer xor(CharIterator it)
-
forEach
public void forEach(char msb, IntConsumer ic)Description copied from class:MappeableContainerIterate through the values of this container and pass them along to the IntConsumer, using msb as the 16 most significant bits.- Specified by:
forEachin classMappeableContainer- Parameters:
msb- 16 most significant bitsic- consumer
-
andCardinality
public int andCardinality(MappeableArrayContainer value2)
- Specified by:
andCardinalityin classMappeableContainer
-
andCardinality
public int andCardinality(MappeableBitmapContainer x)
- Specified by:
andCardinalityin classMappeableContainer
-
andCardinality
public int andCardinality(MappeableRunContainer x)
- Specified by:
andCardinalityin classMappeableContainer
-
contains
protected boolean contains(MappeableRunContainer runContainer)
- Specified by:
containsin classMappeableContainer
-
contains
protected boolean contains(MappeableArrayContainer arrayContainer)
- Specified by:
containsin classMappeableContainer
-
contains
protected boolean contains(MappeableBitmapContainer bitmapContainer)
- Specified by:
containsin classMappeableContainer
-
intersects
public boolean intersects(int minimum, int supremum)Description copied from class:MappeableContainerChecks if the container intersects with a range- Specified by:
intersectsin classMappeableContainer- 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
-
contains
public boolean contains(int minimum, int supremum)Description copied from class:MappeableContainerChecks whether the container contains the entire range- Specified by:
containsin classMappeableContainer- Parameters:
minimum- the inclusive lower bound of the rangesupremum- the exclusive upper bound of the range- Returns:
- true if the container contains the range
-
-