Interface Table

All Known Subinterfaces:
AnonymousTable, NamedTable
All Known Implementing Classes:
AbstractNamedTable, DefaultAnonymousTable, DefaultCsvNamedTable, DefaultInternalNamedTable

public interface Table
Represent a Table. A table is a two dimensional array where the rows and columns may have names.
  • Method Details

    • getCell

      @CheckReturnValue default Object getCell(int row)
      Get the value of a cell. If the table has both rows and columns, the value of the first column will be returned.
      Parameters:
      row - the row of the cell or null if all rows should be returned
      Returns:
      the value of the cell
    • getCell

      @CheckReturnValue Object getCell(int row, int column)
      Get the value of a cell.
      Parameters:
      row - the row of the cell
      column - the column of the cell
      Returns:
      the value of the cell
    • getCell

      Get the value of a cell. If the table has both rows and columns, the value of the first column will be returned.
      Parameters:
      row - the row of the cell or null if all rows should be returned
      Returns:
      the value of the cell
      Throws:
      Table.RowNotFoundException - if the row is not found
    • getCell

      Get the value of a cell.
      Parameters:
      row - the row of the cell. If this string is a name of a row, that row is used. If it's not a name of a row, but an integer value, that index is used, where row 0 is the name of the row.
      column - the column of the cell. If this string is a name of a column, that column is used. If it's not a name of a column, but an integer value, that index is used, where column 0 is the name of the column.
      Returns:
      the value of the cell
      Throws:
      Table.RowNotFoundException - if the row is not found
      Table.ColumnNotFoundException - if the column is not found
    • setCell

      @CheckReturnValue void setCell(Object value, int row, int column)
      Get the value of a cell.
      Parameters:
      value - the new value of the cell
      row - the row of the cell
      column - the column of the cell
    • setCell

      default void setCell(Object value, String row) throws Table.RowNotFoundException
      Set the value of a cell. If the table has both rows and columns, the value of the first column will be returned.
      Parameters:
      value - the new value of the cell
      row - the row of the cell
      Throws:
      Table.RowNotFoundException - if the row is not found
    • setCell

      Set the value of a cell.
      Parameters:
      value - the new value of the cell
      row - the row of the cell. If this string is a name of a row, that row is used. If it's not a name of a row, but an integer value, that index is used, where row 0 is the name of the row.
      column - the column of the cell. If this string is a name of a column, that column is used. If it's not a name of a column, but an integer value, that index is used, where column 0 is the name of the column.
      Throws:
      Table.RowNotFoundException - if the row is not found
      Table.ColumnNotFoundException - if the column is not found
    • numRows

      int numRows()
      Get the number of rows in the table.
      Returns:
      the number of rows
    • numColumns

      int numColumns()
      Get the number of columns in the table.
      Returns:
      the number of columns
    • getRowNumber

      Get the row number by name of row.
      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
      Throws:
      Table.RowNotFoundException - if the row is not found
    • getColumnNumber

      Get the row number by name of row.
      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
      Throws:
      Table.ColumnNotFoundException - if the column is not found
    • isCsvTypeSupported

      default boolean isCsvTypeSupported()
    • setCsvType

      default void setCsvType(Table.CsvType csvType)
    • getCsvType

    • storeTableAsCSV

      Store the table to a CSV file using the filename given when loading the CSV file.
      Throws:
      FileNotFoundException - if file not found
    • storeTableAsCSV

      Store the table to a CSV file.
      Parameters:
      file - the CSV file
      Throws:
      FileNotFoundException - if file not found
    • storeTableAsCSV

      void storeTableAsCSV(@Nonnull File file, boolean storeSystemUserName) throws FileNotFoundException
      Store the table to a CSV file.
      Parameters:
      file - the CSV file
      storeSystemUserName - true if to store system name and user name in the file, false otherwise
      Throws:
      FileNotFoundException - if file not found
    • storeTableAsCSV

      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.
      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
    • storeTableAsCSV

      void storeTableAsCSV(@Nonnull File file, @CheckForNull String systemName, @CheckForNull String userName, boolean storeSystemUserName) 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.
      Parameters:
      file - the CSV file
      systemName - the system name of the table
      userName - the user name of the table
      storeSystemUserName - true if to store system name and user name in the file, false otherwise
      Throws:
      FileNotFoundException - if file not found