Iterable<Selection>
, Comparator<Selection>
, CategoricalColumn<Boolean>
, BooleanFillers<BooleanColumn>
, BooleanFilters
, BooleanMapUtils
, Column<Selection>
, BooleanFilterSpec<Selection>
, FilterSpec<Selection>
public class BooleanColumn extends AbstractColumn<BooleanColumn,Boolean> implements BooleanFilterSpec<Selection>, BooleanMapUtils, CategoricalColumn<Boolean>, BooleanFillers<BooleanColumn>, BooleanFilters
Modifier and Type | Field | Description |
---|---|---|
protected it.unimi.dsi.fastutil.bytes.ByteArrayList |
data |
The data held by this column
|
DEFAULT_ARRAY_SIZE
Modifier and Type | Method | Description |
---|---|---|
boolean |
all() |
Returns true if the column contains only true values, and false otherwise.
|
boolean |
any() |
Returns true if the column contains any true values, and false otherwise
|
BooleanColumn |
append(boolean b) |
Appends b to the end of this column and returns this column
|
BooleanColumn |
append(byte b) |
Appends b to the end of this column and returns this column
|
BooleanColumn |
append(Boolean b) |
Appends value to the bottom of this column and return this column
|
BooleanColumn |
append(Column<Boolean> column) |
Appends all the values in the argument to the bottom of this column and return this column
|
Column<Boolean> |
append(Column<Boolean> column,
int row) |
Appends the value at the given row in the given column to the bottom of this column and return
this column
|
BooleanColumn |
appendCell(String object) |
Add one element to the bottom of this column and set its value to the parsed value of the given
String.
|
BooleanColumn |
appendCell(String object,
AbstractColumnParser<?> parser) |
Add one element to the bottom of this column and set its value to the parsed value of the given
String, as performed by the given parser
|
BooleanColumn |
appendMissing() |
Appends a missing value appropriate to the column
|
BooleanColumn |
appendObj(Object obj) |
Appends the given value to the bottom of this column and return this column
|
byte[] |
asBytes(int row) |
Returns the contents of the cell at rowNumber as a byte[].
|
double[] |
asDoubleArray() |
Returns all the values in this column as an array of doubles, with true values encoded as 1.0
and false values as 0.0
|
DoubleColumn |
asDoubleColumn() |
Returns a DoubleColumn containing the elements in this column, with true as 1.0 and false as
0.0.
|
Boolean[] |
asObjectArray() |
Returns an array of objects as appropriate for my type of column
|
Selection |
asSelection() |
|
it.unimi.dsi.fastutil.booleans.BooleanSet |
asSet() |
Returns the values in this column as a BooleanSet instance
|
it.unimi.dsi.fastutil.bytes.ByteIterator |
byteIterator() |
Returns a ByteIterator for this column
|
int |
byteSize() |
Returns the width of a cell in this column, in bytes.
|
void |
clear() |
Removes all elements TODO: Make this return this column
|
int |
compare(Boolean o1,
Boolean o2) |
|
boolean |
contains(boolean aBoolean) |
Returns true if the column contains at least one value like
aBoolean |
BooleanColumn |
copy() |
Returns a deep copy of the receiver
|
int |
countFalse() |
Returns the number of
false elements in this column |
int |
countMissing() |
Returns the count of missing values in this column
|
int |
countTrue() |
Returns the number of
true elements in this column |
int |
countUnique() |
Returns the count of unique values in this column.
|
static BooleanColumn |
create(String name) |
Returns a new, empty Boolean column with the given name.
|
static BooleanColumn |
create(String name,
boolean... values) |
Returns a new Boolean column with the given name and values
|
static BooleanColumn |
create(String name,
int initialSize) |
Returns a new Boolean column of the given size.
|
static BooleanColumn |
create(String name,
Boolean[] values) |
Returns a new Boolean column with the given name and values
|
static BooleanColumn |
create(String name,
Collection<Boolean> values) |
Returns a new Boolean column with the given name and values
|
static BooleanColumn |
create(String name,
Stream<Boolean> values) |
Returns a new Boolean column with the given name and values
|
static BooleanColumn |
create(String name,
Selection hits,
int columnSize) |
Returns a new Boolean column of the given size.
|
it.unimi.dsi.fastutil.bytes.ByteArrayList |
data() |
Returns a ByteArrayList containing 0 (false), 1 (true) or Byte.MIN_VALUE (missing)
|
BooleanColumn |
emptyCopy() |
Returns a copy of the receiver with no data.
|
BooleanColumn |
emptyCopy(int rowSize) |
Returns an empty copy of the receiver, with its internal storage initialized to the given row
size.
|
boolean |
equals(int rowNumber1,
int rowNumber2) |
Returns true if the value in this column at rowNumber1 is equal to the value at rowNumber2
|
Selection |
eval(BiPredicate<Boolean,Boolean> predicate,
Boolean valueToCompare) |
Returns a Selection of the elements that return true when the predicate is evaluated with the
given Boolean argument
|
Selection |
eval(Predicate<Boolean> predicate) |
Returns a Selection of the elements that return true when the predicate is evaluated
|
Selection |
eval(BytePredicate predicate) |
Returns a Selection of the elements that return true when the predicate is evaluated
|
BooleanColumn |
fillWith(it.unimi.dsi.fastutil.booleans.BooleanIterable iterable) |
|
BooleanColumn |
fillWith(it.unimi.dsi.fastutil.booleans.BooleanIterator iterator) |
|
BooleanColumn |
fillWith(Supplier<Boolean> supplier) |
|
Boolean |
get(int i) |
Returns the value in row i as a Boolean
|
byte |
getByte(int i) |
Returns the value in row i as a byte (0, 1, or Byte.MIN_VALUE representing missing data)
|
double |
getDouble(int row) |
Returns the value at row as a double, with true values encoded as 1.0 and false values as 0.0
|
BooleanFormatter |
getPrintFormatter() |
Returns the print formatter for this column
|
String |
getString(int row) |
Returns a string representation of the value at the given row.
|
String |
getUnformattedString(int row) |
Returns a String representation of the value at index r, without any formatting applied
|
boolean |
isEmpty() |
Returns true if the column has no data
|
Selection |
isEqualTo(BooleanColumn other) |
|
Selection |
isFalse() |
|
Selection |
isMissing() |
Returns a selection containing an index for every missing value in this column
|
boolean |
isMissing(int rowNumber) |
Returns true if the value at rowNumber is missing
|
Selection |
isNotMissing() |
Returns a selection containing an index for every non-missing value in this column
|
Selection |
isTrue() |
|
Iterator<Boolean> |
iterator() |
|
BooleanColumn |
lag(int n) |
Returns a column of the same type and size as the receiver, containing the receivers values
offset by n.
|
BooleanColumn |
lead(int n) |
Returns a column of the same type as the receiver, containing the receivers values offset -n
For example if you lead a column containing 2, 3, 4 by 1, you get a column containing 3, 4, NA.
|
boolean |
none() |
Returns true if the column contains no true values, and false otherwise
|
double |
proportionFalse() |
Returns the proportion of non-missing row elements that contain true
|
double |
proportionTrue() |
Returns the proportion of non-missing row elements that contain true
|
BooleanColumn |
removeMissing() |
Returns a copy of this column with the missing values removed
|
it.unimi.dsi.fastutil.ints.IntComparator |
rowComparator() |
Returns an IntComparator for sorting my rows
|
BooleanColumn |
set(int i,
boolean b) |
Sets the value at i to b, and returns this column
|
BooleanColumn |
set(int i,
Boolean val) |
Sets the value at index row to the given value and return this column
|
BooleanColumn |
set(int row,
String stringValue,
AbstractColumnParser<?> parser) |
Sets the value at row to the parsed value of the given String using the given parser and
returns this column
|
Column<Boolean> |
set(int row,
Column<Boolean> column,
int sourceRow) |
Sets the value at row to the value at sourceRow in the given column and return this column
|
BooleanColumn |
set(Selection rowSelection,
boolean newValue) |
Conditionally update this column, replacing current values with newValue for all rows where the
current value matches the selection criteria
|
BooleanColumn |
set(Selection rowSelection,
byte newValue) |
Conditionally update this column, replacing current values with newValue for all rows where the
current value matches the selection criteria.
|
BooleanColumn |
setMissing(int i) |
Sets the value at index i to the missing-value indicator for this column type, and return this
column
|
void |
setPrintFormatter(BooleanFormatter formatter) |
Sets the print formatter for this column
|
int |
size() |
Returns the number of elements in this column, including missing values
|
void |
sortAscending() |
Sorts my values in ascending order
|
void |
sortDescending() |
Sorts my values in descending order
|
Table |
summary() |
Returns a table containing a ColumnType specific summary of the data in this column
|
BooleanColumn |
unique() |
Returns a column of the same type containing only the unique values
|
int |
valueHash(int rowNumber) |
Returns an int suitable as a hash for the value in this column at the given index
|
static boolean |
valueIsMissing(byte b) |
Returns
true if b is the missing value indicator for this column type |
BooleanColumn |
where(Selection selection) |
Returns a new column containing the subset referenced by the
Selection |
asStringColumn, filter, first, indexOf, inRange, last, map, max, min, name, parser, sampleN, sampleX, set, set, setName, setParser, sorted, subset, toString, type
and, andNot, or
countByCategory
allMatch, anyMatch, asList, asStringColumn, columnWidth, contains, count, count, filter, first, indexOf, inRange, interpolate, last, map, map, mapInto, max, max, min, min, name, noneMatch, parser, print, reduce, reduce, rolling, sampleN, sampleX, set, set, set, setMissingTo, setName, setParser, sorted, subset, title, type
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
protected it.unimi.dsi.fastutil.bytes.ByteArrayList data
public static boolean valueIsMissing(byte b)
true
if b is the missing value indicator for this column typepublic boolean isMissing(int rowNumber)
public BooleanColumn setMissing(int i)
setMissing
in interface Column<Selection>
public static BooleanColumn create(String name, Selection hits, int columnSize)
name
- The column namehits
- The true valuescolumnSize
- The column sizepublic static BooleanColumn create(String name)
name
- The column namepublic static BooleanColumn create(String name, int initialSize)
name
- The column nameinitialSize
- The column sizepublic static BooleanColumn create(String name, boolean... values)
public static BooleanColumn create(String name, Collection<Boolean> values)
public static BooleanColumn create(String name, Boolean[] values)
public static BooleanColumn create(String name, Stream<Boolean> values)
public void setPrintFormatter(BooleanFormatter formatter)
public BooleanFormatter getPrintFormatter()
public int size()
public Table summary()
public int countMissing()
countMissing
in interface Column<Selection>
public int countUnique()
countUnique
in interface Column<Selection>
public BooleanColumn unique()
public BooleanColumn append(boolean b)
public BooleanColumn append(Boolean b)
public BooleanColumn appendObj(Object obj)
public BooleanColumn append(byte b)
public BooleanColumn appendMissing()
appendMissing
in interface Column<Selection>
public int valueHash(int rowNumber)
public boolean equals(int rowNumber1, int rowNumber2)
public String getString(int row)
public String getUnformattedString(int row)
getUnformattedString
in interface Column<Selection>
public BooleanColumn emptyCopy()
emptyCopy
in interface Column<Selection>
emptyCopy
in class AbstractColumn<BooleanColumn,Boolean>
Column
public BooleanColumn emptyCopy(int rowSize)
public void clear()
public BooleanColumn copy()
public void sortAscending()
sortAscending
in interface Column<Selection>
public void sortDescending()
sortDescending
in interface Column<Selection>
public BooleanColumn appendCell(String object)
appendCell
in interface Column<Selection>
public BooleanColumn appendCell(String object, AbstractColumnParser<?> parser)
appendCell
in interface Column<Selection>
public Boolean get(int i)
public byte getByte(int i)
i
- the row numberpublic boolean isEmpty()
public int countTrue()
true
elements in this columnpublic int countFalse()
false
elements in this columnpublic double proportionTrue()
public double proportionFalse()
public boolean any()
public boolean all()
public boolean none()
public Selection isFalse()
isFalse
in interface BooleanFilters
isFalse
in interface BooleanFilterSpec<Selection>
public Selection isTrue()
isTrue
in interface BooleanFilters
isTrue
in interface BooleanFilterSpec<Selection>
public Selection isEqualTo(BooleanColumn other)
isEqualTo
in interface BooleanFilters
isEqualTo
in interface BooleanFilterSpec<Selection>
public it.unimi.dsi.fastutil.bytes.ByteArrayList data()
public BooleanColumn set(int i, boolean b)
public BooleanColumn set(int i, Boolean val)
public BooleanColumn set(int row, String stringValue, AbstractColumnParser<?> parser)
public BooleanColumn lead(int n)
public BooleanColumn lag(int n)
For example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3
public BooleanColumn set(Selection rowSelection, boolean newValue)
public BooleanColumn set(Selection rowSelection, byte newValue)
rowSelection
- the rows to be updatednewValue
- a byte representation of boolean values. The only valid arguments are 0, 1, and
{@link BooleanColumnType:missingValueIndicator()}public double getDouble(int row)
public double[] asDoubleArray()
public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
rowComparator
in interface Column<Selection>
public BooleanColumn append(Column<Boolean> column)
public Column<Boolean> append(Column<Boolean> column, int row)
public Column<Boolean> set(int row, Column<Boolean> column, int sourceRow)
public Selection asSelection()
asSelection
in interface BooleanMapUtils
public Selection isMissing()
isMissing
in interface BooleanFilters
isMissing
in interface Column<Selection>
isMissing
in interface FilterSpec<Selection>
public Selection isNotMissing()
isNotMissing
in interface BooleanFilters
isNotMissing
in interface Column<Selection>
isNotMissing
in interface FilterSpec<Selection>
public it.unimi.dsi.fastutil.bytes.ByteIterator byteIterator()
public it.unimi.dsi.fastutil.booleans.BooleanSet asSet()
public boolean contains(boolean aBoolean)
aBoolean
public int byteSize()
public byte[] asBytes(int row)
public BooleanColumn where(Selection selection)
Selection
public BooleanColumn removeMissing()
removeMissing
in interface Column<Selection>
public Selection eval(BytePredicate predicate)
public Selection eval(Predicate<Boolean> predicate)
public Selection eval(BiPredicate<Boolean,Boolean> predicate, Boolean valueToCompare)
public DoubleColumn asDoubleColumn()
public int compare(Boolean o1, Boolean o2)
compare
in interface Comparator<Selection>
public BooleanColumn fillWith(it.unimi.dsi.fastutil.booleans.BooleanIterator iterator)
fillWith
in interface BooleanFillers<BooleanColumn>
public BooleanColumn fillWith(it.unimi.dsi.fastutil.booleans.BooleanIterable iterable)
fillWith
in interface BooleanFillers<BooleanColumn>
public BooleanColumn fillWith(Supplier<Boolean> supplier)
fillWith
in interface BooleanFillers<BooleanColumn>
public Boolean[] asObjectArray()
asObjectArray
in interface Column<Selection>
Copyright © 2022. All rights reserved.