Package jisa.results
Class ResultTable
- java.lang.Object
-
- jisa.results.ResultTable
-
- All Implemented Interfaces:
java.lang.Iterable<Row>
- Direct Known Subclasses:
ResultList
,ResultStream
public abstract class ResultTable extends java.lang.Object implements java.lang.Iterable<Row>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ResultTable.ClearListener
static interface
ResultTable.Rowable
Interface for building a row by use of a RowSetterclass
ResultTable.RowBuilder
static interface
ResultTable.RowListener
class
ResultTable.RowSetter
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.lang.String,ResultList.ColumnBuilder>
STANDARD_TYPES
-
Constructor Summary
Constructors Constructor Description ResultTable(Column<?>... columns)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ResultTable.ClearListener
addClearListener(ResultTable.ClearListener listener)
void
addData(java.lang.Object... data)
Adds a new row to the table by specifying data in column order.void
addRow(ResultTable.Rowable rowable)
Adds a new row by using a lambda expression.void
addRow(Row row)
Add a new row to the table, by supplying a Row object.protected abstract void
addRowData(Row row)
Implementation method for storing a given Row of data.ResultTable.RowListener
addRowListener(ResultTable.RowListener listener)
boolean
allMatch(java.util.function.Predicate<Row> test)
Tests whether all rows in this table pass the given predicate.void
clear()
Clears this table of all data.protected abstract void
clearData()
Implementation method for clearing all data from the table.java.util.stream.Collector<Row,?,ResultList>
collector()
Returns a collector object for a stream sourced from this table, to collect its rows into a table with the same structure.java.util.List<ResultList>
directionalSplit(Column<? extends java.lang.Number> splitBy)
Splits this ResultTable into separate tables based on the direction of change of the specified column for each row.java.util.List<ResultList>
directionalSplit(RowEvaluable<? extends java.lang.Number> splitBy)
Splits this ResultTable into separate tables based on the direction of change of the specified expression for each row.ResultList
filter(java.util.function.Predicate<Row> test)
Returns a filtered copy of this ResultTable containing only the rows that pass the provided test expression.Column<? extends java.lang.Number>
findColumn(java.lang.String name)
Tries to find a numerical column in this ResultTable that matches the given name.<T> Column<T>
findColumn(java.lang.String name, java.lang.Class<T> type)
Tries to find the column in this ResultTable that matches the given name and type<T> Column<T>
findColumn(java.lang.String name, kotlin.reflect.KClass<T> type)
Tries to find the column in this ResultTable that matches the given name and type<T> Column<T>
findColumn(Column<T> column)
Tries to find the column in this ResultTable that matches the given column in name, units and typeRow
findRow(java.util.function.Predicate<Row> test)
Finds the first row that passes the given predicate.Row
get(int index)
Returns the row with the given index as a Row object.java.lang.String
getAttribute(java.lang.String key)
Retrieves the value identified by the given key in the table's header.protected java.lang.String
getAttributeLine()
Returns the attribute header line required for writing to file.java.util.Map<java.lang.String,java.lang.String>
getAttributes()
Returns a Key -> Value map of all attributes as Strings.Column<?>
getColumn(int index)
Returns the column with the given index as a Column object.int
getColumnCount()
Returns the number of columns in the table.protected java.lang.String
getColumnHeaderLine()
Returns the column header line required for writing to file.java.util.List<Column<?>>
getColumns()
Returns an unmodifiable list of all columns in this ResultTable.Column[]
getColumnsAsArray()
Returns an array of all columns in this ResultTable.protected java.lang.String
getCSVLine(Row row)
Returns the CSV line for the given row, as required for writing to file.Column<? extends java.lang.Number>
getFirstNumericColumn()
Returns the first column in this table that has a numerical data type.java.lang.String
getHTML()
Returns this table as an HTML String.Column<? extends java.lang.Number>
getNthNumericColumn(int n)
Returns the nth column in this table that has a numerical data type.java.util.List<Column<? extends java.lang.Number>>
getNumericColumns()
Returns a list of columns in this table that have a numerical data type.abstract Row
getRow(int index)
Returns the row with the given index as a Row object.abstract int
getRowCount()
Returns the number of rows in the table.java.util.List<Row>
getRows()
Returns all rows in this table as a List of Row objects.<T> java.util.List<T>
getUniqueValues(Column<T> column)
Returns a list of all unique values in the given column in this ResultTable.<T> java.util.List<T>
getUniqueValues(RowEvaluable<T> expression)
Returns a list of all unique values returned by the given expression applied to each row in this ResultTable.void
mapRow(java.util.Map.Entry<Column,java.lang.Object>... values)
Adds a new row based on Column -> Value mappings.void
mapRow(java.util.Map<Column<?>,java.lang.Object> data)
Adds a new row based on Column -> Value mappings.void
mapRow(kotlin.Pair<Column,java.lang.Object>... values)
Adds a new row based on Column -> Value mappings.void
mapRows(java.util.Map<Column,java.lang.Iterable> rows)
Adds multiple new rows based on Column -> Iterablemappings. void
mapRows(kotlin.Pair<Column,java.lang.Iterable>... rows)
Adds multiple new rows based on Column -> Iterablemappings. <T extends java.lang.Number>
Tmax(Column<T> column)
Returns the maximum value of the provided column in the table.<T extends java.lang.Number>
Tmax(RowEvaluable<T> expression)
Returns the maximum value of the provided expression when evaluated for each row.<T extends java.lang.Number>
RowmaxBy(Column<T> column)
Returns the row for which the given column has its maximum value.<T extends java.lang.Number>
RowmaxBy(RowEvaluable<T> expression)
Returns the row for which the given expression has its maximum value.double
mean(Column<? extends java.lang.Number> column)
Returns the mean value of the given column.double
mean(RowEvaluable<? extends java.lang.Number> expression)
Returns the mean value of the given expression evaluated across all rows.<T extends java.lang.Number>
Tmin(Column<T> column)
Returns the minimum value of the provided column in the table.<T extends java.lang.Number>
Tmin(RowEvaluable<T> expression)
Returns the minimum value of the provided expression when evaluated for each row.<T extends java.lang.Number>
RowminBy(Column<T> column)
Returns the row for which the given column has its minimum value.<T extends java.lang.Number>
RowminBy(RowEvaluable<T> expression)
Returns the row for which the given expression has its minimum value.boolean
noneMatch(java.util.function.Predicate<Row> test)
Tests whether no rows in this table pass the given predicate.void
output()
Outputs this table in CSV format to the standard output stream.void
output(java.io.PrintStream out)
Outputs this table in CSV format to the given output (print) stream.void
output(java.lang.String file)
Outputs this table in CSV format to the specified file.void
outputHTML()
Outputs this table as an HTML table node, to the standard output stream.void
outputHTML(java.io.PrintStream stream)
Outputs this table as an HTML table node, to the given output (print) stream.void
outputHTML(java.lang.String file)
Outputs this table as an HTML table node, to the specified file.void
outputTable()
Outputs this table as a terminal-friendly ASCII table, to the standard output stream.void
outputTable(java.io.PrintStream stream)
Outputs this table as a terminal-friendly ASCII table, to the given output (print) stream.void
outputTable(java.io.PrintStream stream, java.lang.String formatter)
Outputs this table as a terminal-friendly ASCII table, to the given output (print) stream, using the given format specifier for all columns.void
outputTable(java.lang.String path)
Outputs this table as a terminal-friendly ASCII table, to the specified file.static Column[]
parseColumnHeaderLine(java.lang.String header)
protected Row
parseCSVLine(java.lang.String line)
Parses a CSV-formatted line and converts it into a Row object, as required when reading from file.void
removeClearListener(ResultTable.ClearListener listener)
void
removeRowListener(ResultTable.RowListener listener)
ResultList
reverse()
Returns a copy of this table with its rows in reverse order.void
setAttribute(java.lang.String key, java.lang.Object value)
Stores the given value in this table's header, using the specified key to identify it.void
setAttribute(java.lang.String key, java.lang.String value)
Stores the given value in this table's header, using the specified key to identify it.int
size()
Returns the number of rows in the table.ResultList
sorted(Column<?> byColumn)
Returns a copy of this ResultTable, sorted by the specified column.ResultList
sorted(RowEvaluable<?> expression)
Returns a copy of this ResultTable, sorted by the provided expression evaluated for each row.<T> java.util.Map<T,ResultList>
split(Column<T> splitBy)
Splits this ResultTable into separate tables based on the value of the specified column for each row.<T> java.util.Map<T,ResultList>
split(RowEvaluable<T> splitBy)
Splits this ResultTable into separate tables based on the value given by the specified expression for each row.ResultTable.RowBuilder
startRow()
Starts a row-building chain call.abstract java.util.stream.Stream<Row>
stream()
Returns a sequential Stream of Row objects with this table as its sourceResultList
subTable(int start, int to)
Returns a copy of this table with only the specified range of rows present.ResultList
subTable(int start, int to, Column... columns)
Returns a copy of this table with only the specified range of rows and columns present.ResultList
subTable(Column... columns)
Returns a copy of this table with only the specified columns present.<T> java.util.List<T>
toList(Column<T> column)
Returns all values in the given column in a List.<T> java.util.List<T>
toList(RowEvaluable<T> expression)
Returns all values returned by the supplied expression on each row as a List.RealMatrix
toMatrix(Column<? extends java.lang.Number>... columns)
Returns a Matrix of the given numerical columns.RealMatrix
toMatrix(RowEvaluable<? extends java.lang.Number>... expressions)
Returns a Matrix of the given expressions.ResultList
transform(java.util.Map<Column<?>,RowEvaluable<?>> mappings)
Performs a multi-column mapping operation, returning a new ResultList of the results (with only the columns that have mappings specified).
-
-
-
Field Detail
-
STANDARD_TYPES
public static final java.util.Map<java.lang.String,ResultList.ColumnBuilder> STANDARD_TYPES
-
-
Constructor Detail
-
ResultTable
public ResultTable(Column<?>... columns)
-
-
Method Detail
-
parseColumnHeaderLine
public static Column[] parseColumnHeaderLine(java.lang.String header)
-
addRowListener
public ResultTable.RowListener addRowListener(ResultTable.RowListener listener)
-
removeRowListener
public void removeRowListener(ResultTable.RowListener listener)
-
addClearListener
public ResultTable.ClearListener addClearListener(ResultTable.ClearListener listener)
-
removeClearListener
public void removeClearListener(ResultTable.ClearListener listener)
-
getColumn
public Column<?> getColumn(int index)
Returns the column with the given index as a Column object.- Parameters:
index
- Column index- Returns:
- Column object
-
getColumns
public java.util.List<Column<?>> getColumns()
Returns an unmodifiable list of all columns in this ResultTable.- Returns:
- Unmodifiable list of columns
-
getNumericColumns
public java.util.List<Column<? extends java.lang.Number>> getNumericColumns()
Returns a list of columns in this table that have a numerical data type.- Returns:
- List of all numeric columns in table
-
getFirstNumericColumn
public Column<? extends java.lang.Number> getFirstNumericColumn()
Returns the first column in this table that has a numerical data type.- Returns:
- First numerical column, null if none
-
getNthNumericColumn
public Column<? extends java.lang.Number> getNthNumericColumn(int n)
Returns the nth column in this table that has a numerical data type.- Parameters:
n
- Index of column- Returns:
- nth numerical column, null if none
-
getColumnsAsArray
public Column[] getColumnsAsArray()
Returns an array of all columns in this ResultTable.- Returns:
- Array of columns
-
findColumn
public <T> Column<T> findColumn(Column<T> column)
Tries to find the column in this ResultTable that matches the given column in name, units and type- Type Parameters:
T
- Data type of Column object- Parameters:
column
- Column to match- Returns:
- Matching column if found, otherwise null
-
findColumn
public <T> Column<T> findColumn(java.lang.String name, java.lang.Class<T> type)
Tries to find the column in this ResultTable that matches the given name and type- Type Parameters:
T
- Data type of Column object- Parameters:
name
- Name to matchtype
- Data type class of the column to match- Returns:
- Matching column if found, otherwise null
-
findColumn
public <T> Column<T> findColumn(java.lang.String name, kotlin.reflect.KClass<T> type)
Tries to find the column in this ResultTable that matches the given name and type- Type Parameters:
T
- Data type of Column object- Parameters:
name
- Name to matchtype
- Data type class of the column to match- Returns:
- Matching column if found, otherwise null
-
findColumn
public Column<? extends java.lang.Number> findColumn(java.lang.String name)
Tries to find a numerical column in this ResultTable that matches the given name.- Parameters:
name
- Name to match- Returns:
- Matching column if found, otherwise null
-
toList
public <T> java.util.List<T> toList(RowEvaluable<T> expression)
Returns all values returned by the supplied expression on each row as a List.- Type Parameters:
T
- Data type of column- Parameters:
expression
- Expression to pass each row through- Returns:
- Expression values, as a list
-
toList
public <T> java.util.List<T> toList(Column<T> column)
Returns all values in the given column in a List.- Type Parameters:
T
- Data type of column- Parameters:
column
- Column to extract- Returns:
- Column values, as a list
-
getUniqueValues
public <T> java.util.List<T> getUniqueValues(RowEvaluable<T> expression)
Returns a list of all unique values returned by the given expression applied to each row in this ResultTable.- Type Parameters:
T
- Data type returned by expression- Parameters:
expression
- Expression to evaluate on each row- Returns:
- Unique values, as a List
-
getUniqueValues
public <T> java.util.List<T> getUniqueValues(Column<T> column)
Returns a list of all unique values in the given column in this ResultTable.- Type Parameters:
T
- Data type returned by expression- Parameters:
column
- Column to check- Returns:
- Unique values, as a List
-
split
public <T> java.util.Map<T,ResultList> split(RowEvaluable<T> splitBy)
Splits this ResultTable into separate tables based on the value given by the specified expression for each row.- Type Parameters:
T
- Data type of expression- Parameters:
splitBy
- Expression to split by- Returns:
- Mapping of unique values of expression to sub-tables
-
split
public <T> java.util.Map<T,ResultList> split(Column<T> splitBy)
Splits this ResultTable into separate tables based on the value of the specified column for each row.- Type Parameters:
T
- Data type of column- Parameters:
splitBy
- Column to split by- Returns:
- Mapping of unique values of column to sub-tables
-
directionalSplit
public java.util.List<ResultList> directionalSplit(RowEvaluable<? extends java.lang.Number> splitBy)
Splits this ResultTable into separate tables based on the direction of change of the specified expression for each row.- Parameters:
splitBy
- Expression to split by- Returns:
- List of resulting tables, in alternating order of direction
-
directionalSplit
public java.util.List<ResultList> directionalSplit(Column<? extends java.lang.Number> splitBy)
Splits this ResultTable into separate tables based on the direction of change of the specified column for each row.- Parameters:
splitBy
- Column to split by- Returns:
- List of resulting tables, in alternating order of direction
-
filter
public ResultList filter(java.util.function.Predicate<Row> test)
Returns a filtered copy of this ResultTable containing only the rows that pass the provided test expression.- Parameters:
test
- Test expression- Returns:
- Filtered table
-
sorted
public ResultList sorted(RowEvaluable<?> expression)
Returns a copy of this ResultTable, sorted by the provided expression evaluated for each row.- Parameters:
expression
- Expression to sort by- Returns:
- Sorted table
-
sorted
public ResultList sorted(Column<?> byColumn)
Returns a copy of this ResultTable, sorted by the specified column.- Parameters:
byColumn
- Column to sort by- Returns:
- Sorted table
-
transform
public ResultList transform(java.util.Map<Column<?>,RowEvaluable<?>> mappings)
Performs a multi-column mapping operation, returning a new ResultList of the results (with only the columns that have mappings specified).- Parameters:
mappings
- Map of column mappings- Returns:
- Transformed table
-
subTable
public ResultList subTable(Column... columns)
Returns a copy of this table with only the specified columns present.- Parameters:
columns
- Columns to copy- Returns:
- Copied sub-table
-
subTable
public ResultList subTable(int start, int to)
Returns a copy of this table with only the specified range of rows present.- Parameters:
start
- Index to start atto
- Index to end at- Returns:
- Copied sub-table
-
subTable
public ResultList subTable(int start, int to, Column... columns)
Returns a copy of this table with only the specified range of rows and columns present.- Parameters:
start
- Index to start atto
- Index to end atcolumns
- Columns to copy- Returns:
- Copied sub-table
-
reverse
public ResultList reverse()
Returns a copy of this table with its rows in reverse order.- Returns:
- Reversed table
-
getRows
public java.util.List<Row> getRows()
Returns all rows in this table as a List of Row objects.- Returns:
- List of all rows
-
findRow
public Row findRow(java.util.function.Predicate<Row> test)
Finds the first row that passes the given predicate.- Parameters:
test
- Predicate to test each row with- Returns:
- First matching row
-
mean
public double mean(RowEvaluable<? extends java.lang.Number> expression)
Returns the mean value of the given expression evaluated across all rows.- Parameters:
expression
- Expression to take the mean of- Returns:
- Mean value
-
mean
public double mean(Column<? extends java.lang.Number> column)
Returns the mean value of the given column.- Parameters:
column
- Column to take the mean of- Returns:
- Mean value
-
min
public <T extends java.lang.Number> T min(RowEvaluable<T> expression)
Returns the minimum value of the provided expression when evaluated for each row.- Type Parameters:
T
- Data type- Parameters:
expression
- Expression to find minimum of- Returns:
- Min value
-
min
public <T extends java.lang.Number> T min(Column<T> column)
Returns the minimum value of the provided column in the table.- Type Parameters:
T
- Data type- Parameters:
column
- Column to find minimum of- Returns:
- Min value
-
max
public <T extends java.lang.Number> T max(RowEvaluable<T> expression)
Returns the maximum value of the provided expression when evaluated for each row.- Type Parameters:
T
- Data type- Parameters:
expression
- Expression to find maximum of- Returns:
- Max value
-
max
public <T extends java.lang.Number> T max(Column<T> column)
Returns the maximum value of the provided column in the table.- Type Parameters:
T
- Data type- Parameters:
column
- Column to find maximum of- Returns:
- Max value
-
maxBy
public <T extends java.lang.Number> Row maxBy(RowEvaluable<T> expression)
Returns the row for which the given expression has its maximum value.- Type Parameters:
T
- Data type- Parameters:
expression
- Expression to evaluate- Returns:
- Max row
-
maxBy
public <T extends java.lang.Number> Row maxBy(Column<T> column)
Returns the row for which the given column has its maximum value.- Type Parameters:
T
- Data type- Parameters:
column
- Column to maximise- Returns:
- Max row
-
minBy
public <T extends java.lang.Number> Row minBy(RowEvaluable<T> expression)
Returns the row for which the given expression has its minimum value.- Type Parameters:
T
- Data type- Parameters:
expression
- Expression to evaluate- Returns:
- Min row
-
minBy
public <T extends java.lang.Number> Row minBy(Column<T> column)
Returns the row for which the given column has its minimum value.- Type Parameters:
T
- Data type- Parameters:
column
- Column to minimise- Returns:
- Min row
-
allMatch
public boolean allMatch(java.util.function.Predicate<Row> test)
Tests whether all rows in this table pass the given predicate.- Parameters:
test
- Predicate to test each row with- Returns:
- Do all rows pass?
-
noneMatch
public boolean noneMatch(java.util.function.Predicate<Row> test)
Tests whether no rows in this table pass the given predicate.- Parameters:
test
- Predicate to test each row with- Returns:
- Do no rows pass?
-
toMatrix
public RealMatrix toMatrix(Column<? extends java.lang.Number>... columns)
Returns a Matrix of the given numerical columns.- Parameters:
columns
- Columns to use- Returns:
- Matrix
-
toMatrix
public RealMatrix toMatrix(RowEvaluable<? extends java.lang.Number>... expressions)
Returns a Matrix of the given expressions.- Parameters:
expressions
- Expressions to use for each column- Returns:
- Matrix
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.Object value)
Stores the given value in this table's header, using the specified key to identify it.- Parameters:
key
- Key (unique identifier of attribute)value
- Attribute value
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.String value)
Stores the given value in this table's header, using the specified key to identify it.- Parameters:
key
- Key (unique identifier of attribute)value
- Attribute value
-
getAttribute
public java.lang.String getAttribute(java.lang.String key)
Retrieves the value identified by the given key in the table's header.- Parameters:
key
- Key (unique identifier of attribute)- Returns:
- Attribute value
-
getAttributes
public java.util.Map<java.lang.String,java.lang.String> getAttributes()
Returns a Key -> Value map of all attributes as Strings.- Returns:
- Map of all attributes
-
getRow
public abstract Row getRow(int index)
Returns the row with the given index as a Row object.- Parameters:
index
- Row index- Returns:
- Row object for given index
-
get
public Row get(int index)
Returns the row with the given index as a Row object. Alias for getRow(...).- Parameters:
index
- Row index- Returns:
- Row object for given index
-
addRowData
protected abstract void addRowData(Row row)
Implementation method for storing a given Row of data.- Parameters:
row
- Row to store
-
addRow
public void addRow(Row row)
Add a new row to the table, by supplying a Row object.- Parameters:
row
- Row to add
-
clearData
protected abstract void clearData()
Implementation method for clearing all data from the table.
-
clear
public void clear()
Clears this table of all data.
-
getRowCount
public abstract int getRowCount()
Returns the number of rows in the table.- Returns:
- Number of rows
-
size
public int size()
Returns the number of rows in the table. Alias of getRowCount().- Returns:
- Number of rows
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Returns:
- Numnber of columns
-
addData
public void addData(java.lang.Object... data)
Adds a new row to the table by specifying data in column order.- Parameters:
data
- Values to add, in column order
-
output
public void output()
Outputs this table in CSV format to the standard output stream.
-
output
public void output(java.lang.String file) throws java.io.IOException
Outputs this table in CSV format to the specified file.- Parameters:
file
- Path to file- Throws:
java.io.IOException
- Upon error opening/writing file
-
getAttributeLine
protected java.lang.String getAttributeLine()
Returns the attribute header line required for writing to file.- Returns:
- Attribute header line
-
getColumnHeaderLine
protected java.lang.String getColumnHeaderLine()
Returns the column header line required for writing to file.- Returns:
- Column header line
-
getCSVLine
protected java.lang.String getCSVLine(Row row)
Returns the CSV line for the given row, as required for writing to file.- Parameters:
row
- Row to CSV-ify- Returns:
- CSV line
-
parseCSVLine
protected Row parseCSVLine(java.lang.String line)
Parses a CSV-formatted line and converts it into a Row object, as required when reading from file.- Parameters:
line
- Line to parse- Returns:
- Parsed Row object
-
output
public void output(java.io.PrintStream out)
Outputs this table in CSV format to the given output (print) stream.- Parameters:
out
- Output PrintStream
-
outputTable
public void outputTable(java.io.PrintStream stream, java.lang.String formatter)
Outputs this table as a terminal-friendly ASCII table, to the given output (print) stream, using the given format specifier for all columns.- Parameters:
stream
- Output stream to write toformatter
- Format specifier
-
outputTable
public void outputTable(java.io.PrintStream stream)
Outputs this table as a terminal-friendly ASCII table, to the given output (print) stream.- Parameters:
stream
- Output stream to write to
-
outputTable
public void outputTable()
Outputs this table as a terminal-friendly ASCII table, to the standard output stream.
-
outputTable
public void outputTable(java.lang.String path) throws java.io.FileNotFoundException
Outputs this table as a terminal-friendly ASCII table, to the specified file.- Parameters:
path
- Path to file- Throws:
java.io.FileNotFoundException
-
outputHTML
public void outputHTML(java.io.PrintStream stream)
Outputs this table as an HTML table node, to the given output (print) stream.- Parameters:
stream
- Output stream to write to
-
outputHTML
public void outputHTML()
Outputs this table as an HTML table node, to the standard output stream.
-
outputHTML
public void outputHTML(java.lang.String file) throws java.io.FileNotFoundException
Outputs this table as an HTML table node, to the specified file.- Parameters:
file
- Path to file- Throws:
java.io.FileNotFoundException
-
getHTML
public java.lang.String getHTML()
Returns this table as an HTML String.- Returns:
- HTML table
-
startRow
public ResultTable.RowBuilder startRow()
Starts a row-building chain call.- Returns:
- RowBuilder object
-
addRow
public void addRow(ResultTable.Rowable rowable) throws java.lang.Exception
Adds a new row by using a lambda expression.- Parameters:
rowable
- Lambda expression to set each column- Throws:
java.lang.Exception
- Forwarded exceptions from lambda
-
mapRow
public void mapRow(java.util.Map<Column<?>,java.lang.Object> data)
Adds a new row based on Column -> Value mappings.- Parameters:
data
- Map of data to add
-
mapRow
public void mapRow(java.util.Map.Entry<Column,java.lang.Object>... values)
Adds a new row based on Column -> Value mappings.- Parameters:
values
- Map entries of data to add
-
mapRow
public void mapRow(kotlin.Pair<Column,java.lang.Object>... values)
Adds a new row based on Column -> Value mappings.- Parameters:
values
- Map entries of data to add
-
mapRows
public void mapRows(java.util.Map<Column,java.lang.Iterable> rows)
Adds multiple new rows based on Column -> Iterablemappings. Each map entry should be of a column mapped to an iterable collection of values to add in that column. - Parameters:
rows
- Map of columns
-
mapRows
public void mapRows(kotlin.Pair<Column,java.lang.Iterable>... rows)
Adds multiple new rows based on Column -> Iterablemappings. Each map entry should be of a column mapped to an iterable collection of values to add in that column. - Parameters:
rows
- Map entries of columns
-
stream
public abstract java.util.stream.Stream<Row> stream()
Returns a sequential Stream of Row objects with this table as its source- Returns:
- Stream of rows
-
collector
public java.util.stream.Collector<Row,?,ResultList> collector()
Returns a collector object for a stream sourced from this table, to collect its rows into a table with the same structure.- Returns:
- Collector of ResultTable rows
-
-