public abstract class MappeableContainer extends java.lang.Object implements java.lang.Iterable<java.lang.Character>, java.lang.Cloneable, java.io.Externalizable, WordStorage<MappeableContainer>
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String[] |
ContainerNames
Name of the various possible containers
|
| 构造器和说明 |
|---|
MappeableContainer() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract MappeableContainer |
add(char x)
Add a char to the container.
|
abstract MappeableContainer |
add(int begin,
int end)
Return a new container with all chars in [begin,end) added using an unsigned interpretation.
|
abstract MappeableContainer |
and(MappeableArrayContainer x)
Computes the bitwise AND of this container with another (intersection).
|
abstract MappeableContainer |
and(MappeableBitmapContainer x)
Computes the bitwise AND of this container with another (intersection).
|
protected MappeableContainer |
and(MappeableContainer x) |
abstract MappeableContainer |
and(MappeableRunContainer x)
Computes the bitwise AND of this container with another (intersection).
|
protected abstract int |
andCardinality(MappeableArrayContainer x) |
protected abstract int |
andCardinality(MappeableBitmapContainer x) |
int |
andCardinality(MappeableContainer x)
Computes the bitwise AND of this container with another (intersection).
|
protected abstract int |
andCardinality(MappeableRunContainer x) |
abstract void |
andInto(long[] bits)
Computes the intersection of this container with the bits present in the array,
modifying the array.
|
abstract MappeableContainer |
andNot(MappeableArrayContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
abstract MappeableContainer |
andNot(MappeableBitmapContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
protected MappeableContainer |
andNot(MappeableContainer x) |
abstract MappeableContainer |
andNot(MappeableRunContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
protected void |
assertNonEmpty(boolean condition)
Throw if the container is empty
|
abstract void |
clear()
Empties the container
|
abstract MappeableContainer |
clone() |
abstract boolean |
contains(char x)
Checks whether the contain contains the provided value
|
abstract boolean |
contains(int minimum,
int supremum)
Checks whether the container contains the entire range
|
protected abstract boolean |
contains(MappeableArrayContainer arrayContainer) |
protected abstract boolean |
contains(MappeableBitmapContainer bitmapContainer) |
boolean |
contains(MappeableContainer subset)
Checks whether the container is a subset of this container or not
|
protected abstract boolean |
contains(MappeableRunContainer runContainer) |
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.
|
abstract int |
first()
Get the first integer held in the container
|
abstract MappeableContainer |
flip(char x)
Add a char to the container if it is not present, otherwise remove it.
|
abstract void |
forEach(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 int |
getArraySizeInBytes()
Size of the underlying array
|
abstract ContainerBatchIterator |
getBatchIterator()
Gets an iterator to visit the contents of the container in batches
|
abstract int |
getCardinality()
Computes the distinct number of char values in the container.
|
abstract PeekableCharIterator |
getCharIterator()
Iterator to visit the char values in the container in ascending order.
|
java.lang.String |
getContainerName()
Get the name of this container.
|
abstract CharIterator |
getReverseCharIterator()
Iterator to visit the char values in the container in descending order.
|
abstract int |
getSizeInBytes()
Computes an estimate of the memory usage of this container.
|
abstract MappeableContainer |
iadd(int begin,
int end)
Add all chars in [begin,end) using an unsigned interpretation.
|
abstract MappeableContainer |
iand(MappeableArrayContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
abstract MappeableContainer |
iand(MappeableBitmapContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
protected MappeableContainer |
iand(MappeableContainer x) |
abstract MappeableContainer |
iand(MappeableRunContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
abstract MappeableContainer |
iandNot(MappeableArrayContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
abstract MappeableContainer |
iandNot(MappeableBitmapContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
protected MappeableContainer |
iandNot(MappeableContainer x) |
abstract MappeableContainer |
iandNot(MappeableRunContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
abstract MappeableContainer |
inot(int rangeStart,
int rangeEnd)
Computes the in-place bitwise NOT of this container (complement).
|
abstract boolean |
intersects(int minimum,
int supremum)
Checks if the container intersects with a range
|
abstract boolean |
intersects(MappeableArrayContainer x)
Returns true if the current container intersects the other container.
|
abstract boolean |
intersects(MappeableBitmapContainer x)
Returns true if the current container intersects the other container.
|
boolean |
intersects(MappeableContainer x)
Returns true if the current container intersects the other container.
|
abstract boolean |
intersects(MappeableRunContainer x)
Returns true if the current container intersects the other container.
|
abstract MappeableContainer |
ior(MappeableArrayContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
abstract MappeableContainer |
ior(MappeableBitmapContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
protected MappeableContainer |
ior(MappeableContainer x) |
abstract MappeableContainer |
ior(MappeableRunContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
iorNot(MappeableContainer x,
int endOfRange)
Computes the in-place bitwise ORNOT of this container with another.
|
abstract MappeableContainer |
iremove(int begin,
int end)
Remove chars in [begin,end) using an unsigned interpretation.
|
protected abstract boolean |
isArrayBacked() |
abstract boolean |
isEmpty()
Checks whether the container is empty or not.
|
abstract boolean |
isFull()
Checks whether the container is full or not.
|
abstract MappeableContainer |
ixor(MappeableArrayContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
abstract MappeableContainer |
ixor(MappeableBitmapContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
protected MappeableContainer |
ixor(MappeableContainer x) |
abstract MappeableContainer |
ixor(MappeableRunContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
abstract int |
last()
Get the last integer held in the container
|
MappeableContainer |
lazyIOR(MappeableContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
lazyOR(MappeableContainer x)
Computes the bitwise OR of this container with another (union).
|
abstract MappeableContainer |
limit(int maxcardinality)
Create a new MappeableContainer containing at most maxcardinality integers.
|
abstract int |
nextAbsentValue(char fromValue)
Gets the first absent value greater than or equal to the lower bound.
|
abstract int |
nextValue(char fromValue)
Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.
|
abstract MappeableContainer |
not(int rangeStart,
int rangeEnd)
Computes the bitwise NOT of this container (complement).
|
abstract MappeableContainer |
or(MappeableArrayContainer x)
Computes the bitwise OR of this container with another (union).
|
abstract MappeableContainer |
or(MappeableBitmapContainer x)
Computes the bitwise OR of this container with another (union).
|
protected MappeableContainer |
or(MappeableContainer x) |
abstract MappeableContainer |
or(MappeableRunContainer x)
Computes the bitwise OR of this container with another (union).
|
abstract void |
orInto(long[] bits)
Computes the union of this container with the bits present in the array,
modifying the array.
|
MappeableContainer |
orNot(MappeableContainer x,
int endOfRange)
Computes the bitwise ORNOT of this container with another.
|
abstract int |
previousAbsentValue(char fromValue)
Gets the last value less than or equal to the upper bound.
|
abstract int |
previousValue(char fromValue)
Gets the last value less than or equal to the upper bound, or -1 if no such value exists.
|
static MappeableContainer |
rangeOfOnes(int start,
int last)
Create a container initialized with a range of consecutive values
|
abstract int |
rank(char lowbits)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be
GetCardinality()).
|
abstract MappeableContainer |
remove(char x)
Remove the char from this container.
|
abstract MappeableContainer |
remove(int begin,
int end)
Return a new container with all chars in [begin,end) remove using an unsigned interpretation.
|
abstract MappeableContainer |
repairAfterLazy()
The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.
|
abstract MappeableContainer |
runOptimize()
Convert to MappeableRunContainers, when the result is smaller.
|
abstract char |
select(int j)
Return the jth value
|
abstract int |
serializedSizeInBytes()
Report the number of bytes required to serialize this container.
|
abstract MappeableBitmapContainer |
toBitmapContainer()
Convert the current container to a BitmapContainer, if a conversion is needed.
|
abstract Container |
toContainer()
Convert to a non-mappeable container.
|
abstract void |
trim()
If possible, recover wasted memory.
|
protected abstract void |
writeArray(java.nio.ByteBuffer buffer)
Write just the underlying array.
|
protected abstract void |
writeArray(java.io.DataOutput out)
Write just the underlying array.
|
abstract MappeableContainer |
xor(MappeableArrayContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
abstract MappeableContainer |
xor(MappeableBitmapContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
protected MappeableContainer |
xor(MappeableContainer x) |
abstract MappeableContainer |
xor(MappeableRunContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
int |
xorCardinality(MappeableContainer other)
Returns the cardinality of the XOR between the passed container and this
container without materialising a temporary container.
|
public static java.lang.String[] ContainerNames
public static MappeableContainer rangeOfOnes(int start, int last)
start - first indexlast - last index (range is exclusive)public abstract MappeableContainer add(int begin, int end)
begin - start of range (inclusive)end - end of range (exclusive)public abstract MappeableContainer add(char x)
add 在接口中 WordStorage<MappeableContainer>x - char to be addedpublic abstract boolean isEmpty()
isEmpty 在接口中 WordStorage<MappeableContainer>public abstract boolean isFull()
public abstract void orInto(long[] bits)
bits - a 1024 element array to be interpreted as a bit setpublic abstract void andInto(long[] bits)
bits - a 1024 element array to be interpreted as a bit setpublic abstract MappeableContainer and(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer and(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer and(MappeableContainer x)
protected abstract int andCardinality(MappeableArrayContainer x)
protected abstract int andCardinality(MappeableBitmapContainer x)
protected abstract int andCardinality(MappeableRunContainer x)
public int xorCardinality(MappeableContainer other)
other - other containerpublic int andCardinality(MappeableContainer x)
x - other containerpublic abstract MappeableContainer and(MappeableRunContainer x)
x - other containerpublic abstract MappeableContainer andNot(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer andNot(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer andNot(MappeableContainer x)
public abstract MappeableContainer andNot(MappeableRunContainer x)
x - other containerpublic MappeableContainer orNot(MappeableContainer x, int endOfRange)
x - other containerendOfRange - end of range (size of the universe)public MappeableContainer iorNot(MappeableContainer x, int endOfRange)
x - other containerendOfRange - the exclusive endpublic abstract void clear()
public abstract MappeableContainer clone()
clone 在类中 java.lang.Objectpublic abstract boolean contains(char x)
x - value to checkpublic boolean contains(MappeableContainer subset)
subset - the container to be testedprotected abstract boolean contains(MappeableRunContainer runContainer)
protected abstract boolean contains(MappeableArrayContainer arrayContainer)
protected abstract boolean contains(MappeableBitmapContainer bitmapContainer)
public abstract boolean intersects(int minimum,
int supremum)
minimum - the inclusive unsigned lower bound of the rangesupremum - the exclusive unsigned upper bound of the rangepublic abstract boolean contains(int minimum,
int supremum)
minimum - the inclusive lower bound of the rangesupremum - the exclusive upper bound of the rangepublic abstract void fillLeastSignificant16bits(int[] x,
int i,
int mask)
x - provided arrayi - starting indexmask - indicates most significant bitspublic abstract MappeableContainer flip(char x)
x - char to be addedprotected abstract int getArraySizeInBytes()
public abstract int getCardinality()
public java.lang.String getContainerName()
public abstract CharIterator getReverseCharIterator()
public abstract PeekableCharIterator getCharIterator()
public abstract ContainerBatchIterator getBatchIterator()
public abstract void forEach(char msb,
IntConsumer ic)
msb - 16 most significant bitsic - consumerpublic abstract int getSizeInBytes()
public abstract MappeableContainer iadd(int begin, int end)
begin - start of range (inclusive)end - end of range (exclusive)public abstract MappeableContainer iand(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer iand(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer iand(MappeableContainer x)
public abstract MappeableContainer iand(MappeableRunContainer x)
x - other containerpublic abstract MappeableContainer iandNot(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer iandNot(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer iandNot(MappeableContainer x)
public abstract MappeableContainer iandNot(MappeableRunContainer x)
x - other containerpublic abstract MappeableContainer inot(int rangeStart, int rangeEnd)
rangeStart - beginning of range (inclusive); 0 is beginning of this container.rangeEnd - ending of range (exclusive)public abstract boolean intersects(MappeableArrayContainer x)
x - other containerpublic abstract boolean intersects(MappeableBitmapContainer x)
x - other containerpublic boolean intersects(MappeableContainer x)
x - other containerpublic abstract boolean intersects(MappeableRunContainer x)
x - other containerpublic abstract MappeableContainer ior(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer ior(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer ior(MappeableContainer x)
public abstract MappeableContainer ior(MappeableRunContainer x)
x - other containerpublic abstract MappeableContainer iremove(int begin, int end)
begin - start of range (inclusive)end - end of range (exclusive)protected abstract boolean isArrayBacked()
public abstract MappeableContainer ixor(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer ixor(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer ixor(MappeableContainer x)
public abstract MappeableContainer ixor(MappeableRunContainer x)
x - other containerpublic MappeableContainer lazyIOR(MappeableContainer x)
x - other containerpublic MappeableContainer lazyOR(MappeableContainer x)
x - other containerpublic abstract MappeableContainer limit(int maxcardinality)
maxcardinality - maximal cardinalitypublic abstract MappeableContainer not(int rangeStart, int rangeEnd)
rangeStart - beginning of range (inclusive); 0 is beginning of this container.rangeEnd - ending of range (exclusive)public abstract MappeableContainer or(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer or(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer or(MappeableContainer x)
public abstract MappeableContainer or(MappeableRunContainer x)
x - other containerpublic abstract int rank(char lowbits)
lowbits - upper limitpublic abstract MappeableContainer remove(int begin, int end)
begin - start of range (inclusive)end - end of range (exclusive)public abstract MappeableContainer remove(char x)
x - to be removedpublic abstract MappeableContainer repairAfterLazy()
public abstract MappeableContainer runOptimize()
runOptimize 在接口中 WordStorage<MappeableContainer>public abstract char select(int j)
j - index of the valuepublic abstract int serializedSizeInBytes()
public abstract Container toContainer()
public abstract void trim()
protected abstract void writeArray(java.io.DataOutput out)
throws java.io.IOException
out - output streamjava.io.IOException - in case of failureprotected abstract void writeArray(java.nio.ByteBuffer buffer)
buffer - the buffer to write topublic abstract MappeableContainer xor(MappeableArrayContainer x)
x - other containerpublic abstract MappeableContainer xor(MappeableBitmapContainer x)
x - other containerprotected MappeableContainer xor(MappeableContainer x)
public abstract MappeableContainer xor(MappeableRunContainer x)
x - other parameterpublic abstract MappeableBitmapContainer toBitmapContainer()
public abstract int first()
java.util.NoSuchElementException - if emptypublic abstract int last()
java.util.NoSuchElementException - if emptypublic abstract int nextValue(char fromValue)
fromValue - the lower bound (inclusive)public abstract int previousValue(char fromValue)
fromValue - the upper bound (inclusive)public abstract int nextAbsentValue(char fromValue)
fromValue - the lower bound (inclusive)public abstract int previousAbsentValue(char fromValue)
fromValue - the upper bound (inclusive)protected void assertNonEmpty(boolean condition)
condition - a boolean expressionjava.util.NoSuchElementException - if empty