Interface VECTOR.SparseBooleanArray
- All Superinterfaces:
VECTOR.SparseArray
- Enclosing class:
- VECTOR
A boolean-valued representation of SPARSE VECTOR data in Oracle Database. This interface is optimized for conversions of the BINARY dimension type, but can also be used in conversions of the FLOAT64, FLOAT32, and INT8 types.
Unlike its sibling SparseArray subclasses, a SparseBooleanArray does not
have a values() method. The values of a SparseBooleanArray are
implicitly derived from its VECTOR.SparseArray.indices(). All non-zero valued indices
have the value of true, and all zero-valued indices have the
value of false.
- Since:
- 23.9
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic VECTOR.SparseBooleanArrayfromDenseArray(boolean[] denseArray) Creates a SparseBooleanArray that stores only the non-zero (true) values of a boolean array.static VECTOR.SparseBooleanArrayfromPackedBits(byte[] denseArray) Creates a SparseBooleanArray that stores only the indices oftrue(non-zero) bit within a byte array.static VECTOR.SparseBooleanArrayof(int length, int[] indices) Creates a SparseBooleanArray of the given length and indices.Methods inherited from interface oracle.sql.VECTOR.SparseArray
indices, length, toString
-
Method Details
-
of
Creates a SparseBooleanArray of the given length and indices. The SparseBooleanArray retains a reference to the array of indices which is passed to this method. After this method returns, changing the values of the array will also change the values retained by the SparseBooleanArray.
This method will only perform lightweight validations on the input. It will not validate the order or range of values in the indices array. These more extensive validations will occur when the SparseBooleanArray is set as a parameter in SQL executed by Oracle Database.
- Parameters:
length- Total length of the SparseBooleanArray, including indices with the value offalse(zero).indices- Indices oftrue(non-zero) values, ordered from least to greatest, in the range of 0 (inclusive) and the givenlength(exclusive). Not null.- Returns:
- A SparseBooleanArray of the given length and indices. Not null.
- Throws:
NullPointerException- If the indices are null.IllegalArgumentException- If the length is less than 0, or the indices have a length greater than 65535.
-
fromPackedBits
Creates a SparseBooleanArray that stores only the indices oftrue(non-zero) bit within a byte array. The bit values are unpacked from each byte in MSB order, such that the byte's highest bit is stored at a lower index within the SparseBooleanArray. TheVECTOR.SparseArray.length()of the SparseBooleanArray is the length of the byte[] multiplied by 8.- Parameters:
denseArray- Array of bytes, where each bit represents one value: Either atrue(one) orfalse(zero). Not null.- Returns:
- A sparse array storing only the indices of
true(non-zero) values of the dense array. Not null. - Throws:
NullPointerException- If the denseArray is null.
-
fromDenseArray
Creates a SparseBooleanArray that stores only the non-zero (true) values of a boolean array.- Parameters:
denseArray- Array of boolean values, including zeros (false). Not null.- Returns:
- A sparse array storing only the non-zero (true) values of the dense array. Not null.
- Throws:
NullPointerException- If the denseArray is null.
-