public final class MappeableRunContainer extends MappeableContainer implements Cloneable
Modifier and Type | Field and Description |
---|---|
protected int |
nbrruns |
protected ShortBuffer |
valueslength |
ContainerNames
Modifier | Constructor and Description |
---|---|
|
MappeableRunContainer()
Create a container with default capacity
|
|
MappeableRunContainer(int capacity)
Create an array container with specified capacity
|
protected |
MappeableRunContainer(MappeableArrayContainer arr,
int nbrRuns) |
protected |
MappeableRunContainer(MappeableBitmapContainer bc,
int nbrRuns) |
|
MappeableRunContainer(RunContainer bc)
Creates a new container from a non-mappeable one.
|
|
MappeableRunContainer(ShortBuffer array,
int numRuns)
Construct a new RunContainer backed by the provided ShortBuffer.
|
Modifier and Type | Method and Description |
---|---|
MappeableContainer |
add(int begin,
int end)
Return a new container with all shorts in [begin,end) added using an unsigned interpretation.
|
MappeableContainer |
add(short k)
Add a short to the container.
|
MappeableContainer |
and(MappeableArrayContainer x)
Computes the bitwise AND of this container with another (intersection).
|
MappeableContainer |
and(MappeableBitmapContainer x)
Computes the bitwise AND of this container with another (intersection).
|
MappeableContainer |
and(MappeableRunContainer x)
Computes the bitwise AND of this container with another (intersection).
|
int |
andCardinality(MappeableArrayContainer x) |
int |
andCardinality(MappeableBitmapContainer x) |
int |
andCardinality(MappeableRunContainer x) |
MappeableContainer |
andNot(MappeableArrayContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
andNot(MappeableBitmapContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
andNot(MappeableRunContainer x)
Computes the bitwise ANDNOT of this container with another (difference).
|
void |
clear()
Empties the container
|
MappeableContainer |
clone() |
static boolean |
contains(ByteBuffer buf,
int position,
short x,
int numRuns)
Checks whether the run container contains x.
|
protected boolean |
contains(MappeableArrayContainer arrayContainer) |
protected boolean |
contains(MappeableBitmapContainer bitmapContainer) |
protected boolean |
contains(MappeableRunContainer runContainer) |
boolean |
contains(short x)
Checks whether the contain contains the provided value
|
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 index, with the
short values from this container.
|
int |
first()
Get the first integer held in the container
|
MappeableContainer |
flip(short x)
Add a short to the container if it is not present, otherwise remove it.
|
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.
|
static MappeableContainer |
full() |
protected int |
getArraySizeInBytes()
Size of the underlying array
|
protected static int |
getArraySizeInBytes(int nbrruns) |
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.
|
PeekableShortIterator |
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() |
MappeableContainer |
iadd(int begin,
int end)
Add all shorts in [begin,end) using an unsigned interpretation.
|
MappeableContainer |
iand(MappeableArrayContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iand(MappeableBitmapContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iand(MappeableRunContainer x)
Computes the in-place bitwise AND of this container with another (intersection).
|
MappeableContainer |
iandNot(MappeableArrayContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
iandNot(MappeableBitmapContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
MappeableContainer |
iandNot(MappeableRunContainer x)
Computes the in-place bitwise ANDNOT of this container with another (difference).
|
protected MappeableContainer |
ilazyor(MappeableArrayContainer x) |
MappeableContainer |
inot(int rangeStart,
int rangeEnd)
Computes the in-place bitwise NOT of this container (complement).
|
boolean |
intersects(MappeableArrayContainer x)
Returns true if the current container intersects the other container.
|
boolean |
intersects(MappeableBitmapContainer x)
Returns true if the current container intersects the other container.
|
boolean |
intersects(MappeableRunContainer x)
Returns true if the current container intersects the other container.
|
MappeableContainer |
ior(MappeableArrayContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
ior(MappeableBitmapContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
ior(MappeableRunContainer x)
Computes the in-place bitwise OR of this container with another (union).
|
MappeableContainer |
iremove(int begin,
int end)
Remove shorts in [begin,end) using an unsigned interpretation.
|
protected boolean |
isArrayBacked() |
protected boolean |
isFull() |
Iterator<Short> |
iterator() |
MappeableContainer |
ixor(MappeableArrayContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
ixor(MappeableBitmapContainer x)
Computes the in-place bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
ixor(MappeableRunContainer 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 MappeableContainer |
lazyor(MappeableArrayContainer x) |
MappeableContainer |
limit(int maxcardinality)
Create a new MappeableContainer containing at most maxcardinality integers.
|
MappeableContainer |
not(int rangeStart,
int rangeEnd)
Computes the bitwise NOT of this container (complement).
|
int |
numberOfRuns() |
MappeableContainer |
or(MappeableArrayContainer x)
Computes the bitwise OR of this container with another (union).
|
MappeableContainer |
or(MappeableBitmapContainer x)
Computes the bitwise OR of this container with another (union).
|
MappeableContainer |
or(MappeableRunContainer 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) |
MappeableContainer |
remove(int begin,
int end)
Return a new container with all shorts in [begin,end) remove using an unsigned interpretation.
|
MappeableContainer |
remove(short x)
Remove the short from this container.
|
MappeableContainer |
repairAfterLazy()
The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.
|
MappeableContainer |
runOptimize()
Convert to Array or Bitmap container if the serialized form would be shorter
|
short |
select(int j)
Return the jth value
|
int |
serializedSizeInBytes()
Report the number of bytes required to serialize this container.
|
protected static int |
serializedSizeInBytes(int numberOfRuns) |
MappeableBitmapContainer |
toBitmapContainer()
Convert the current container to a BitmapContainer, if a conversion is needed.
|
Container |
toContainer()
Convert to a non-mappeable container.
|
short[] |
toShortArray()
Create a copy of the content of this container as a short array.
|
String |
toString() |
void |
trim()
If possible, recover wasted memory.
|
protected void |
writeArray(DataOutput out)
Write just the underlying array.
|
void |
writeExternal(ObjectOutput out) |
MappeableContainer |
xor(MappeableArrayContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
xor(MappeableBitmapContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
MappeableContainer |
xor(MappeableRunContainer x)
Computes the bitwise XOR of this container with another (symmetric difference).
|
and, andCardinality, andNot, assertNonEmpty, contains, getContainerName, iand, iandNot, intersects, ior, ixor, lazyIOR, lazyOR, or, rangeOfOnes, xor, xorCardinality
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected ShortBuffer valueslength
protected int nbrruns
public MappeableRunContainer()
public MappeableRunContainer(int capacity)
capacity
- The capacity of the containerprotected MappeableRunContainer(MappeableArrayContainer arr, int nbrRuns)
protected MappeableRunContainer(MappeableBitmapContainer bc, int nbrRuns)
public MappeableRunContainer(RunContainer bc)
bc
- the original containerpublic MappeableRunContainer(ShortBuffer array, int numRuns)
array
- ShortBuffer where the data is storednumRuns
- number of runs (each using 2 shorts in the buffer)protected static int getArraySizeInBytes(int nbrruns)
protected static int serializedSizeInBytes(int numberOfRuns)
public MappeableContainer add(int begin, int end)
MappeableContainer
add
in class MappeableContainer
begin
- start of range (inclusive)end
- end of range (exclusive)public MappeableContainer add(short k)
MappeableContainer
add
in class MappeableContainer
k
- short to be addedpublic MappeableContainer and(MappeableArrayContainer x)
MappeableContainer
and
in class MappeableContainer
x
- other containerpublic MappeableContainer and(MappeableBitmapContainer x)
MappeableContainer
and
in class MappeableContainer
x
- other containerpublic MappeableContainer and(MappeableRunContainer x)
MappeableContainer
and
in class MappeableContainer
x
- other containerpublic MappeableContainer andNot(MappeableArrayContainer x)
MappeableContainer
andNot
in class MappeableContainer
x
- other containerpublic MappeableContainer andNot(MappeableBitmapContainer x)
MappeableContainer
andNot
in class MappeableContainer
x
- other containerpublic MappeableContainer andNot(MappeableRunContainer x)
MappeableContainer
andNot
in class MappeableContainer
x
- other containerpublic void clear()
MappeableContainer
clear
in class MappeableContainer
public MappeableContainer clone()
clone
in class MappeableContainer
public boolean contains(short x)
MappeableContainer
contains
in class MappeableContainer
x
- value to checkpublic static boolean contains(ByteBuffer buf, int position, short x, int numRuns)
buf
- underlying ByteBufferposition
- starting position of the container in the ByteBufferx
- target 16-bit valuenumRuns
- number of runsprotected void ensureCapacity(int minNbRuns)
public void fillLeastSignificant16bits(int[] x, int i, int mask)
MappeableContainer
fillLeastSignificant16bits
in class MappeableContainer
x
- provided arrayi
- starting indexmask
- indicates most significant bitspublic MappeableContainer flip(short x)
MappeableContainer
flip
in class MappeableContainer
x
- short to be addedprotected int getArraySizeInBytes()
MappeableContainer
getArraySizeInBytes
in class MappeableContainer
public int getCardinality()
MappeableContainer
getCardinality
in class MappeableContainer
public ShortIterator getReverseShortIterator()
MappeableContainer
getReverseShortIterator
in class MappeableContainer
public PeekableShortIterator getShortIterator()
MappeableContainer
getShortIterator
in class MappeableContainer
public int getSizeInBytes()
MappeableContainer
getSizeInBytes
in class MappeableContainer
public MappeableContainer iadd(int begin, int end)
MappeableContainer
iadd
in class MappeableContainer
begin
- start of range (inclusive)end
- end of range (exclusive)public MappeableContainer iand(MappeableArrayContainer x)
MappeableContainer
iand
in class MappeableContainer
x
- other containerpublic MappeableContainer iand(MappeableBitmapContainer x)
MappeableContainer
iand
in class MappeableContainer
x
- other containerpublic MappeableContainer iand(MappeableRunContainer x)
MappeableContainer
iand
in class MappeableContainer
x
- other containerpublic MappeableContainer iandNot(MappeableArrayContainer x)
MappeableContainer
iandNot
in class MappeableContainer
x
- other containerpublic MappeableContainer iandNot(MappeableBitmapContainer x)
MappeableContainer
iandNot
in class MappeableContainer
x
- other containerpublic MappeableContainer iandNot(MappeableRunContainer x)
MappeableContainer
iandNot
in class MappeableContainer
x
- other containerprotected MappeableContainer ilazyor(MappeableArrayContainer x)
public MappeableContainer inot(int rangeStart, int rangeEnd)
MappeableContainer
inot
in class MappeableContainer
rangeStart
- beginning of range (inclusive); 0 is beginning of this container.rangeEnd
- ending of range (exclusive)public boolean intersects(MappeableArrayContainer x)
MappeableContainer
intersects
in class MappeableContainer
x
- other containerpublic boolean intersects(MappeableBitmapContainer x)
MappeableContainer
intersects
in class MappeableContainer
x
- other containerpublic boolean intersects(MappeableRunContainer x)
MappeableContainer
intersects
in class MappeableContainer
x
- other containerpublic MappeableContainer ior(MappeableArrayContainer x)
MappeableContainer
ior
in class MappeableContainer
x
- other containerpublic MappeableContainer ior(MappeableBitmapContainer x)
MappeableContainer
ior
in class MappeableContainer
x
- other containerpublic MappeableContainer ior(MappeableRunContainer x)
MappeableContainer
ior
in class MappeableContainer
x
- other containerpublic MappeableContainer iremove(int begin, int end)
MappeableContainer
iremove
in class MappeableContainer
begin
- start of range (inclusive)end
- end of range (exclusive)protected boolean isArrayBacked()
isArrayBacked
in class MappeableContainer
protected boolean isFull()
public static MappeableContainer full()
public MappeableContainer ixor(MappeableArrayContainer x)
MappeableContainer
ixor
in class MappeableContainer
x
- other containerpublic MappeableContainer ixor(MappeableBitmapContainer x)
MappeableContainer
ixor
in class MappeableContainer
x
- other containerpublic MappeableContainer ixor(MappeableRunContainer x)
MappeableContainer
ixor
in class MappeableContainer
x
- other containerprotected MappeableContainer lazyor(MappeableArrayContainer x)
public MappeableContainer limit(int maxcardinality)
MappeableContainer
limit
in class MappeableContainer
maxcardinality
- maximal cardinalitypublic MappeableContainer not(int rangeStart, int rangeEnd)
MappeableContainer
not
in class MappeableContainer
rangeStart
- beginning of range (inclusive); 0 is beginning of this container.rangeEnd
- ending of range (exclusive)public int numberOfRuns()
public MappeableContainer or(MappeableArrayContainer x)
MappeableContainer
or
in class MappeableContainer
x
- other containerpublic MappeableContainer or(MappeableBitmapContainer x)
MappeableContainer
or
in class MappeableContainer
x
- other containerpublic MappeableContainer or(MappeableRunContainer x)
MappeableContainer
or
in class MappeableContainer
x
- other containerpublic int rank(short lowbits)
MappeableContainer
rank
in class MappeableContainer
lowbits
- upper limitpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public MappeableContainer remove(int begin, int end)
MappeableContainer
remove
in class MappeableContainer
begin
- start of range (inclusive)end
- end of range (exclusive)public MappeableContainer remove(short x)
MappeableContainer
remove
in class MappeableContainer
x
- to be removedpublic MappeableContainer repairAfterLazy()
MappeableContainer
repairAfterLazy
in class MappeableContainer
public MappeableContainer runOptimize()
runOptimize
in class MappeableContainer
public short select(int j)
MappeableContainer
select
in class MappeableContainer
j
- index of the valuepublic int serializedSizeInBytes()
MappeableContainer
serializedSizeInBytes
in class MappeableContainer
public Container toContainer()
MappeableContainer
toContainer
in class MappeableContainer
public short[] toShortArray()
public void trim()
MappeableContainer
trim
in class MappeableContainer
protected void writeArray(DataOutput out) throws IOException
MappeableContainer
writeArray
in class MappeableContainer
out
- output streamIOException
- in case of failurepublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public MappeableContainer xor(MappeableArrayContainer x)
MappeableContainer
xor
in class MappeableContainer
x
- other containerpublic MappeableContainer xor(MappeableBitmapContainer x)
MappeableContainer
xor
in class MappeableContainer
x
- other containerpublic MappeableContainer xor(MappeableRunContainer x)
MappeableContainer
xor
in class MappeableContainer
x
- other parameterpublic void forEach(short msb, IntConsumer ic)
MappeableContainer
forEach
in class MappeableContainer
msb
- 16 most significant bitsic
- consumerpublic int andCardinality(MappeableArrayContainer x)
andCardinality
in class MappeableContainer
public int andCardinality(MappeableBitmapContainer x)
andCardinality
in class MappeableContainer
public int andCardinality(MappeableRunContainer x)
andCardinality
in class MappeableContainer
public MappeableBitmapContainer toBitmapContainer()
MappeableContainer
toBitmapContainer
in class MappeableContainer
public int first()
MappeableContainer
first
in class MappeableContainer
public int last()
MappeableContainer
last
in class MappeableContainer
protected boolean contains(MappeableRunContainer runContainer)
contains
in class MappeableContainer
protected boolean contains(MappeableArrayContainer arrayContainer)
contains
in class MappeableContainer
protected boolean contains(MappeableBitmapContainer bitmapContainer)
contains
in class MappeableContainer
Copyright © 2018. All rights reserved.