Package jslx
Class TablesawUtil
- java.lang.Object
-
- jslx.TablesawUtil
-
public class TablesawUtil extends java.lang.Object
The purpose of this class is to facilitate interaction with Tablesaw. It provides some minimal ability to read a database table into a Tablesaw Table, read an Excel sheet into a Table, and to write a Table to an Excel sheet.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
LOGGER
-
Constructor Summary
Constructors Constructor Description TablesawUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]
getColumnSizes(tech.tablesaw.api.Table table)
static int
getMaxColumnSize(tech.tablesaw.api.Table table)
static java.util.Map<java.lang.String,tech.tablesaw.api.Table>
makeJSLDatabaseViewTables(JSLDatabase db)
Returns a map that holds Tablesaw table representations of all of the JSLDatabase views.static tech.tablesaw.api.Table
makeTable(ReplicationDataCollector dataCollector)
Makes a Tablesaw Table that has columns representing each response that was added to the ReplicationDataCollector.static tech.tablesaw.api.Table
makeTable(DatabaseIfc db, java.lang.String tableName)
Makes a Tablesaw table based on the data within the table of the database.static tech.tablesaw.api.Table
makeTable(JSLDatabase db, java.lang.String tableName)
Makes a Tablesaw table based on the data within the table of the JSLDatabase.static tech.tablesaw.api.Table
makeTable(TabularInputFile tabularInputFile)
Makes a Tablesaw table based on the data within the tabular file.
-
-
-
Method Detail
-
makeTable
public static tech.tablesaw.api.Table makeTable(ReplicationDataCollector dataCollector)
Makes a Tablesaw Table that has columns representing each response that was added to the ReplicationDataCollector. The values of the columns represent the within replication final average in the case of a ResponseVariable or TimeWeightedVariable for all replications. In the case of a Counter is the final value of the counter for all replications. Each row is a replication, with the first row being the first replication, etc.- Parameters:
dataCollector
- a replication data collector, must not be null- Returns:
- the created Tablesaw Table
-
makeTable
public static tech.tablesaw.api.Table makeTable(DatabaseIfc db, java.lang.String tableName)
Makes a Tablesaw table based on the data within the table of the database. If the table is not contained in the database an empty Table is returned (no columns). If there is an exception or other issue accessing the data in the table, then an empty Table is returned (no columns). In either case a warning message is logged. Any exceptions are squelched.- Parameters:
db
- the database that holds the table, must not be nulltableName
- the name of the table in the database, must not null- Returns:
- the Tablesaw Table
-
makeTable
public static tech.tablesaw.api.Table makeTable(TabularInputFile tabularInputFile)
Makes a Tablesaw table based on the data within the tabular file. If there is an exception or other issue accessing the data in the table, then an empty Table is returned (no columns). In either case a warning message is logged. Any exceptions are squelched.- Parameters:
tabularInputFile
- the tabular file to convert, must not be null- Returns:
- the Tablesaw table
-
makeTable
public static tech.tablesaw.api.Table makeTable(JSLDatabase db, java.lang.String tableName)
Makes a Tablesaw table based on the data within the table of the JSLDatabase. If the table is not contained in the database an empty Table is returned (no columns). If there is an exception or other issue accessing the data in the table, then an empty Table is returned (no columns). In either case a warning message is logged. Any exceptions are squelched.- Parameters:
db
- the JSLDatabase that holds the table, must not be nulltableName
- the name of the table in the database, must not null- Returns:
- the Tablesaw Table
-
makeJSLDatabaseViewTables
public static java.util.Map<java.lang.String,tech.tablesaw.api.Table> makeJSLDatabaseViewTables(JSLDatabase db)
Returns a map that holds Tablesaw table representations of all of the JSLDatabase views. These tables can be used for post processing data associated with one or more simulation runs that were stored within the JSLDatabase- Parameters:
db
- an instance of a JSLDatabase- Returns:
- the map
-
getColumnSizes
public static int[] getColumnSizes(tech.tablesaw.api.Table table)
- Parameters:
table
- the Tablesaw Table, must not be null- Returns:
- the sizes of all of the columns of the table (i.e. the number of elements in each column) as an array
-
getMaxColumnSize
public static int getMaxColumnSize(tech.tablesaw.api.Table table)
- Parameters:
table
- the Tablesaw Table, must not be null- Returns:
- the size of the column that has the most elements
-
-