java.lang.Object
org.bitlap.roaringbitmap.buffer.MappeableContainer
- 所有已实现的接口:
Externalizable,Serializable,Cloneable,Iterable<Character>,WordStorage<MappeableContainer>
public abstract class MappeableContainer
extends Object
implements Iterable<Character>, Cloneable, Externalizable, WordStorage<MappeableContainer>
Base container class. This class is similar to org.roaringbitmap.Container but meant to be used
with memory mapping.
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明abstract MappeableContaineradd(char x) Add a char to the container.abstract MappeableContaineradd(int begin, int end) Return a new container with all chars in [begin,end) added using an unsigned interpretation.abstract MappeableContainerComputes the bitwise AND of this container with another (intersection).abstract MappeableContainerComputes the bitwise AND of this container with another (intersection).protected MappeableContainerabstract MappeableContainerComputes the bitwise AND of this container with another (intersection).protected abstract intprotected abstract intintComputes the bitwise AND of this container with another (intersection).protected abstract intabstract voidandInto(long[] bits) Computes the intersection of this container with the bits present in the array, modifying the array.abstract MappeableContainerComputes the bitwise ANDNOT of this container with another (difference).abstract MappeableContainerComputes the bitwise ANDNOT of this container with another (difference).protected MappeableContainerabstract MappeableContainerComputes the bitwise ANDNOT of this container with another (difference).protected voidassertNonEmpty(boolean condition) Throw if the container is emptyabstract voidclear()Empties the containerabstract MappeableContainerclone()abstract booleancontains(char x) Checks whether the contain contains the provided valueabstract booleancontains(int minimum, int supremum) Checks whether the container contains the entire rangeprotected abstract booleancontains(MappeableArrayContainer arrayContainer) protected abstract booleancontains(MappeableBitmapContainer bitmapContainer) booleancontains(MappeableContainer subset) Checks whether the container is a subset of this container or notprotected abstract booleancontains(MappeableRunContainer runContainer) abstract 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.abstract intfirst()Get the first integer held in the containerabstract MappeableContainerflip(char x) Add a char to the container if it is not present, otherwise remove it.abstract 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 abstract intSize of the underlying arrayabstract ContainerBatchIteratorGets an iterator to visit the contents of the container in batchesabstract intComputes the distinct number of char values in the container.abstract PeekableCharIteratorIterator to visit the char values in the container in ascending order.Get the name of this container.abstract CharIteratorIterator to visit the char values in the container in descending order.abstract intComputes an estimate of the memory usage of this container.abstract MappeableContaineriadd(int begin, int end) Add all chars in [begin,end) using an unsigned interpretation.abstract MappeableContainerComputes the in-place bitwise AND of this container with another (intersection).abstract MappeableContainerComputes the in-place bitwise AND of this container with another (intersection).protected MappeableContainerabstract MappeableContainerComputes the in-place bitwise AND of this container with another (intersection).abstract MappeableContainerComputes the in-place bitwise ANDNOT of this container with another (difference).abstract MappeableContainerComputes the in-place bitwise ANDNOT of this container with another (difference).protected MappeableContainerabstract MappeableContainerComputes the in-place bitwise ANDNOT of this container with another (difference).abstract MappeableContainerinot(int rangeStart, int rangeEnd) Computes the in-place bitwise NOT of this container (complement).abstract booleanintersects(int minimum, int supremum) Checks if the container intersects with a rangeabstract booleanReturns true if the current container intersects the other container.abstract booleanReturns true if the current container intersects the other container.booleanReturns true if the current container intersects the other container.abstract booleanReturns true if the current container intersects the other container.abstract MappeableContainerComputes the in-place bitwise OR of this container with another (union).abstract MappeableContainerComputes the in-place bitwise OR of this container with another (union).protected MappeableContainerabstract MappeableContainerComputes the in-place bitwise OR of this container with another (union).iorNot(MappeableContainer x, int endOfRange) Computes the in-place bitwise ORNOT of this container with another.abstract MappeableContaineriremove(int begin, int end) Remove chars in [begin,end) using an unsigned interpretation.protected abstract booleanabstract booleanisEmpty()Checks whether the container is empty or not.abstract booleanisFull()Checks whether the container is full or not.abstract MappeableContainerComputes the in-place bitwise XOR of this container with another (symmetric difference).abstract MappeableContainerComputes the in-place bitwise XOR of this container with another (symmetric difference).protected MappeableContainerabstract MappeableContainerComputes the in-place bitwise XOR of this container with another (symmetric difference).abstract intlast()Get the last integer held in the containerComputes the in-place bitwise OR of this container with another (union).Computes the bitwise OR of this container with another (union).abstract MappeableContainerlimit(int maxcardinality) Create a new MappeableContainer containing at most maxcardinality integers.abstract intnextAbsentValue(char fromValue) Gets the first absent value greater than or equal to the lower bound.abstract intnextValue(char fromValue) Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.abstract MappeableContainernot(int rangeStart, int rangeEnd) Computes the bitwise NOT of this container (complement).abstract MappeableContainerComputes the bitwise OR of this container with another (union).abstract MappeableContainerComputes the bitwise OR of this container with another (union).protected MappeableContainerabstract MappeableContainerComputes the bitwise OR of this container with another (union).abstract voidorInto(long[] bits) Computes the union of this container with the bits present in the array, modifying the array.orNot(MappeableContainer x, int endOfRange) Computes the bitwise ORNOT of this container with another.abstract intpreviousAbsentValue(char fromValue) Gets the last value less than or equal to the upper bound.abstract intpreviousValue(char fromValue) Gets the last value less than or equal to the upper bound, or -1 if no such value exists.static MappeableContainerrangeOfOnes(int start, int last) Create a container initialized with a range of consecutive valuesabstract intrank(char lowbits) Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).abstract MappeableContainerremove(char x) Remove the char from this container.abstract MappeableContainerremove(int begin, int end) Return a new container with all chars in [begin,end) remove using an unsigned interpretation.abstract voidremoveFrom(long[] bits) Computes the intersection of the negation of this container with the bits present in the array, modifying the array.abstract MappeableContainerThe output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.abstract MappeableContainerConvert to MappeableRunContainers, when the result is smaller.abstract charselect(int j) Return the jth valueabstract intReport the number of bytes required to serialize this container.abstract MappeableBitmapContainerConvert the current container to a BitmapContainer, if a conversion is needed.abstract ContainerConvert to a non-mappeable container.abstract voidtrim()If possible, recover wasted memory.protected abstract voidwriteArray(DataOutput out) Write just the underlying array.protected abstract voidwriteArray(ByteBuffer buffer) Write just the underlying array.abstract MappeableContainerComputes the bitwise XOR of this container with another (symmetric difference).abstract MappeableContainerComputes the bitwise XOR of this container with another (symmetric difference).protected MappeableContainerabstract MappeableContainerComputes the bitwise XOR of this container with another (symmetric difference).intxorCardinality(MappeableContainer other) Returns the cardinality of the XOR between the passed container and this container without materialising a temporary container.从类继承的方法 java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 java.io.Externalizable
readExternal, writeExternal从接口继承的方法 java.lang.Iterable
forEach, iterator, spliterator
-
字段详细资料
-
ContainerNames
Name of the various possible containers
-
-
构造器详细资料
-
MappeableContainer
public MappeableContainer()
-
-
方法详细资料
-
rangeOfOnes
Create a container initialized with a range of consecutive values- 参数:
start- first indexlast- last index (range is exclusive)- 返回:
- a new container initialized with the specified values
-
add
Return a new container with all chars in [begin,end) added using an unsigned interpretation.- 参数:
begin- start of range (inclusive)end- end of range (exclusive)- 返回:
- the new container
-
add
Add a char to the container. May generate a new container.- 指定者:
add在接口中WordStorage<MappeableContainer>- 参数:
x- char to be added- 返回:
- the new container
-
isEmpty
public abstract boolean isEmpty()Checks whether the container is empty or not.- 指定者:
isEmpty在接口中WordStorage<MappeableContainer>- 返回:
- true if the container is empty.
-
isFull
public abstract boolean isFull()Checks whether the container is full or not.- 返回:
- true if the container is full.
-
orInto
public abstract void orInto(long[] bits) Computes the union of this container with the bits present in the array, modifying the array.- 参数:
bits- a 1024 element array to be interpreted as a bit set
-
andInto
public abstract void andInto(long[] bits) Computes the intersection of this container with the bits present in the array, modifying the array.- 参数:
bits- a 1024 element array to be interpreted as a bit set
-
removeFrom
public abstract void removeFrom(long[] bits) Computes the intersection of the negation of this container with the bits present in the array, modifying the array.- 参数:
bits- a 1024 element array to be interpreted as a bit set
-
and
Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
and
Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
and
-
andCardinality
-
andCardinality
-
andCardinality
-
xorCardinality
Returns the cardinality of the XOR between the passed container and this container without materialising a temporary container.- 参数:
other- other container- 返回:
- the cardinality of the symmetric difference of the two containers
-
andCardinality
Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
and
Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
andNot
Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
andNot
Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
andNot
-
andNot
Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
orNot
Computes the bitwise ORNOT of this container with another. This container as well as the provided container are left unaffected.- 参数:
x- other containerendOfRange- end of range (size of the universe)- 返回:
- aggregated container
-
iorNot
Computes the in-place bitwise ORNOT of this container with another. The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.- 参数:
x- other containerendOfRange- the exclusive end- 返回:
- aggregated container
-
clear
public abstract void clear()Empties the container -
clone
-
contains
public abstract boolean contains(char x) Checks whether the contain contains the provided value- 参数:
x- value to check- 返回:
- whether the value is in the container
-
contains
Checks whether the container is a subset of this container or not- 参数:
subset- the container to be tested- 返回:
- true if the parameter is a subset of this container
-
contains
-
contains
-
contains
-
intersects
public abstract boolean intersects(int minimum, int supremum) Checks if the container intersects with a range- 参数:
minimum- the inclusive unsigned lower bound of the rangesupremum- the exclusive unsigned upper bound of the range- 返回:
- true if the container intersects the range
-
contains
public abstract boolean contains(int minimum, int supremum) Checks whether the container contains the entire range- 参数:
minimum- the inclusive lower bound of the rangesupremum- the exclusive upper bound of the range- 返回:
- true if the container contains the range
-
fillLeastSignificant16bits
public abstract void fillLeastSignificant16bits(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. 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.- 参数:
x- provided arrayi- starting indexmask- indicates most significant bits
-
flip
Add a char to the container if it is not present, otherwise remove it. May generate a new container.- 参数:
x- char to be added- 返回:
- the new container
-
getArraySizeInBytes
protected abstract int getArraySizeInBytes()Size of the underlying array- 返回:
- size in bytes
-
getCardinality
public abstract int getCardinality()Computes the distinct number of char values in the container. Can be expected to run in constant time.- 返回:
- the cardinality
-
getContainerName
Get the name of this container.- 返回:
- name of the container
-
getReverseCharIterator
Iterator to visit the char values in the container in descending order.- 返回:
- iterator
-
getCharIterator
Iterator to visit the char values in the container in ascending order.- 返回:
- iterator
-
getBatchIterator
Gets an iterator to visit the contents of the container in batches- 返回:
- iterator
-
forEach
Iterate through the values of this container and pass them along to the IntConsumer, using msb as the 16 most significant bits.- 参数:
msb- 16 most significant bitsic- consumer
-
getSizeInBytes
public abstract int getSizeInBytes()Computes an estimate of the memory usage of this container. The estimate is not meant to be exact.- 返回:
- estimated memory usage in bytes
-
iadd
Add all chars in [begin,end) using an unsigned interpretation. May generate a new container.- 参数:
begin- start of range (inclusive)end- end of range (exclusive)- 返回:
- the new container
-
iand
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
iand
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
iand
-
iand
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
iandNot
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
iandNot
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
iandNot
-
iandNot
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
inot
Computes 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.- 参数:
rangeStart- beginning of range (inclusive); 0 is beginning of this container.rangeEnd- ending of range (exclusive)- 返回:
- (partially) completmented container
-
intersects
Returns true if the current container intersects the other container.- 参数:
x- other container- 返回:
- whether they intersect
-
intersects
Returns true if the current container intersects the other container.- 参数:
x- other container- 返回:
- whether they intersect
-
intersects
Returns true if the current container intersects the other container.- 参数:
x- other container- 返回:
- whether they intersect
-
intersects
Returns true if the current container intersects the other container.- 参数:
x- other container- 返回:
- whether they intersect
-
ior
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
ior
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
ior
-
ior
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
iremove
Remove chars in [begin,end) using an unsigned interpretation. May generate a new container.- 参数:
begin- start of range (inclusive)end- end of range (exclusive)- 返回:
- the new container
-
isArrayBacked
protected abstract boolean isArrayBacked() -
ixor
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
ixor
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
ixor
-
ixor
Computes 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.- 参数:
x- other container- 返回:
- aggregated container
-
lazyIOR
Computes 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. The resulting container may not track its cardinality correctly. The resulting container may not track its cardinality correctly. This can be fixed as follows: if(c.getCardinality()<0) ((MappeableBitmapContainer)c).computeCardinality();- 参数:
x- other container- 返回:
- aggregated container
-
lazyOR
Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected. The resulting container may not track its cardinality correctly. This can be fixed as follows: if(c.getCardinality()<0) ((MappeableBitmapContainer)c).computeCardinality();- 参数:
x- other container- 返回:
- aggregated container
-
limit
Create a new MappeableContainer containing at most maxcardinality integers.- 参数:
maxcardinality- maximal cardinality- 返回:
- a new bitmap with cardinality no more than maxcardinality
-
not
Computes the bitwise NOT of this container (complement). Only those bits within the range are affected. The current container is left unaffected.- 参数:
rangeStart- beginning of range (inclusive); 0 is beginning of this container.rangeEnd- ending of range (exclusive)- 返回:
- (partially) completmented container
-
or
Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
or
Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
or
-
or
Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
rank
public abstract int rank(char lowbits) Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).- 参数:
lowbits- upper limit- 返回:
- the rank
-
remove
Return a new container with all chars in [begin,end) remove using an unsigned interpretation.- 参数:
begin- start of range (inclusive)end- end of range (exclusive)- 返回:
- the new container
-
remove
Remove the char from this container. May create a new container.- 参数:
x- to be removed- 返回:
- New container
-
repairAfterLazy
The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.- 返回:
- a new valid container
-
runOptimize
Convert to MappeableRunContainers, when the result is smaller. Overridden by MappeableRunContainer to possibly switch from MappeableRunContainer to a smaller alternative.- 指定者:
runOptimize在接口中WordStorage<MappeableContainer>- 返回:
- the new container
-
select
public abstract char select(int j) Return the jth value- 参数:
j- index of the value- 返回:
- the value
-
serializedSizeInBytes
public abstract int serializedSizeInBytes()Report the number of bytes required to serialize this container.- 返回:
- the size in bytes
-
toContainer
Convert to a non-mappeable container.- 返回:
- the non-mappeable container
-
trim
public abstract void trim()If possible, recover wasted memory. -
writeArray
Write just the underlying array.- 参数:
out- output stream- 抛出:
IOException- in case of failure
-
writeArray
Write just the underlying array.- 参数:
buffer- the buffer to write to
-
xor
Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
xor
Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.- 参数:
x- other container- 返回:
- aggregated container
-
xor
-
xor
Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.- 参数:
x- other parameter- 返回:
- aggregated container
-
toBitmapContainer
Convert the current container to a BitmapContainer, if a conversion is needed. If the container is already a bitmap, the container is returned unchanged.- 返回:
- a bitmap container
-
first
public abstract int first()Get the first integer held in the container- 返回:
- the first integer in the container
- 抛出:
NoSuchElementException- if empty
-
last
public abstract int last()Get the last integer held in the container- 返回:
- the last integer in the container
- 抛出:
NoSuchElementException- if empty
-
nextValue
public abstract int nextValue(char fromValue) Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.- 参数:
fromValue- the lower bound (inclusive)- 返回:
- the next value
-
previousValue
public abstract int previousValue(char fromValue) Gets the last value less than or equal to the upper bound, or -1 if no such value exists.- 参数:
fromValue- the upper bound (inclusive)- 返回:
- the previous value
-
nextAbsentValue
public abstract int nextAbsentValue(char fromValue) Gets the first absent value greater than or equal to the lower bound.- 参数:
fromValue- the lower bound (inclusive)- 返回:
- the next absent value
-
previousAbsentValue
public abstract int previousAbsentValue(char fromValue) Gets the last value less than or equal to the upper bound.- 参数:
fromValue- the upper bound (inclusive)- 返回:
- the previous absent value
-
assertNonEmpty
protected void assertNonEmpty(boolean condition) Throw if the container is empty- 参数:
condition- a boolean expression- 抛出:
NoSuchElementException- if empty
-