public abstract class Container extends Object implements Iterable<Short>, Cloneable, Externalizable
Modifier and Type | Field and Description |
---|---|
static String[] |
ContainerNames
Name of the various possible containers
|
Constructor and Description |
---|
Container() |
Modifier and Type | Method and Description |
---|---|
abstract Container |
add(int begin,
int end)
Return a new container with all shorts in [begin,end) added using an unsigned interpretation.
|
abstract Container |
add(short x)
Add a short to the container.
|
abstract Container |
and(ArrayContainer x)
Computes the bitwise AND of this container with another (intersection).
|
abstract Container |
and(BitmapContainer x)
Computes the bitwise AND of this container with another (intersection).
|
Container |
and(Container x)
Computes the bitwise AND of this container with another (intersection).
|
abstract Container |
and(RunContainer x)
Computes the bitwise AND of this container with another (intersection).
|
protected abstract int |
andCardinality(ArrayContainer x) |
protected abstract int |
andCardinality(BitmapContainer x) |
int |
andCardinality(Container x)
Computes the bitwise AND of this container with another (intersection).
|
protected abstract int |
andCardinality(RunContainer x) |
abstract Container |
andNot(ArrayContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
abstract Container |
andNot(BitmapContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
Container |
andNot(Container x)
Computes the bitwise ANDNOT of this container with another (difference).
|
abstract Container |
andNot(RunContainer 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 Container |
clone() |
protected abstract boolean |
contains(ArrayContainer arrayContainer) |
protected abstract boolean |
contains(BitmapContainer bitmapContainer) |
boolean |
contains(Container subset)
Checks whether the container is a subset of this container or not
|
protected abstract boolean |
contains(RunContainer runContainer) |
abstract boolean |
contains(short x)
Checks whether the contain contains the provided value
|
abstract void |
deserialize(DataInput in)
Deserialize (recover) the container.
|
abstract 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.
|
abstract int |
first()
Get the first integer held in the container
|
abstract Container |
flip(short x)
Add a short to the container if it is not present, otherwise remove it.
|
abstract void |
forEach(short msb,
IntConsumer ic)
Iterate through the values of this container and pass them
along to the IntConsumer, using msb as the 16 most significant bits.
|
protected abstract int |
getArraySizeInBytes()
Size of the underlying array
|
abstract int |
getCardinality()
Computes the distinct number of short values in the container.
|
String |
getContainerName()
Get the name of this container.
|
abstract ShortIterator |
getReverseShortIterator()
Iterator to visit the short values in the container in descending order.
|
abstract PeekableShortIterator |
getShortIterator()
Iterator to visit the short values in the container in ascending order.
|
abstract int |
getSizeInBytes()
Computes an estimate of the memory usage of this container.
|
abstract Container |
iadd(int begin,
int end)
Add all shorts in [begin,end) using an unsigned interpretation.
|
abstract Container |
iand(ArrayContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
abstract Container |
iand(BitmapContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
Container |
iand(Container x)
Computes the in-place bitwise AND of this container with another (intersection).
|
abstract Container |
iand(RunContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
abstract Container |
iandNot(ArrayContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
abstract Container |
iandNot(BitmapContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
Container |
iandNot(Container x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
abstract Container |
iandNot(RunContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
abstract Container |
inot(int rangeStart,
int rangeEnd)
Computes the in-place bitwise NOT of this container (complement).
|
abstract boolean |
intersects(ArrayContainer x)
Returns true if the current container intersects the other container.
|
abstract boolean |
intersects(BitmapContainer x)
Returns true if the current container intersects the other container.
|
boolean |
intersects(Container x)
Returns true if the current container intersects the other container.
|
abstract boolean |
intersects(RunContainer x)
Returns true if the current container intersects the other container.
|
abstract Container |
ior(ArrayContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
abstract Container |
ior(BitmapContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
Container |
ior(Container x)
Computes the in-place bitwise OR of this container with another (union).
|
abstract Container |
ior(RunContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
abstract Container |
iremove(int begin,
int end)
Remove shorts in [begin,end) using an unsigned interpretation.
|
abstract Container |
ixor(ArrayContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
abstract Container |
ixor(BitmapContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
Container |
ixor(Container x)
Computes the in-place bitwise OR of this container with another (union).
|
abstract Container |
ixor(RunContainer 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
|
Container |
lazyIOR(Container x)
Computes the in-place bitwise OR of this container with another (union).
|
Container |
lazyOR(Container x)
Computes the bitwise OR of this container with another (union).
|
abstract Container |
limit(int maxcardinality)
Create a new Container containing at most maxcardinality integers.
|
abstract Container |
not(int rangeStart,
int rangeEnd)
Computes the bitwise NOT of this container (complement).
|
abstract Container |
or(ArrayContainer x)
Computes the bitwise OR of this container with another (union).
|
abstract Container |
or(BitmapContainer x)
Computes the bitwise OR of this container with another (union).
|
Container |
or(Container x)
Computes the bitwise OR of this container with another (union).
|
abstract Container |
or(RunContainer x)
Computes the bitwise OR of this container with another (union).
|
static Container |
rangeOfOnes(int start,
int last)
Create a container initialized with a range of consecutive values
|
abstract int |
rank(short lowbits)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be
GetCardinality()).
|
abstract Container |
remove(int begin,
int end)
Return a new container with all shorts in [begin,end) remove using an unsigned interpretation.
|
abstract Container |
remove(short x)
Remove the short from this container.
|
abstract Container |
repairAfterLazy()
The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.
|
abstract Container |
runOptimize()
Convert to RunContainers, when the result is smaller.
|
abstract short |
select(int j)
Return the jth value
|
abstract void |
serialize(DataOutput out)
Serialize the container.
|
abstract int |
serializedSizeInBytes()
Report the number of bytes required to serialize this container.
|
abstract BitmapContainer |
toBitmapContainer()
Convert the current container to a BitmapContainer, if a conversion is needed.
|
abstract MappeableContainer |
toMappeableContainer()
Convert to a mappeable container.
|
abstract void |
trim()
If possible, recover wasted memory.
|
protected abstract void |
writeArray(DataOutput out)
Write just the underlying array.
|
abstract Container |
xor(ArrayContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
abstract Container |
xor(BitmapContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
Container |
xor(Container x)
Computes the bitwise OR of this container with another (symmetric difference).
|
abstract Container |
xor(RunContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
int |
xorCardinality(Container other)
Returns the cardinality of the XOR between the passed container and this
container without materialising a temporary container.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, iterator, spliterator
readExternal, writeExternal
public static final String[] ContainerNames
public static Container rangeOfOnes(int start, int last)
start
- first indexlast
- last index (range is exclusive)public abstract Container add(int begin, int end)
begin
- start of range (inclusive)end
- end of range (exclusive)public abstract Container add(short x)
x
- short to be addedpublic abstract Container and(ArrayContainer x)
x
- other containerpublic abstract Container and(BitmapContainer x)
x
- other containerpublic Container and(Container x)
x
- other containerpublic abstract Container and(RunContainer x)
x
- other containerprotected abstract int andCardinality(ArrayContainer x)
protected abstract int andCardinality(BitmapContainer x)
protected abstract int andCardinality(RunContainer x)
public int andCardinality(Container x)
x
- other containerpublic int xorCardinality(Container other)
other
- other containerpublic abstract Container andNot(ArrayContainer x)
x
- other containerpublic abstract Container andNot(BitmapContainer x)
x
- other containerpublic Container andNot(Container x)
x
- other containerpublic abstract Container andNot(RunContainer x)
x
- other containerpublic abstract void clear()
public abstract boolean contains(short x)
x
- value to checkpublic boolean contains(Container subset)
subset
- the container to be testedprotected abstract boolean contains(RunContainer runContainer)
protected abstract boolean contains(ArrayContainer arrayContainer)
protected abstract boolean contains(BitmapContainer bitmapContainer)
public abstract void deserialize(DataInput in) throws IOException
in
- the DataInput streamIOException
- Signals that an I/O exception has occurred.public abstract void fillLeastSignificant16bits(int[] x, int i, int mask)
x
- provided arrayi
- starting indexmask
- indicates most significant bitspublic abstract Container flip(short x)
x
- short to be addedprotected abstract int getArraySizeInBytes()
public abstract int getCardinality()
public String getContainerName()
public abstract void forEach(short msb, IntConsumer ic)
msb
- 16 most significant bitsic
- consumerpublic abstract ShortIterator getReverseShortIterator()
public abstract PeekableShortIterator getShortIterator()
public abstract int getSizeInBytes()
public abstract Container iadd(int begin, int end)
begin
- start of range (inclusive)end
- end of range (exclusive)public abstract Container iand(ArrayContainer x)
x
- other containerpublic abstract Container iand(BitmapContainer x)
x
- other containerpublic Container iand(Container x)
x
- other containerpublic abstract Container iand(RunContainer x)
x
- other containerpublic abstract Container iandNot(ArrayContainer x)
x
- other containerpublic abstract Container iandNot(BitmapContainer x)
x
- other containerpublic Container iandNot(Container x)
x
- other containerpublic abstract Container iandNot(RunContainer x)
x
- other containerpublic abstract Container 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(ArrayContainer x)
x
- other containerpublic abstract boolean intersects(BitmapContainer x)
x
- other containerpublic boolean intersects(Container x)
x
- other containerpublic abstract boolean intersects(RunContainer x)
x
- other containerpublic abstract Container ior(ArrayContainer x)
x
- other containerpublic abstract Container ior(BitmapContainer x)
x
- other containerpublic Container ior(Container x)
x
- other containerpublic abstract Container ior(RunContainer x)
x
- other containerpublic abstract Container iremove(int begin, int end)
begin
- start of range (inclusive)end
- end of range (exclusive)public abstract Container ixor(ArrayContainer x)
x
- other containerpublic abstract Container ixor(BitmapContainer x)
x
- other containerpublic Container ixor(Container x)
x
- other containerpublic abstract Container ixor(RunContainer x)
x
- other containerpublic Container lazyIOR(Container x)
x
- other containerpublic Container lazyOR(Container x)
x
- other containerpublic abstract Container limit(int maxcardinality)
maxcardinality
- maximal cardinalitypublic abstract Container not(int rangeStart, int rangeEnd)
rangeStart
- beginning of range (inclusive); 0 is beginning of this container.rangeEnd
- ending of range (exclusive)public abstract Container or(ArrayContainer x)
x
- other containerpublic abstract Container or(BitmapContainer x)
x
- other containerpublic Container or(Container x)
x
- other containerpublic abstract Container or(RunContainer x)
x
- other containerpublic abstract int rank(short lowbits)
lowbits
- upper limitpublic abstract Container remove(int begin, int end)
begin
- start of range (inclusive)end
- end of range (exclusive)public abstract Container remove(short x)
x
- to be removedpublic abstract Container repairAfterLazy()
public abstract Container runOptimize()
public abstract short select(int j)
j
- index of the valuepublic abstract void serialize(DataOutput out) throws IOException
out
- the DataOutput streamIOException
- Signals that an I/O exception has occurred.public abstract int serializedSizeInBytes()
public abstract MappeableContainer toMappeableContainer()
public abstract void trim()
protected abstract void writeArray(DataOutput out) throws IOException
out
- output streamIOException
- in case of failurepublic abstract Container xor(ArrayContainer x)
x
- other containerpublic abstract Container xor(BitmapContainer x)
x
- other containerpublic Container xor(Container x)
x
- other parameterpublic abstract Container xor(RunContainer x)
x
- other containerpublic abstract BitmapContainer toBitmapContainer()
public abstract int first()
NoSuchElementException
- if emptypublic abstract int last()
NoSuchElementException
- if emptyprotected void assertNonEmpty(boolean condition)
condition
- a boolean expressionNoSuchElementException
- if emptyCopyright © 2018. All rights reserved.