Class TableBuilderAbstract<T>

java.lang.Object
org.cloudsimplus.builders.tables.TableBuilderAbstract<T>
Direct Known Subclasses:
CloudletsTableBuilder, HostHistoryTableBuilder

public abstract class TableBuilderAbstract<T>
extends Object
An abstract class to build tables to print data from a list of objects containing simulation results.
Since:
CloudSim Plus 2.3.2
Author:
Manoel Campos da Silva Filho
  • Constructor Details

    • TableBuilderAbstract

      public TableBuilderAbstract​(List<? extends T> list)
      Instantiates a builder to print the list of objects T using the a default TextTable. To use a different Table, check the alternative constructors.
      Parameters:
      list - the list of objects T to print
    • TableBuilderAbstract

      public TableBuilderAbstract​(List<? extends T> list, Table table)
      Instantiates a builder to print the list of objects T using the a given Table.
      Parameters:
      list - the list of objects T to print
      table - the Table used to build the table with the object data
  • Method Details

    • setObjectList

      protected final TableBuilderAbstract<T> setObjectList​(List<? extends T> list)
      Sets a List of objects T to be printed.
      Parameters:
      list - List of objects T to set
      Returns:
    • setTitle

      public TableBuilderAbstract<T> setTitle​(String title)
    • getTable

      protected Table getTable()
    • column

      public final TableBuilderAbstract<T> column​(int index, Consumer<TableColumn> consumer)
      Access a column at a given position in order to perform some configuration on it.
      Parameters:
      index - index of the column to access
      consumer - a Consumer that will be called to use the column accessed at the requested position. The consumer should provide the code you want to be performed over that column.
      Returns:
      this TableBuilder object
    • setTable

      protected final TableBuilderAbstract<T> setTable​(Table table)
      Sets the Table used to build the table with Cloudlet Data. The default table builder is TextTable.
      Parameters:
      table - the Table to set
      Returns:
    • addColumn

      public TableBuilderAbstract<T> addColumn​(TableColumn col, Function<T,​Object> dataFunction)
      Dynamically adds a column to the end of the table to be built.
      Parameters:
      col - the column to add
      dataFunction - a function that receives a Cloudlet and returns the data to be printed for the added column
      Returns:
    • removeColumn

      public final TableBuilderAbstract<T> removeColumn​(int... indexes)
      Removes columns from given positions.
      Parameters:
      indexes - the indexes of the columns to remove
      Returns:
      See Also:
      removeColumn(int)
    • removeColumn

      public final TableBuilderAbstract<T> removeColumn​(int index)
      Removes a column from a given position.
      Parameters:
      index - the index of the column to remove
      Returns:
      See Also:
      removeColumn(int...)
    • addColumn

      public TableBuilderAbstract<T> addColumn​(int index, TableColumn col, Function<T,​Object> dataFunction)
      Dynamically adds a column to a specific position into the table to be built.
      Parameters:
      index - the position to insert the column.
      col - the column to add
      dataFunction - a function that receives a Cloudlet and returns the data to be printed for the added column
      Returns:
    • createTableColumns

      protected abstract void createTableColumns()
      Creates the columns of the table and define how the data for those columns will be got from an object inside the list of objects to be printed.
    • build

      public void build()
      Builds the table with the data from the list of objects and shows the results.
    • addDataToRow

      protected void addDataToRow​(T object, List<Object> row)
      Add data to a row of the table being generated.
      Parameters:
      object - The object T to get to data to show in the row of the table
      row - The row that the data from the object T will be added to
    • addColumnDataFunction

      protected TableBuilderAbstract<T> addColumnDataFunction​(TableColumn col, Function<T,​Object> function)