Package edu.cmu.tetrad.util
Class TextTable
java.lang.Object
edu.cmu.tetrad.util.TextTable
Stores a 2D array of Strings for printing out tables. The table can print out columns either left justified or right
justified, with a given number of spaces between columns.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Setjustification
to this if the columns should be left justified.static final int
Setjustification
to this if the columns should be right justified. -
Constructor Summary
ConstructorsConstructorDescriptionTextTable
(int rows, int columns) Construct the text table; the table has a fixed number of rows and columns, each greater than zero. -
Method Summary
Modifier and TypeMethodDescriptionint
getNumColumns.int
getNumRows.getTokenAt
(int row, int column) getTokenAt.void
setColumnSpacing
(int numSpaces) Sets the number of spaces between columns, to some number >= 0.void
setDelimiter
(TextTable.Delimiter delimiter) Setter for the fielddelimiter
.void
setJustification
(int justification) Sets the justification, either LEFT_JUSTIFIED or RIGHT_JUSTIFIED.void
Sets the token at the given row and column, each of which must be >= 0 and less than the number of rows or columns, respectively.toString()
toString.
-
Field Details
-
LEFT_JUSTIFIED
public static final int LEFT_JUSTIFIEDSetjustification
to this if the columns should be left justified.- See Also:
-
RIGHT_JUSTIFIED
public static final int RIGHT_JUSTIFIEDSetjustification
to this if the columns should be right justified.- See Also:
-
-
Constructor Details
-
TextTable
public TextTable(int rows, int columns) Construct the text table; the table has a fixed number of rows and columns, each greater than zero.- Parameters:
rows
- a intcolumns
- a int
-
-
Method Details
-
setToken
-
getTokenAt
getTokenAt.
- Parameters:
row
- a intcolumn
- a int- Returns:
- the token at the given row and column.
-
getNumRows
public int getNumRows()getNumRows.
- Returns:
- the number of rows, as set in the constructor.
-
getNumColumns
public int getNumColumns()getNumColumns.
- Returns:
- the number of rows, as set in the constructor.
-
setColumnSpacing
public void setColumnSpacing(int numSpaces) Sets the number of spaces between columns, to some number >= 0.- Parameters:
numSpaces
- a int
-
setJustification
public void setJustification(int justification) Sets the justification, either LEFT_JUSTIFIED or RIGHT_JUSTIFIED.- Parameters:
justification
- a int
-
toString
-
setDelimiter
Setter for the field
delimiter
.- Parameters:
delimiter
- aTextTable.Delimiter
object
-