Package tech.tablesaw.table
Class TableSliceGroup
- java.lang.Object
-
- tech.tablesaw.table.TableSliceGroup
-
- All Implemented Interfaces:
Iterable<TableSlice>
- Direct Known Subclasses:
SelectionTableSliceGroup
,StandardTableSliceGroup
public abstract class TableSliceGroup extends Object implements Iterable<TableSlice>
A group of virtual tables (table slices) formed by performing splitting operations on an original table See:TableSlice
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
SPLIT_STRING
A string that is used internally as a delimiter in creating a column name from all the grouping columns
-
Constructor Summary
Constructors Modifier Constructor Description protected
TableSliceGroup(Table original)
Returns an instance for calculating a single summary for the given table, with no sub-groupingsprotected
TableSliceGroup(Table sourceTable, String[] groupColumnNames)
Returns an instance for calculating subgroups, one for each combination of the given groupColumnNames that appear in the source table
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSlice(TableSlice slice)
Add a slice to this groupTable
aggregate(com.google.common.collect.ListMultimap<String,AggregateFunction<?,?>> functions)
Applies the given aggregations to the given columns.Table
aggregate(String colName1, AggregateFunction<?,?>... functions)
Applies the given aggregation to the given column.static String
aggregateColumnName(String columnName, String functionName)
Returns a column name for aggregated data based on the given source column name and functionList<Table>
asTableList()
Returns a list of Tables created by reifying my list of slices (views) over the original tableTableSlice
get(int i)
Returns the ith slice in this groupprotected int
getByteSize(List<Column<?>> columns)
Returns the sum of the sizes for the columns in the givenColumn
listList<TableSlice>
getSlices()
Returns the slices as a listTable
getSourceTable()
Returns the table behind this slice groupprotected String[]
getSplitColumnNames()
Returns the names of the columns the backing table was split on.Iterator<TableSlice>
iterator()
Returns an iterator over elements of typeT
.protected void
setSourceTable(Table sourceTable)
Sets the source table that backs this TableSliceGroupint
size()
Returns the number of slicesstatic Table
summaryTableName(Table source)
Returns the name of a summary table made by aggregating on the slices in this group-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
SPLIT_STRING
protected static final String SPLIT_STRING
A string that is used internally as a delimiter in creating a column name from all the grouping columns- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TableSliceGroup
protected TableSliceGroup(Table original)
Returns an instance for calculating a single summary for the given table, with no sub-groupings
-
-
Method Detail
-
getSplitColumnNames
protected String[] getSplitColumnNames()
Returns the names of the columns the backing table was split on.
-
getByteSize
protected int getByteSize(List<Column<?>> columns)
Returns the sum of the sizes for the columns in the givenColumn
list
-
addSlice
protected void addSlice(TableSlice slice)
Add a slice to this group
-
getSlices
public List<TableSlice> getSlices()
Returns the slices as a list
-
get
public TableSlice get(int i)
Returns the ith slice in this group
-
getSourceTable
public Table getSourceTable()
Returns the table behind this slice group
-
size
public int size()
Returns the number of slices
-
aggregate
public Table aggregate(String colName1, AggregateFunction<?,?>... functions)
Applies the given aggregation to the given column. The apply and combine steps of a split-apply-combine.
-
aggregate
public Table aggregate(com.google.common.collect.ListMultimap<String,AggregateFunction<?,?>> functions)
Applies the given aggregations to the given columns. The apply and combine steps of a split-apply-combine.- Parameters:
functions
- map from column name to aggregation to apply on that function
-
summaryTableName
public static Table summaryTableName(Table source)
Returns the name of a summary table made by aggregating on the slices in this group
-
iterator
public Iterator<TableSlice> iterator()
Returns an iterator over elements of typeT
.- Specified by:
iterator
in interfaceIterable<TableSlice>
- Returns:
- an Iterator.
-
aggregateColumnName
public static String aggregateColumnName(String columnName, String functionName)
Returns a column name for aggregated data based on the given source column name and function
-
asTableList
public List<Table> asTableList()
Returns a list of Tables created by reifying my list of slices (views) over the original table
-
setSourceTable
protected void setSourceTable(Table sourceTable)
Sets the source table that backs this TableSliceGroup
-
-