Class TableBuilderAbstract<T>
java.lang.Object
org.cloudsimplus.builders.tables.TableBuilderAbstract<T>
- Type Parameters:
T- the type of objects printed into the table
- Direct Known Subclasses:
CloudletsTableBuilder,HostHistoryTableBuilder
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
ConstructorsConstructorDescriptionTableBuilderAbstract(List<? extends T> list) Instantiates a builder to print the list of objects T using the defaultMarkdownTable.TableBuilderAbstract(List<? extends T> list, Table table) Instantiates a builder to print the list of objects T using a givenTable. -
Method Summary
Modifier and TypeMethodDescriptionaddColumn(@NonNull TableColumn col, @NonNull Function<T, Object> dataFunction, int index) Adds a column to a specific position into the table to be built.addColumn(TableColumn col, Function<T, Object> dataFunction) Adds a column to the end of the table to be built.protected voidaddDataToRow(T object, List<Object> row) Add data to a row of the table being generated.voidbuild()Builds the table with the data from the list of objects and shows the results.final TableBuilderAbstract<T> column(int index, @NonNull Consumer<TableColumn> consumer) Access a column at a given position in order to perform some configuration on it.protected abstract voidCreates the columns of the table and define how the data for those columns will be got from an object inside thelistof objects to be printed.final TableBuilderAbstract<T> removeColumn(int index) Removes a column from a given position.final TableBuilderAbstract<T> removeColumn(int... indexes) Removes columns from given positions.protected final TableBuilderAbstract<T> setObjectList(List<? extends T> list) Sets a List of objects T to be printed.protected final TableBuilderAbstract<T> Sets theTableused to build the table with data.
-
Constructor Details
-
TableBuilderAbstract
Instantiates a builder to print the list of objects T using the defaultMarkdownTable. To use a differentTable, check the alternative constructors.- Parameters:
list- the list of objects T to print
-
TableBuilderAbstract
-
-
Method Details
-
setObjectList
Sets a List of objects T to be printed.- Parameters:
list- List of objects T to set- Returns:
- this table builder
-
setTitle
-
column
public final TableBuilderAbstract<T> column(int index, @NonNull @NonNull 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 accessconsumer- aConsumerthat 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
-
addColumn
Adds a column to the end of the table to be built.- Parameters:
col- the column to adddataFunction- a function that receives a T object and returns some data from it to be printed for the added column- Returns:
- this TableBuilder object
-
addColumn
public TableBuilderAbstract<T> addColumn(@NonNull @NonNull TableColumn col, @NonNull @NonNull Function<T, Object> dataFunction, int index) Adds a column to a specific position into the table to be built.- Parameters:
col- the column to adddataFunction- a function that receives a T object and returns some data from it to be printed for the added columnindex- the position to insert the column.- Returns:
- this TableBuilder object
-
removeColumn
Removes columns from given positions.- Parameters:
indexes- the indexes of the columns to remove.- Returns:
- this TableBuilder object
- See Also:
-
removeColumn
Removes a column from a given position.- Parameters:
index- the index of the column to remove.- Returns:
- this TableBuilder object
- See Also:
-
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 thelistof objects to be printed. It doesn't add such columns into a table yet.- See Also:
-
addDataToRow
-