Package org.cloudsimplus.builders.tables
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 Summary
Constructors Constructor Description TableBuilderAbstract(List<? extends T> list)
Instantiates a builder to print the list of objects T using the a defaultTextTable
.TableBuilderAbstract(List<? extends T> list, Table table)
Instantiates a builder to print the list of objects T using the a givenTable
. -
Method Summary
Modifier and Type Method Description 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.TableBuilderAbstract<T>
addColumn(TableColumn col, Function<T,Object> dataFunction)
Dynamically adds a column to the end of the table to be built.protected TableBuilderAbstract<T>
addColumnDataFunction(TableColumn col, Function<T,Object> function)
protected void
addDataToRow(T object, List<Object> row)
Add data to a row of the table being generated.void
build()
Builds the table with the data from the list of objects and shows the results.TableBuilderAbstract<T>
column(int index, Consumer<TableColumn> consumer)
Access a column at a given position in order to perform some configuration on it.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 thelist
of objects to be printed.protected Table
getTable()
TableBuilderAbstract<T>
removeColumn(int index)
Removes a column from a given position.TableBuilderAbstract<T>
removeColumn(int... indexes)
Removes columns from given positions.protected TableBuilderAbstract<T>
setObjectList(List<? extends T> list)
Sets a List of objects T to be printed.protected TableBuilderAbstract<T>
setTable(Table table)
Sets theTable
used to build the table with Cloudlet Data.TableBuilderAbstract<T>
setTitle(String title)
-
Constructor Details
-
TableBuilderAbstract
Instantiates a builder to print the list of objects T using the a defaultTextTable
. To use a differentTable
, check the alternative constructors.- Parameters:
list
- the list of objects T to print
-
TableBuilderAbstract
Instantiates a builder to print the list of objects T using the a givenTable
.- Parameters:
list
- the list of objects T to printtable
- theTable
used to build the table with the object data
-
-
Method Details
-
setObjectList
Sets a List of objects T to be printed.- Parameters:
list
- List of objects T to set- Returns:
-
setTitle
-
getTable
-
column
Access a column at a given position in order to perform some configuration on it.- Parameters:
index
- index of the column to accessconsumer
- aConsumer
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
- Parameters:
table
- theTable
to set- Returns:
-
addColumn
Dynamically adds a column to the end of the table to be built.- Parameters:
col
- the column to adddataFunction
- a function that receives a Cloudlet and returns the data to be printed for the added column- Returns:
-
removeColumn
Removes columns from given positions.- Parameters:
indexes
- the indexes of the columns to remove- Returns:
- See Also:
removeColumn(int)
-
removeColumn
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 adddataFunction
- 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 thelist
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
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 tablerow
- The row that the data from the object T will be added to
-
addColumnDataFunction
protected TableBuilderAbstract<T> addColumnDataFunction(TableColumn col, Function<T,Object> function)
-