Class AbstractTable

java.lang.Object
org.cloudsimplus.builders.tables.AbstractTable
All Implemented Interfaces:
Table
Direct Known Subclasses:
CsvTable, HtmlTable, LatexTable

public abstract class AbstractTable extends Object implements Table
An abstract base class for implementing data tables to present simulation results.
Author:
Manoel Campos da Silva Filho
  • Constructor Details

    • AbstractTable

      public AbstractTable()
    • AbstractTable

      public AbstractTable(String title)
      Creates a Table
      Parameters:
      title - Title of the table
  • Method Details

    • colCount

      public int colCount()
      Description copied from interface: Table
      Returns the number of columns.
      Specified by:
      colCount in interface Table
      Returns:
      the number of columns
    • setTitle

      public final Table setTitle(@NonNull @NonNull String title)
      Description copied from interface: Table
      Returns the table instance.
      Specified by:
      setTitle in interface Table
      Parameters:
      title - the table title to set
      Returns:
      the table instance
    • setColumnSeparator

      public final Table setColumnSeparator(@NonNull @NonNull String columnSeparator)
      Description copied from interface: Table
      Sets the string used to separate one column from another. It's optional to set a column separator.
      Specified by:
      setColumnSeparator in interface Table
      Parameters:
      columnSeparator - the separator
      Returns:
      this table instance
    • getRows

      protected List<List<Object>> getRows()
      Returns the data to be printed., where each row contains a list of columns data.
      Returns:
      the data to be printed
    • newRow

      public List<Object> newRow()
      Description copied from interface: Table
      Adds a new empty row to the list of rows, so that data can be added to the row further.
      Specified by:
      newRow in interface Table
      Returns:
      the new empty row
    • print

      public void print()
      Description copied from interface: Table
      Prints the table.
      Specified by:
      print in interface Table
    • printColumnHeaders

      protected void printColumnHeaders()
    • printTableOpening

      protected abstract void printTableOpening()
      Prints the string to open the table.
    • printTitle

      protected abstract void printTitle()
      Prints the table title.
    • rowOpening

      protected abstract String rowOpening()
      Returns the string that has to precede each printed row.
      Returns:
      the string that has to precede each printed row
    • rowClosing

      protected abstract String rowClosing()
      Returns the string to close a row.
      Returns:
      the string to close a row
    • subtitleHeaderOpening

      protected abstract String subtitleHeaderOpening()
      Returns the string that has to precede the subtitle head.
      Returns:
      the string that has to precede the subtitle head
    • printTableClosing

      protected abstract void printTableClosing()
      Prints the string to close the table.
    • addColumnList

      public final Table addColumnList(String... columnTitles)
      Description copied from interface: Table
      Adds a list of columns (with given titles) to the end of the table's columns to be printed, where the column data will be printed without a specific format.
      Specified by:
      addColumnList in interface Table
      Parameters:
      columnTitles - The titles of the columns
      Returns:
      the Table instance.
      See Also:
    • newColumn

      public final TableColumn newColumn(String title, String subTitle)
      Description copied from interface: Table
      Creates a column with a given title and subtitle. The created column is not added to the table.
      Specified by:
      newColumn in interface Table
      Parameters:
      title - The title of the column to be added.
      subTitle - The subtitle of the column to be added.
      Returns:
      the created column
      See Also:
    • newColumn

      public final TableColumn newColumn(String title)
      Description copied from interface: Table
      Creates a column with a given title. The created column is not added to the table.
      Specified by:
      newColumn in interface Table
      Parameters:
      title - The title of the column to create.
      Returns:
      The created column
      See Also:
    • addColumn

      protected final TableColumn addColumn(TableColumn column)
      Adds a column to the end of the table.
      Parameters:
      column - the column to add
      Returns:
      this table instance
    • addColumn

      protected final TableColumn addColumn(TableColumn column, int index)
      Adds a column at a given position of the table.
      Parameters:
      column - the column to add
      index - the position in the table to add the column
      Returns:
      this table instance