TableBuilderAbstract

public abstract class TableBuilderAbstract<T>

An abstract class to build tables to print data from a list of objects containing simulation results.

Author:Manoel Campos da Silva Filho

Constructors

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

Methods

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

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

addColumnDataFunction

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

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

build

public void build()

Builds the table with the data from the list of objects and shows the results.

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.

getTable

protected Table getTable()

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

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

setTitle

public TableBuilderAbstract<T> setTitle(String title)