public final class RunContainer extends Container implements java.lang.Cloneable
ContainerNames| 限定符 | 构造器和说明 |
|---|---|
|
RunContainer()
Create a container with default capacity
|
protected |
RunContainer(ArrayContainer arr,
int nbrRuns) |
protected |
RunContainer(BitmapContainer bc,
int nbrRuns) |
|
RunContainer(char[] array,
int numRuns)
Construct a new RunContainer backed by the provided array.
|
|
RunContainer(int capacity)
Create an array container with specified capacity
|
|
RunContainer(int firstOfRun,
int lastOfRun)
Create an run container with a run of ones from firstOfRun to lastOfRun.
|
|
RunContainer(MappeableRunContainer bc)
Creates a new non-mappeable container from a mappeable one.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Container |
add(char k)
Add a short to the container.
|
Container |
add(int begin,
int end)
Return a new container with all shorts in [begin,end) added using an unsigned interpretation.
|
Container |
and(ArrayContainer x)
Computes the bitwise AND of this container with another (intersection).
|
Container |
and(BitmapContainer x)
Computes the bitwise AND of this container with another (intersection).
|
Container |
and(RunContainer x)
Computes the bitwise AND of this container with another (intersection).
|
int |
andCardinality(ArrayContainer x) |
int |
andCardinality(BitmapContainer x) |
int |
andCardinality(RunContainer x) |
Container |
andNot(ArrayContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
Container |
andNot(BitmapContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
Container |
andNot(RunContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
void |
clear()
Empties the container
|
Container |
clone() |
protected boolean |
contains(ArrayContainer arrayContainer) |
protected boolean |
contains(BitmapContainer bitmapContainer) |
boolean |
contains(char x)
Checks whether the contain contains the provided value
|
boolean |
contains(int minimum,
int supremum)
Checks whether the container contains the entire range
|
protected boolean |
contains(RunContainer runContainer) |
void |
deserialize(java.io.DataInput in)
Deserialize (recover) the container.
|
boolean |
equals(java.lang.Object o) |
void |
fillLeastSignificant16bits(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.
|
int |
first()
Get the first integer held in the container
|
Container |
flip(char x)
Add a short to the container if it is not present, otherwise remove it.
|
void |
forAll(int offset,
RelativeRangeConsumer rrc)
Consume presence information for all values in this container.
|
void |
forAllFrom(char startValue,
RelativeRangeConsumer rrc)
Consume presence information for all values greater or equal to
startValue in this container.
|
void |
forAllInRange(char startValue,
char endValue,
RelativeRangeConsumer rrc)
Consumer presence information for all values in the
range [startValue, endValue) in this container.
|
void |
forAllUntil(int offset,
char endValue,
RelativeRangeConsumer rrc)
Consume presence information for all values smaller than endValue
in this container.
|
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.
|
static RunContainer |
full() |
int |
getArraySizeInBytes()
Size of the underlying array
|
ContainerBatchIterator |
getBatchIterator()
Gets an iterator to visit the contents of the container in batches
|
int |
getCardinality()
Computes the distinct number of char values in the container.
|
PeekableCharIterator |
getCharIterator()
Iterator to visit the char values in the container in ascending order.
|
PeekableCharRankIterator |
getCharRankIterator()
Iterator to visit the short values in container and pre-compute ranks
|
char |
getLength(int index)
Gets the length of the run at the index.
|
PeekableCharIterator |
getReverseCharIterator()
Iterator to visit the char values in the container in descending order.
|
int |
getSizeInBytes()
Computes an estimate of the memory usage of this container.
|
char |
getValue(int index)
Gets the value of the first element of the run at the index.
|
int |
hashCode() |
Container |
iadd(int begin,
int end)
Add all shorts in [begin,end) using an unsigned interpretation.
|
Container |
iand(ArrayContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
Container |
iand(BitmapContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
Container |
iand(RunContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
Container |
iandNot(ArrayContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
Container |
iandNot(BitmapContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
Container |
iandNot(RunContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
Container |
inot(int rangeStart,
int rangeEnd)
Computes the in-place bitwise NOT of this container (complement).
|
boolean |
intersects(ArrayContainer x)
Returns true if the current container intersects the other container.
|
boolean |
intersects(BitmapContainer x)
Returns true if the current container intersects the other container.
|
boolean |
intersects(int minimum,
int supremum)
Checks if the container intersects with a range
|
boolean |
intersects(RunContainer x)
Returns true if the current container intersects the other container.
|
Container |
ior(ArrayContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
Container |
ior(BitmapContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
Container |
ior(RunContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
Container |
iremove(int begin,
int end)
Remove shorts in [begin,end) using an unsigned interpretation.
|
boolean |
isEmpty()
Checks whether the container is empty or not.
|
boolean |
isFull()
Checks whether the container is full or not.
|
java.util.Iterator<java.lang.Character> |
iterator() |
Container |
ixor(ArrayContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
Container |
ixor(BitmapContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
Container |
ixor(RunContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
int |
last()
Get the last integer held in the container
|
protected Container |
lazyor(ArrayContainer x) |
Container |
limit(int maxcardinality)
Create a new Container containing at most maxcardinality integers.
|
int |
nextAbsentValue(char fromValue)
Gets the first absent value greater than or equal to the lower bound.
|
int |
nextValue(char fromValue)
Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.
|
Container |
not(int rangeStart,
int rangeEnd)
Computes the bitwise NOT of this container (complement).
|
int |
numberOfRuns() |
Container |
or(ArrayContainer x)
Computes the bitwise OR of this container with another (union).
|
Container |
or(BitmapContainer x)
Computes the bitwise OR of this container with another (union).
|
Container |
or(RunContainer x)
Computes the bitwise OR of this container with another (union).
|
int |
previousAbsentValue(char fromValue)
Gets the last value less than or equal to the upper bound.
|
int |
previousValue(char fromValue)
Gets the last value less than or equal to the upper bound, or -1 if no such value exists.
|
int |
rank(char lowbits)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be
GetCardinality()).
|
void |
readExternal(java.io.ObjectInput in) |
Container |
remove(char x)
Remove the char from this container.
|
Container |
remove(int begin,
int end)
Return a new container with all chars in [begin,end) remove using an unsigned interpretation.
|
Container |
repairAfterLazy()
The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.
|
Container |
runOptimize()
Convert to Array or Bitmap container if the serialized form would be shorter.
|
char |
select(int j)
Return the jth value
|
void |
serialize(java.io.DataOutput out)
Serialize the container.
|
int |
serializedSizeInBytes()
Report the number of bytes required to serialize this container.
|
protected static int |
serializedSizeInBytes(int numberOfRuns) |
BitmapContainer |
toBitmapContainer()
Convert the current container to a BitmapContainer, if a conversion is needed.
|
java.nio.CharBuffer |
toCharBuffer()
Return the content of this container as a ShortBuffer.
|
MappeableContainer |
toMappeableContainer()
Convert to a mappeable container.
|
java.lang.String |
toString() |
void |
trim()
If possible, recover wasted memory.
|
void |
writeArray(java.nio.ByteBuffer buffer)
Write just the underlying array.
|
void |
writeArray(java.io.DataOutput out)
Write just the underlying array.
|
void |
writeExternal(java.io.ObjectOutput out) |
Container |
xor(ArrayContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
Container |
xor(BitmapContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
Container |
xor(RunContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
and, andCardinality, andNot, assertNonEmpty, contains, getContainerName, iand, iandNot, intersects, ior, iorNot, ixor, lazyIOR, lazyOR, or, orNot, rangeOfOnes, xor, xorCardinalitypublic RunContainer()
protected RunContainer(ArrayContainer arr, int nbrRuns)
public RunContainer(int firstOfRun,
int lastOfRun)
firstOfRun - first indexlastOfRun - last index (range is exclusive)protected RunContainer(BitmapContainer bc, int nbrRuns)
public RunContainer(int capacity)
capacity - The capacity of the containerpublic RunContainer(MappeableRunContainer bc)
bc - the original containerpublic RunContainer(char[] array,
int numRuns)
array - array where the data is storednumRuns - number of runs (each using 2 shorts in the buffer)protected static int serializedSizeInBytes(int numberOfRuns)
public Container add(int begin, int end)
Containerpublic Container add(char k)
Containeradd 在接口中 WordStorage<Container>add 在类中 Containerk - short to be addedpublic Container and(ArrayContainer x)
Containerpublic Container and(BitmapContainer x)
Containerpublic Container and(RunContainer x)
Containerpublic int andCardinality(ArrayContainer x)
andCardinality 在类中 Containerpublic int andCardinality(BitmapContainer x)
andCardinality 在类中 Containerpublic int andCardinality(RunContainer x)
andCardinality 在类中 Containerpublic Container andNot(ArrayContainer x)
Containerpublic Container andNot(BitmapContainer x)
Containerpublic Container andNot(RunContainer x)
Containerpublic boolean isEmpty()
ContainerisEmpty 在接口中 WordStorage<Container>isEmpty 在类中 Containerpublic boolean contains(char x)
Containerpublic boolean contains(int minimum,
int supremum)
Containerprotected boolean contains(RunContainer runContainer)
protected boolean contains(ArrayContainer arrayContainer)
protected boolean contains(BitmapContainer bitmapContainer)
public void deserialize(java.io.DataInput in)
throws java.io.IOException
Containerdeserialize 在类中 Containerin - the DataInput streamjava.io.IOException - Signals that an I/O exception has occurred.public boolean equals(java.lang.Object o)
equals 在类中 java.lang.Objectpublic void fillLeastSignificant16bits(int[] x,
int i,
int mask)
ContainerfillLeastSignificant16bits 在类中 Containerx - provided arrayi - starting indexmask - indicates most significant bitspublic Container flip(char x)
Containerpublic int getArraySizeInBytes()
ContainergetArraySizeInBytes 在类中 Containerpublic int getCardinality()
ContainergetCardinality 在类中 Containerpublic char getLength(int index)
index - the index of the run.java.lang.ArrayIndexOutOfBoundsException - if index is negative or larger than the index of the
last run.public PeekableCharIterator getReverseCharIterator()
ContainergetReverseCharIterator 在类中 Containerpublic PeekableCharIterator getCharIterator()
ContainergetCharIterator 在类中 Containerpublic PeekableCharRankIterator getCharRankIterator()
ContainergetCharRankIterator 在类中 Containerpublic ContainerBatchIterator getBatchIterator()
ContainergetBatchIterator 在类中 Containerpublic int getSizeInBytes()
ContainergetSizeInBytes 在类中 Containerpublic char getValue(int index)
index - the index of the run.java.lang.ArrayIndexOutOfBoundsException - if index is negative or larger than the index of the
last run.public int hashCode()
hashCode 在类中 java.lang.Objectpublic Container iadd(int begin, int end)
Containerpublic Container iand(ArrayContainer x)
Containerpublic Container iand(BitmapContainer x)
Containerpublic Container iand(RunContainer x)
Containerpublic Container iandNot(ArrayContainer x)
Containerpublic Container iandNot(BitmapContainer x)
Containerpublic Container iandNot(RunContainer x)
Containerpublic Container inot(int rangeStart, int rangeEnd)
Containerpublic boolean intersects(ArrayContainer x)
Containerintersects 在类中 Containerx - other containerpublic boolean intersects(BitmapContainer x)
Containerintersects 在类中 Containerx - other containerpublic boolean intersects(RunContainer x)
Containerintersects 在类中 Containerx - other containerpublic boolean intersects(int minimum,
int supremum)
Containerintersects 在类中 Containerminimum - the inclusive unsigned lower bound of the rangesupremum - the exclusive unsigned upper bound of the rangepublic Container ior(ArrayContainer x)
Containerpublic Container ior(BitmapContainer x)
Containerpublic Container ior(RunContainer x)
Containerpublic Container iremove(int begin, int end)
Containerpublic boolean isFull()
Containerpublic static RunContainer full()
public java.util.Iterator<java.lang.Character> iterator()
iterator 在接口中 java.lang.Iterable<java.lang.Character>public Container ixor(ArrayContainer x)
Containerpublic Container ixor(BitmapContainer x)
Containerpublic Container ixor(RunContainer x)
Containerprotected Container lazyor(ArrayContainer x)
public Container limit(int maxcardinality)
Containerpublic Container not(int rangeStart, int rangeEnd)
Containerpublic int numberOfRuns()
public Container or(ArrayContainer x)
Containerpublic Container or(BitmapContainer x)
Containerpublic Container or(RunContainer x)
Containerpublic int rank(char lowbits)
Containerpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal 在接口中 java.io.Externalizablejava.io.IOExceptionpublic Container remove(int begin, int end)
Containerpublic Container remove(char x)
Containerpublic Container repairAfterLazy()
ContainerrepairAfterLazy 在类中 Containerpublic Container runOptimize()
runOptimize 在接口中 WordStorage<Container>runOptimize 在类中 Containerpublic char select(int j)
Containerpublic void serialize(java.io.DataOutput out)
throws java.io.IOException
Containerpublic int serializedSizeInBytes()
ContainerserializedSizeInBytes 在类中 Containerpublic MappeableContainer toMappeableContainer()
ContainertoMappeableContainer 在类中 Containerpublic java.nio.CharBuffer toCharBuffer()
public java.lang.String toString()
toString 在类中 java.lang.Objectpublic void trim()
Containerpublic void writeArray(java.io.DataOutput out)
throws java.io.IOException
ContainerwriteArray 在类中 Containerout - output streamjava.io.IOException - in case of failurepublic void writeArray(java.nio.ByteBuffer buffer)
ContainerwriteArray 在类中 Containerbuffer - ByteBuffer to write topublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal 在接口中 java.io.Externalizablejava.io.IOExceptionpublic Container xor(ArrayContainer x)
Containerpublic Container xor(BitmapContainer x)
Containerpublic Container xor(RunContainer x)
Containerpublic void forEach(char msb,
IntConsumer ic)
Containerpublic void forAll(int offset,
RelativeRangeConsumer rrc)
Containerpublic void forAllFrom(char startValue,
RelativeRangeConsumer rrc)
ContainerforAllFrom 在类中 ContainerstartValue - First value to consume. Corresponds to relativePos=0 in the range consumer.rrc - consumerpublic void forAllUntil(int offset,
char endValue,
RelativeRangeConsumer rrc)
ContainerforAllUntil 在类中 Containeroffset - First value in this container corresponds to this
relativePos in the range consumer.endValue - First value greater than last value to consume.rrc - consumerpublic void forAllInRange(char startValue,
char endValue,
RelativeRangeConsumer rrc)
ContainerforAllInRange 在类中 ContainerstartValue - First value to consume. Corresponds to relativePos=0 in the range consumer.endValue - First value greater than last value to consume.rrc - consumerpublic BitmapContainer toBitmapContainer()
ContainertoBitmapContainer 在类中 Containerpublic int nextValue(char fromValue)
Containerpublic int previousValue(char fromValue)
ContainerpreviousValue 在类中 ContainerfromValue - the upper bound (inclusive)public int nextAbsentValue(char fromValue)
ContainernextAbsentValue 在类中 ContainerfromValue - the lower bound (inclusive)public int previousAbsentValue(char fromValue)
ContainerpreviousAbsentValue 在类中 ContainerfromValue - the upper bound (inclusive)public int first()
Container