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.
- 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
int
getTokenAt
(int row, int column) void
setColumnSpacing
(int numSpaces) Sets the number of spaces between columns, to some number >= 0.void
setDelimiter
(TextTable.Delimiter delimiter) 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()
-
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.
-
-
Method Details
-
setToken
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. -
getTokenAt
- Returns:
- the token at the given row and column.
-
getNumRows
public int getNumRows()- Returns:
- the number of rows, as set in the constructor.
-
getNumColumns
public int 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. -
setJustification
public void setJustification(int justification) Sets the justification, either LEFT_JUSTIFIED or RIGHT_JUSTIFIED. -
toString
-
setDelimiter
-