Class DefaultAnonymousTable

java.lang.Object
jmri.jmrit.logixng.implementation.DefaultAnonymousTable
All Implemented Interfaces:
AnonymousTable, Table

public class DefaultAnonymousTable extends Object implements AnonymousTable
Default implementation for anonymous tables
  • Constructor Details

    • DefaultAnonymousTable

      public DefaultAnonymousTable(int numRows, int numColumns)
    • 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:
      storeTableAsCSV in interface Table
      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:
      storeTableAsCSV in interface Table
      Parameters:
      file - the CSV file
      systemName - the system name of the table
      userName - the user name of the table
      Throws:
      FileNotFoundException - if file not found
    • getCell

      public Object getCell(int row, int column)
      Get the value of a cell.
      Specified by:
      getCell in interface Table
      Parameters:
      row - the row of the cell
      column - the column of the cell
      Returns:
      the value of the cell
    • setCell

      public void setCell(Object value, int row, int column)
      Get the value of a cell.
      Specified by:
      setCell in interface Table
      Parameters:
      value - the new value of the cell
      row - the row of the cell
      column - the column of the cell
    • numRows

      public int numRows()
      Get the number of rows in the table.
      Specified by:
      numRows in interface Table
      Returns:
      the number of rows
    • numColumns

      public int numColumns()
      Get the number of columns in the table.
      Specified by:
      numColumns in interface Table
      Returns:
      the number of columns
    • getRowNumber

      public int getRowNumber(String rowName)
      Get the row number by name of row.
      Specified by:
      getRowNumber in interface Table
      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

      public int getColumnNumber(String columnName)
      Get the row number by name of row.
      Specified by:
      getColumnNumber in interface Table
      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

      public void insertColumn(int col)
      Specified by:
      insertColumn in interface AnonymousTable
    • deleteColumn

      public void deleteColumn(int col)
      Specified by:
      deleteColumn in interface AnonymousTable
    • insertRow

      public void insertRow(int row)
      Specified by:
      insertRow in interface AnonymousTable
    • deleteRow

      public void deleteRow(int row)
      Specified by:
      deleteRow in interface AnonymousTable