Class DefaultAnonymousTable
java.lang.Object
jmri.jmrit.logixng.implementation.DefaultAnonymousTable
- All Implemented Interfaces:
AnonymousTable,Table
Default implementation for anonymous tables
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.jmrit.logixng.Table
Table.ColumnNotFoundException, Table.CsvType, Table.RowNotFoundException -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAnonymousTable(int numRows, int numColumns) DefaultAnonymousTable(Object[][] data) Create a new anonymous table with an existing array of cells. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteColumn(int col) voiddeleteRow(int row) getCell(int row, int column) Get the value of a cell.intgetColumnNumber(String columnName) Get the row number by name of row.intgetRowNumber(String rowName) Get the row number by name of row.voidinsertColumn(int col) voidinsertRow(int row) intGet the number of columns in the table.intnumRows()Get the number of rows in the table.voidGet the value of a cell.voidstoreTableAsCSV(File file) Store the table to a CSV file.voidstoreTableAsCSV(File file, String systemName, String userName) Store the table to a CSV file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.jmrit.logixng.Table
getCell, getCell, getCell, getCsvType, isCsvTypeSupported, setCell, setCell, setCsvType
-
Constructor Details
-
DefaultAnonymousTable
-
DefaultAnonymousTable
Create a new anonymous table with an existing array of cells. Row 0 has the column names and column 0 has the row names.- Parameters:
data- the data in the table. Note that this data is not copied to an new array but used by the table as is.
-
-
Method Details
-
storeTableAsCSV
Store the table to a CSV file.- Specified by:
storeTableAsCSVin interfaceTable- Parameters:
file- the CSV file- Throws:
FileNotFoundException- if file not found
-
storeTableAsCSV
public void storeTableAsCSV(@Nonnull File file, @CheckForNull String systemName, @CheckForNull String userName) throws FileNotFoundException Store the table to a CSV file. If system name and/or user name is not null, these values are used instead of the tables own system name and user name. If no system name and user name is given and the table is anonymous, no system name and user name is stored in the file.- Specified by:
storeTableAsCSVin interfaceTable- Parameters:
file- the CSV filesystemName- the system name of the tableuserName- the user name of the table- Throws:
FileNotFoundException- if file not found
-
getCell
Get the value of a cell. -
setCell
Get the value of a cell. -
numRows
Get the number of rows in the table. -
numColumns
Get the number of columns in the table.- Specified by:
numColumnsin interfaceTable- Returns:
- the number of columns
-
getRowNumber
Get the row number by name of row.- Specified by:
getRowNumberin interfaceTable- Parameters:
rowName- the name of the row. If there is no row with this name, and rowName is a positive integer, that row number will be returned.- Returns:
- the row number
-
getColumnNumber
Get the row number by name of row.- Specified by:
getColumnNumberin interfaceTable- Parameters:
columnName- the name of the column. If there is no column with this name, and columnName is a positive integer, that column number will be returned.- Returns:
- the column number
-
insertColumn
- Specified by:
insertColumnin interfaceAnonymousTable
-
deleteColumn
- Specified by:
deleteColumnin interfaceAnonymousTable
-
insertRow
- Specified by:
insertRowin interfaceAnonymousTable
-
deleteRow
- Specified by:
deleteRowin interfaceAnonymousTable
-