Package org.cloudsimplus.builders.tables
Class AbstractTable
java.lang.Object
org.cloudsimplus.builders.tables.AbstractTable
- All Implemented Interfaces:
Table
public abstract class AbstractTable extends Object implements Table
An abstract base class for implementing data tables.
- Author:
- Manoel Campos da Silva Filho
-
Constructor Summary
Constructors Constructor Description AbstractTable()
AbstractTable(String title)
Creates an Table -
Method Summary
Modifier and Type Method Description TableColumn
addColumn(int index, TableColumn column)
Adds a column object to a specific position of the table's columns to be printed.TableColumn
addColumn(String columnTitle)
Adds a column with a given to the end of the table's columns to be printed.TableColumn
addColumn(String columnTitle, String columnSubTitle)
Adds a column with a given title and sub-title to the end of the table's columns to be printed.TableColumn
addColumn(TableColumn column)
Adds a column object to the end of the table's columns to be printed.Table
addColumnList(String... columnTitles)
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.List<TableColumn>
getColumns()
String
getColumnSeparator()
Gets the string used to separate one column from another (optional).protected PrintStream
getPrintStream()
Gets thePrintStream
used to print the generated table.protected List<List<Object>>
getRows()
String
getTitle()
List<Object>
newRow()
Adds a new row to the list of rows containing the data to be printed.void
print()
Prints the table.protected void
printColumnHeaders()
protected abstract void
printRowClosing()
Prints the string to close a row.protected abstract void
printRowOpening()
Prints the string that has to precede each printed row.protected abstract void
printTableClosing()
Prints the string to close the table.protected abstract void
printTableOpening()
Prints the string to open the table.protected abstract void
printTitle()
Prints the table title.Table
setColumnSeparator(String columnSeparator)
Sets the string used to separate one column from another (optional).void
setPrintStream(PrintStream printStream)
Sets thePrintStream
used to print the generated table.Table
setTitle(String title)
-
Constructor Details
-
AbstractTable
public AbstractTable() -
AbstractTable
Creates an Table- Parameters:
title
- Title of the table
-
-
Method Details
-
getColumns
- Specified by:
getColumns
in interfaceTable
- Returns:
- the list of columns of the table
-
getTitle
-
setTitle
-
getColumnSeparator
Description copied from interface:Table
Gets the string used to separate one column from another (optional).- Specified by:
getColumnSeparator
in interfaceTable
- Returns:
-
setColumnSeparator
Description copied from interface:Table
Sets the string used to separate one column from another (optional).- Specified by:
setColumnSeparator
in interfaceTable
- Parameters:
columnSeparator
- the separator to set- Returns:
-
getRows
- Returns:
- The data to be printed, where each row contains a list of data columns.
-
newRow
Description copied from interface:Table
Adds a new row to the list of rows containing the data to be printed. -
print
public void print()Description copied from interface:Table
Prints the 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. -
printRowOpening
protected abstract void printRowOpening()Prints the string that has to precede each printed row. -
printRowClosing
protected abstract void printRowClosing()Prints the string to close a row. -
printTableClosing
protected abstract void printTableClosing()Prints the string to close the table. -
addColumnList
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 interfaceTable
- Parameters:
columnTitles
- The titles of the columns- Returns:
- the
Table
instance. - See Also:
Table.addColumn(String)
-
addColumn
Description copied from interface:Table
Adds a column with a given to the end of the table's columns to be printed. -
addColumn
Description copied from interface:Table
Adds a column with a given title and sub-title to the end of the table's columns to be printed. -
addColumn
Description copied from interface:Table
Adds a column object to a specific position of the table's columns to be printed. -
addColumn
Description copied from interface:Table
Adds a column object to the end of the table's columns to be printed. -
setPrintStream
Sets thePrintStream
used to print the generated table.- Parameters:
printStream
- thePrintStream
to set
-
getPrintStream
Gets thePrintStream
used to print the generated table.- Returns:
- the
PrintStream
-