Class TwoValuesContainer
java.lang.Object
io.deephaven.engine.rowset.impl.rsp.container.Container
io.deephaven.engine.rowset.impl.rsp.container.ImmutableContainer
io.deephaven.engine.rowset.impl.rsp.container.TwoValuesContainer
-
Nested Class Summary
-
Field Summary
Fields inherited from class io.deephaven.engine.rowset.impl.rsp.container.ImmutableContainer
ENABLED
Fields inherited from class io.deephaven.engine.rowset.impl.rsp.container.Container
ContainerNames, DEBUG, MAX_RANGE, MAX_VALUE, threadLocalBuf
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(int rangeStart, int rangeEnd) Return a new container with all shorts in [begin,end) added using an unsigned interpretation.Computes the bitwise AND of this container with another (intersection).Computes the bitwise AND of this container with another (intersection).and
(RunContainer x) Computes the bitwise AND of this container with another (intersection).Computes the bitwise ANDNOT of this container with another (difference).Computes the bitwise ANDNOT of this container with another (difference).Computes the bitwise ANDNOT of this container with another (difference).andRange
(int start, int end) Calculate the intersection of this container and a range, in a new container.int
int
boolean
contains
(int rangeStart, int rangeEnd) Checks whether the container contains the entire rangeboolean
contains
(short x) Checks whether the contain contains the provided valueprotected boolean
protected boolean
protected boolean
int
find
(short x) Searches for the specified short valueboolean
findRanges
(RangeConsumer outPositions, RangeIterator inValues, int maxPos) As find but for all the values in a range.int
first()
Get the first integer held in the containerboolean
forEach
(int rankOffset, ShortConsumer sc) Like forEach, but skipping the first rankOffset elements.boolean
forEach
(ShortConsumer sc) Iterate through the values of this container in order and pass them along to the ShortConsumer.boolean
forEachRange
(int rankOffset, ShortRangeConsumer sc) int
Computes the distinct number of short values in the container.Iterator to visit the short values in the container in descending order.getShortBatchIterator
(int skipFromStartCount) Gets an iterator to visit the contents of the container in batches of short valuesIterator to visit the short values in the container in ascending order.getShortRangeIterator
(int skipFromStartCount) Iterator to visit the short values in container in [start, end) ranges, in increasing order of start values.iflip
(short x) Add a short to the container if it is not present, otherwise remove it.boolean
Checks whether the container spans the full 2^16 range (ie, contains every short value) This is an O(1) operation in all container types (some do not cache cardinality).boolean
isEmpty()
Checks whether the container is empty or not.int
last()
Get the last integer held in the containerint
nextValue
(short fromValue) Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.not
(int rangeStart, int rangeEnd) Computes the bitwise NOT of this container (complement).or
(ArrayContainer x) Computes the bitwise OR of this container with another (union).Computes the bitwise OR of this container with another (union).or
(RunContainer x) Computes the bitwise OR of this container with another (union).boolean
boolean
boolean
boolean
overlapsRange
(int start, int end) int
rank
(short lowbits) Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).remove
(int begin, int end) Return a new container with all shorts in [begin,end) remove using an unsigned interpretation.Convert to RunContainers, when the result is smaller.short
select
(int j) Return the jth valueselect
(int startRank, int endRank) Returns a new container with all values between ranks startPos and endPos.void
selectRanges
(RangeConsumer outValues, RangeIterator inPositions) As select but for all the positions in a range.set
(short x) Return a new container with the short given as parameter added.void
boolean
boolean
boolean
Convert the current container to a BitmapContainer, if a conversion is needed.toString()
void
trim()
If possible, recover wasted memory.unset
(short x) Remove the short from this container.void
validate()
Computes the bitwise XOR of this container with another (symmetric difference).Computes the bitwise XOR of this container with another (symmetric difference).xor
(RunContainer x) Computes the bitwise XOR of this container with another (symmetric difference).Methods inherited from class io.deephaven.engine.rowset.impl.rsp.container.ImmutableContainer
cowRef, deepCopy, iadd, iand, iand, iand, iandNot, iandNot, iandNot, iandRange, iappend, inot, ior, ior, ior, iremove, iset, isShared, iunset, ixor, ixor, ixor
Methods inherited from class io.deephaven.engine.rowset.impl.rsp.container.Container
and, andNot, check, contains, empty, full, getContainerName, iand, iandNot, ifDebugValidate, intersects, intersects, ior, isFull, isSingleElement, ixor, numberOfRanges, or, overlaps, rangeOfOnes, remove, singleRange, singleton, subsetOf, twoRanges, twoValues, xor
-
Constructor Details
-
TwoValuesContainer
public TwoValuesContainer(short v1, short v2)
-
-
Method Details
-
add
Description copied from class:Container
Return a new container with all shorts in [begin,end) added using an unsigned interpretation. -
set
Description copied from class:Container
Return a new container with the short given as parameter added. -
and
Description copied from class:Container
Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected. -
and
Description copied from class:Container
Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected. -
and
Description copied from class:Container
Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected. -
andRange
Description copied from class:Container
Calculate the intersection of this container and a range, in a new container. The existing container is not modified. -
andNot
Description copied from class:Container
Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected. -
andNot
Description copied from class:Container
Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected. -
andNot
Description copied from class:Container
Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected. -
isEmpty
public boolean isEmpty()Description copied from class:Container
Checks whether the container is empty or not. -
isAllOnes
public boolean isAllOnes()Description copied from class:Container
Checks whether the container spans the full 2^16 range (ie, contains every short value) This is an O(1) operation in all container types (some do not cache cardinality). -
contains
public boolean contains(short x) Description copied from class:Container
Checks whether the contain contains the provided value -
contains
public boolean contains(int rangeStart, int rangeEnd) Description copied from class:Container
Checks whether the container contains the entire range -
contains
-
contains
-
contains
-
iflip
Description copied from class:Container
Add a short to the container if it is not present, otherwise remove it. May generate a new container. -
getCardinality
public int getCardinality()Description copied from class:Container
Computes the distinct number of short values in the container. Can be expected to run in constant time.- Specified by:
getCardinality
in classContainer
- Returns:
- the cardinality
-
forEach
Description copied from class:Container
Iterate through the values of this container in order and pass them along to the ShortConsumer. -
forEach
Description copied from class:Container
Like forEach, but skipping the first rankOffset elements. -
forEachRange
- Specified by:
forEachRange
in classContainer
-
getReverseShortIterator
Description copied from class:Container
Iterator to visit the short values in the container in descending order.- Specified by:
getReverseShortIterator
in classContainer
- Returns:
- iterator
-
getShortIterator
Description copied from class:Container
Iterator to visit the short values in the container in ascending order.- Specified by:
getShortIterator
in classContainer
- Returns:
- iterator
-
getShortBatchIterator
Description copied from class:Container
Gets an iterator to visit the contents of the container in batches of short values- Specified by:
getShortBatchIterator
in classContainer
- Parameters:
skipFromStartCount
- number of elements to skip from the start of the container.- Returns:
- iterator
-
getShortRangeIterator
Description copied from class:Container
Iterator to visit the short values in container in [start, end) ranges, in increasing order of start values.- Specified by:
getShortRangeIterator
in classContainer
- Returns:
- iterator
-
not
Description copied from class:Container
Computes the bitwise NOT of this container (complement). Only those bits within the range are affected. This is equivalent to an xor with a range of ones for the given range. The current container is left unaffected. -
or
Description copied from class:Container
Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected. -
or
Description copied from class:Container
Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected. -
or
Description copied from class:Container
Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected. -
rank
public int rank(short lowbits) Description copied from class:Container
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()). -
remove
Description copied from class:Container
Return a new container with all shorts in [begin,end) remove using an unsigned interpretation. -
unset
Description copied from class:Container
Remove the short from this container. May create a new container. -
runOptimize
Description copied from class:Container
Convert to RunContainers, when the result is smaller. Overridden by RunContainer to possibility switch from RunContainer to a smaller alternative. Overridden by BitmapContainer with a more efficient approach.- Specified by:
runOptimize
in classContainer
- Returns:
- the new container
-
select
public short select(int j) Description copied from class:Container
Return the jth value -
select
Description copied from class:Container
Returns a new container with all values between ranks startPos and endPos. -
find
public int find(short x) Description copied from class:Container
Searches for the specified short value- Specified by:
find
in classContainer
- Parameters:
x
- value to search for- Returns:
- Relative position of the value in the sorted set of elements in this container, in the range [0 ..
cardinality - 1]. If not present, (-(insertion point) - 1) similar to Array.binarySearch.
For values of x that
Container.contains(short)
returns true, this method returns the same value asContainer.rank(short)
.
-
selectRanges
Description copied from class:Container
As select but for all the positions in a range.- Specified by:
selectRanges
in classContainer
- Parameters:
outValues
- accept is called in this consumer for each resulting range.inPositions
- input iterator that provides the position ranges.
-
findRanges
Description copied from class:Container
As find but for all the values in a range.- Specified by:
findRanges
in classContainer
- Parameters:
outPositions
- accept is called in this consumer for each resulting position range.inValues
- input iterator that provides the key ranges; these must each exist in the container.maxPos
- maximum position to add to outPositions; values of position > maxPos are not added.- Returns:
- true if maxPos was reached, false otherwise.
-
trim
public void trim()Description copied from class:Container
If possible, recover wasted memory. -
xor
Description copied from class:Container
Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected. -
xor
Description copied from class:Container
Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected. -
xor
Description copied from class:Container
Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected. -
toBitmapContainer
Description copied from class:Container
Convert the current container to a BitmapContainer, if a conversion is needed. If the container is already a bitmap, the container is returned unchanged.When multiple container "merge" operations are done it might be more efficient to convert to bitmap first, and then at the end convert to the efficient container type, to avoid multiple container type conversions, since bitmap can always stay a bitmap.
- Specified by:
toBitmapContainer
in classContainer
- Returns:
- a bitmap container
-
nextValue
public int nextValue(short fromValue) Description copied from class:Container
Gets the first value greater than or equal to the lower bound, or -1 if no such value exists. -
first
public int first()Description copied from class:Container
Get the first integer held in the container -
last
public int last()Description copied from class:Container
Get the last integer held in the container -
subsetOf
-
subsetOf
-
subsetOf
-
overlaps
-
overlaps
-
overlaps
-
overlapsRange
public boolean overlapsRange(int start, int end) - Specified by:
overlapsRange
in classContainer
- Parameters:
start
- the beginning of the range, as an int.end
- the end of the range (exclusive), as an int.- Returns:
- true if there is any element in this container in the range provided.
-
setCopyOnWrite
public void setCopyOnWrite()- Specified by:
setCopyOnWrite
in classContainer
-
bytesAllocated
public int bytesAllocated()- Specified by:
bytesAllocated
in classContainer
- Returns:
- The allocated size in bytes of the underlying array backing store used by this container.
-
bytesUsed
public int bytesUsed() -
toString
-
toLargeContainer
-
validate
public void validate()
-