Used for creating simple listings of objects (in command line applications). There is only one shared RowFormat object. In order to use RowFormat you should first configure it, by adding column definitions (prepare or addColumn), i.e. defining column names and widths. Then, the "format" method can be invoked on a number of objects (of the same class) returning the formatted rows of the table.
Example:
RowFormat.clear();
RowFormat.prepare(Genotype.*,"name/20,strsiz/5,nnsiz/5,fit/6");
CLI.println(RowFormat.format(Genotype.*));
fieldsep
string |
field separator
The character used for separating columns
|
fillchar
string |
fill character
The characted used for padding the columns contents
|
header
string |
header
Contains the field names with the same formatting applied (i.e. with fill and separators)
|
addColumn
doesn't return a value |
addColumn
function addColumn(integer Field#, integer Column_width)
Low level call, adds a single column. "prepare" is better.
|
clear
doesn't return a value |
clear
function clear()
Remove all existing column definitions.
|
format
returns string |
format
function format(object Object)
Returns the formatted string taking data from the supplied object.
|
prepare
doesn't return a value |
prepare
function prepare(object Object, string Column_Descriptions)
Adds a number of columns, described as FIELD_NAME/WIDTH, columns are separated by "," (comma). Existing column definitions are not removed. Usually you will need to call "clear()" before "prepare".
|