Package tech.tablesaw.columns.booleans
Interface BooleanData
-
- All Known Implementing Classes:
BitSetBooleanData
public interface BooleanData extends it.unimi.dsi.fastutil.bytes.ByteIterable
A container for boolean data
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(byte booleanValue)
Adds a boolean value represented as a byte, where 0=false, 1=true, and -1=missingSelection
asSelection()
Returns a selection matching all the true values in the datavoid
clear()
Removes all data valuesboolean
contains(byte b)
Returns true if the value at b is true.BooleanData
copy()
Returns a copy of this BooleanData objectint
countFalse()
Returns the number of false values in the data *int
countMissing()
Returns the number of missing values in the data *int
countTrue()
Returns the number of true values in the data *int
countUnique()
Returns the number of unique values in the data.byte[]
falseBytes()
Returns a byte representation of the true values, encoded in the format specified inBitSet.toByteArray()
byte
getByte(int i)
Returns the value at i as a byte, where -1 represents missing valuesboolean
isEmpty()
Returns true if the data is empty, and false otherwise.Selection
isFalse()
Returns a selection matching all the false values in the dataSelection
isMissing()
Returns a selection matching all the missing values in the dataSelection
isTrue()
Returns a selection matching all the true values in the databyte[]
missingBytes()
Returns a byte representation of the missing values, encoded in the format specified inBitSet.toByteArray()
void
set(int i, byte b)
Sets the value at position i to byte bvoid
setFalseBytes(byte[] bytes)
Sets the false values in the data from a byte[] encodingvoid
setMissingBytes(byte[] bytes)
Sets the missing values in the data from a byte[] encodingvoid
setTrueBytes(byte[] bytes)
Sets the true values in the data from a byte[] encodingint
size()
Returns the number of values in the data, including missing valuesvoid
sortAscending()
Sorts the data in-place in ascending order, with missing values firstvoid
sortDescending()
Sorts the data in-place in descending order, with missing values lastbyte[]
toByteArray()
Returns the data as a byte[] containing 0 and 1, with any missing values encoded as -128it.unimi.dsi.fastutil.bytes.ByteArrayList
toByteArrayList()
Returns the data as a ByteArrayList containing 0 and 1, with any missing values encoded as -128byte[]
trueBytes()
Returns a byte representation of the false values, encoded in the format specified inBitSet.toByteArray()
-
-
-
Method Detail
-
size
int size()
Returns the number of values in the data, including missing values
-
add
void add(byte booleanValue)
Adds a boolean value represented as a byte, where 0=false, 1=true, and -1=missing
-
clear
void clear()
Removes all data values
-
copy
BooleanData copy()
Returns a copy of this BooleanData object
-
getByte
byte getByte(int i)
Returns the value at i as a byte, where -1 represents missing values
-
countFalse
int countFalse()
Returns the number of false values in the data *
-
countTrue
int countTrue()
Returns the number of true values in the data *
-
countMissing
int countMissing()
Returns the number of missing values in the data *
-
countUnique
int countUnique()
Returns the number of unique values in the data. There can only be 3 (true, false, and missing) *
-
sortAscending
void sortAscending()
Sorts the data in-place in ascending order, with missing values first
-
sortDescending
void sortDescending()
Sorts the data in-place in descending order, with missing values last
-
toByteArray
byte[] toByteArray()
Returns the data as a byte[] containing 0 and 1, with any missing values encoded as -128
-
toByteArrayList
it.unimi.dsi.fastutil.bytes.ByteArrayList toByteArrayList()
Returns the data as a ByteArrayList containing 0 and 1, with any missing values encoded as -128
-
set
void set(int i, byte b)
Sets the value at position i to byte b- Parameters:
i
- the 0-based index of the element in the datab
- the value to set, should be 0, 1, or -128 only
-
isEmpty
boolean isEmpty()
Returns true if the data is empty, and false otherwise. Empty here means only missing values
-
contains
boolean contains(byte b)
Returns true if the value at b is true.
-
asSelection
Selection asSelection()
Returns a selection matching all the true values in the data
-
isFalse
Selection isFalse()
Returns a selection matching all the false values in the data
-
isTrue
Selection isTrue()
Returns a selection matching all the true values in the data
-
isMissing
Selection isMissing()
Returns a selection matching all the missing values in the data
-
falseBytes
byte[] falseBytes()
Returns a byte representation of the true values, encoded in the format specified inBitSet.toByteArray()
-
trueBytes
byte[] trueBytes()
Returns a byte representation of the false values, encoded in the format specified inBitSet.toByteArray()
-
missingBytes
byte[] missingBytes()
Returns a byte representation of the missing values, encoded in the format specified inBitSet.toByteArray()
-
setTrueBytes
void setTrueBytes(byte[] bytes)
Sets the true values in the data from a byte[] encoding- Parameters:
bytes
- The true values encoded in the format specified inBitSet
-
setFalseBytes
void setFalseBytes(byte[] bytes)
Sets the false values in the data from a byte[] encoding- Parameters:
bytes
- The false values encoded in the format specified inBitSet
-
setMissingBytes
void setMissingBytes(byte[] bytes)
Sets the missing values in the data from a byte[] encoding- Parameters:
bytes
- The missing values encoded in the format specified inBitSet
-
-