public final class RunContainer extends Container implements Cloneable
Modifier | Constructor and Description |
---|---|
|
RunContainer()
Create a container with default capacity
|
protected |
RunContainer(BitmapContainer bc,
int nbrRuns) |
|
RunContainer(int capacity)
Create an array container with specified capacity
|
|
RunContainer(short[] array,
int numRuns)
Construct a new RunContainer backed by the provided array.
|
protected |
RunContainer(ShortIterator sIt,
int nbrRuns) |
Modifier and Type | Method and Description |
---|---|
Container |
add(int begin,
int end)
Return a new container with all shorts in [begin,end)
added using an unsigned interpretation.
|
Container |
add(short k)
Add a short to the container.
|
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).
|
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() |
boolean |
contains(short x)
Checks whether the contain contains the provided value
|
void |
deserialize(DataInput in)
Deserialize (recover) the container.
|
protected void |
ensureCapacity(int minNbRuns) |
boolean |
equals(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.
|
Container |
flip(short x)
Add a short to the container if it is not present, otherwise remove it.
|
protected int |
getArraySizeInBytes()
Size of the underlying array
|
int |
getCardinality()
Computes the distinct number of short values in the container.
|
ShortIterator |
getReverseShortIterator()
Iterator to visit the short values in the container in descending order.
|
ShortIterator |
getShortIterator()
Iterator to visit the short values in the container in ascending order.
|
int |
getSizeInBytes()
Computes an estimate of the memory usage of this container.
|
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).
|
protected Container |
ilazyor(ArrayContainer x) |
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(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.
|
protected boolean |
isFull() |
Iterator<Short> |
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).
|
protected Container |
lazyor(ArrayContainer x) |
Container |
limit(int maxcardinality)
Create a new Container containing at most maxcardinality integers.
|
Container |
not(int rangeStart,
int rangeEnd)
Computes the bitwise NOT of this container (complement).
|
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 |
rank(short lowbits)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).
|
void |
readExternal(ObjectInput in) |
Container |
remove(int begin,
int end)
Return a new container with all shorts in [begin,end)
remove using an unsigned interpretation.
|
Container |
remove(short x)
Remove the short from this container.
|
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.
|
short |
select(int j)
Return the jth value
|
void |
serialize(DataOutput out)
Serialize the container.
|
int |
serializedSizeInBytes()
Report the number of bytes required to serialize this container.
|
protected static int |
serializedSizeInBytes(int numberOfRuns) |
String |
toString() |
void |
trim()
If possible, recover wasted memory.
|
protected void |
writeArray(DataOutput out)
Write just the underlying array.
|
void |
writeExternal(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, andNot, getContainerName, iand, iandNot, intersects, ior, ixor, lazyIOR, lazyOR, or, rangeOfOnes, xor
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public RunContainer(short[] array, int numRuns)
array
- array where the data is storednumRuns
- number of runs (each using 2 shorts in the buffer)protected RunContainer(ShortIterator sIt, int nbrRuns)
protected RunContainer(BitmapContainer bc, int nbrRuns)
public RunContainer()
public RunContainer(int capacity)
capacity
- The capacity of the containerpublic Container runOptimize()
runOptimize
in class Container
protected void ensureCapacity(int minNbRuns)
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public Container flip(short x)
Container
public Container add(short k)
Container
public Container add(int begin, int end)
Container
public Container and(ArrayContainer x)
Container
public Container and(BitmapContainer x)
Container
public Container andNot(BitmapContainer x)
Container
public Container andNot(ArrayContainer x)
Container
public void clear()
Container
public boolean contains(short x)
Container
public void deserialize(DataInput in) throws IOException
Container
deserialize
in class Container
in
- the DataInput streamIOException
- Signals that an I/O exception has occurred.public void fillLeastSignificant16bits(int[] x, int i, int mask)
Container
fillLeastSignificant16bits
in class Container
x
- provided arrayi
- starting indexmask
- indicates most significant bitsprotected int getArraySizeInBytes()
Container
getArraySizeInBytes
in class Container
public int getCardinality()
Container
getCardinality
in class Container
public ShortIterator getShortIterator()
Container
getShortIterator
in class Container
public ShortIterator getReverseShortIterator()
Container
getReverseShortIterator
in class Container
public int getSizeInBytes()
Container
getSizeInBytes
in class Container
public Container iand(ArrayContainer x)
Container
public Container iand(BitmapContainer x)
Container
public Container iandNot(ArrayContainer x)
Container
public Container iandNot(BitmapContainer x)
Container
public Container inot(int rangeStart, int rangeEnd)
Container
public Container ior(ArrayContainer x)
Container
public Container ior(BitmapContainer x)
Container
public Container ixor(ArrayContainer x)
Container
public Container ixor(BitmapContainer x)
Container
public Container not(int rangeStart, int rangeEnd)
Container
public Container or(ArrayContainer x)
Container
protected Container ilazyor(ArrayContainer x)
protected Container lazyor(ArrayContainer x)
protected boolean isFull()
public Container or(BitmapContainer x)
Container
public Container remove(short x)
Container
public void serialize(DataOutput out) throws IOException
Container
serialize
in class Container
out
- the DataOutput streamIOException
- Signals that an I/O exception has occurred.public int serializedSizeInBytes()
Container
serializedSizeInBytes
in class Container
protected static int serializedSizeInBytes(int numberOfRuns)
public void trim()
Container
protected void writeArray(DataOutput out) throws IOException
Container
writeArray
in class Container
out
- output streamIOException
- in case of failurepublic Container xor(ArrayContainer x)
Container
public Container xor(BitmapContainer x)
Container
public int rank(short lowbits)
Container
public short select(int j)
Container
public Container limit(int maxcardinality)
Container
public Container iadd(int begin, int end)
Container
public Container iremove(int begin, int end)
Container
public Container remove(int begin, int end)
Container
public Container and(RunContainer x)
Container
public Container andNot(RunContainer x)
Container
public Container iand(RunContainer x)
Container
public Container iandNot(RunContainer x)
Container
public Container ior(RunContainer x)
Container
public Container ixor(RunContainer x)
Container
public Container or(RunContainer x)
Container
public Container xor(RunContainer x)
Container
public Container repairAfterLazy()
Container
repairAfterLazy
in class Container
public boolean intersects(ArrayContainer x)
Container
intersects
in class Container
x
- other containerpublic boolean intersects(BitmapContainer x)
Container
intersects
in class Container
x
- other containerpublic boolean intersects(RunContainer x)
Container
intersects
in class Container
x
- other containerCopyright © 2015. All Rights Reserved.