Package app.babylon.table.column
Interface Column
- All Known Subinterfaces:
ColumnBoolean,ColumnByte,ColumnCategorical<T>,ColumnDouble,ColumnInt,ColumnLong,ColumnObject<T>
- All Known Implementing Classes:
ColumnBoolean.Renamed,ColumnByte.Renamed,ColumnCategorical.Renamed,ColumnDouble.Renamed,ColumnInt.Renamed,ColumnLong.Renamed,ColumnObject.Renamed
public interface Column
Base contract for a named column of tabular data, including size, null-state,
comparison, projection, and row-level access operations.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds an immutable column instance for a specific column name.static interfacestatic enumstatic interfaceDescribes the runtime value type stored by a column. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanallRowsMatch(Column column, RowPredicate include) default voidappendTo(int i, StringBuilder out, ToStringSettings settings) Appends the value at the supplied row using the provided rendering settings.intcompare(int i, int j) Compares two row values from this column using the column's ordering semantics.copy(ColumnName x) Creates a copy of this column with the supplied column name.copy(ColumnName x, RowPredicate include) Creates a copy of this column with the supplied column name, only retaining rows included by the supplied row predicate.default longcount()Returns the number of rows that contain a value.default Column.KeyedValuegetKeyedValue(int i) getName()Returns the logical column name.getType()Returns the declared type of values stored in this column.booleanisAllSet()Indicates whether every row in the column contains a value.booleanIndicates whether the column represents the same value for every row.Unset values are part of the value pattern, so an all-unset column is constant, while a mix of unset and set values is not constant unless the implementation explicitly defines that pattern as constant.default booleanisEmpty()Indicates whether the column has no set values, either because it has no rows or because every row is unset.booleanIndicates whether no row in the column contains a value.booleanisSet(int i) Indicates whether the value at the supplied row is present.default Column.KeyedValuepredicate(Column.Operator operator, CharSequence... values) Creates a row predicate by parsing the supplied comparison values according to this column's type.default RowPredicatepredicate(ComparisonCondition condition) selectRow(int i) Returns a single-row column containing the value from the supplied row.intsize()Returns the number of rows in the column.toString(int i) Formats the value at the supplied row for display.default StringtoString(int i, ToStringSettings settings) Formats the value at the supplied row using the provided rendering settings.Returns a projected view of this column using the supplied row mapping.
-
Method Details
-
getType
Column.Type getType()Returns the declared type of values stored in this column.- Returns:
- the column value type
-
size
int size()Returns the number of rows in the column.- Returns:
- the row count
-
getName
ColumnName getName()Returns the logical column name.- Returns:
- the column name
-
isSet
boolean isSet(int i) Indicates whether the value at the supplied row is present.- Parameters:
i- the zero-based row index- Returns:
truewhen the row contains a value
-
getKeyedValue
-
firstKeyed
-
lastKeyed
-
isAllSet
boolean isAllSet()Indicates whether every row in the column contains a value.- Returns:
truewhen all rows are set
-
isNoneSet
boolean isNoneSet()Indicates whether no row in the column contains a value.- Returns:
truewhen every row is unset
-
count
default long count()Returns the number of rows that contain a value.- Returns:
- count of set rows
-
isEmpty
default boolean isEmpty()Indicates whether the column has no set values, either because it has no rows or because every row is unset.- Returns:
truewhen the column is effectively empty
-
isConstant
boolean isConstant()Indicates whether the column represents the same value for every row.Unset values are part of the value pattern, so an all-unset column is constant, while a mix of unset and set values is not constant unless the implementation explicitly defines that pattern as constant.- Returns:
truewhen the column is constant
-
toString
Formats the value at the supplied row for display.- Parameters:
i- the zero-based row index- Returns:
- the formatted row value, or an empty string when unset
-
toString
Formats the value at the supplied row using the provided rendering settings.- Parameters:
i- the zero-based row indexsettings- formatting settings to apply- Returns:
- the formatted row value
-
appendTo
Appends the value at the supplied row using the provided rendering settings.- Parameters:
i- the zero-based row indexout- the destination buffersettings- formatting settings to apply
-
compare
int compare(int i, int j) Compares two row values from this column using the column's ordering semantics.- Parameters:
i- the first row indexj- the second row index- Returns:
- a negative number, zero, or a positive number as the first row is less than, equal to, or greater than the second
-
view
Returns a projected view of this column using the supplied row mapping.- Parameters:
rowIndex- the row mapping to apply- Returns:
- a column view over the selected rows
-
copy
Creates a copy of this column with the supplied column name.- Parameters:
x- the name to assign to the copy- Returns:
- a column containing the same values under the new name
-
copy
Creates a copy of this column with the supplied column name, only retaining rows included by the supplied row predicate.- Parameters:
x- the name to assign to the copyinclude- row predicate indicating which source rows to copy- Returns:
- a column containing copied values for included rows and unset values elsewhere
-
selectRow
Returns a single-row column containing the value from the supplied row.- Parameters:
i- the row to extract- Returns:
- a single-row column with the same column name
-
predicate
Creates a row predicate by parsing the supplied comparison values according to this column's type.- Parameters:
operator- comparison operatorvalues- comparison values as text- Returns:
- predicate evaluated by row index
-
allRowsMatch
-
predicate
-