public class Formatter extends AbstractFormatter
Object.toString()
.
For examples see doublealgo.Formatter
which is just the same except that it operates on doubles.alignment, CENTER, columnSeparator, DECIMAL, DEFAULT_COLUMN_SEPARATOR, DEFAULT_MIN_COLUMN_WIDTH, DEFAULT_ROW_SEPARATOR, DEFAULT_SLICE_SEPARATOR, factory, format, LEFT, minColumnWidth, printShape, RIGHT, rowSeparator, sliceSeparator
serialVersionUID
Constructor and Description |
---|
Formatter()
Constructs and returns a matrix formatter with alignment LEFT.
|
Formatter(java.lang.String alignment)
Constructs and returns a matrix formatter.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
form(AbstractMatrix1D matrix,
int index,
Former formatter)
Converts a given cell to a String; no alignment considered.
|
protected java.lang.String |
form(ObjectMatrix1D matrix,
int index,
Former formatter)
Converts a given cell to a String; no alignment considered.
|
protected java.lang.String[][] |
format(AbstractMatrix2D matrix)
Returns a string representations of all cells; no alignment considered.
|
protected java.lang.String[][] |
format(ObjectMatrix2D matrix)
Returns a string representations of all cells; no alignment considered.
|
java.lang.String |
toSourceCode(ObjectMatrix1D matrix)
Returns a string s such that Object[] m = s is a legal Java statement.
|
java.lang.String |
toSourceCode(ObjectMatrix2D matrix)
Returns a string s such that Object[] m = s is a legal Java statement.
|
java.lang.String |
toSourceCode(ObjectMatrix3D matrix)
Returns a string s such that Object[] m = s is a legal Java statement.
|
protected java.lang.String |
toString(AbstractMatrix2D matrix)
Returns a string representation of the given matrix.
|
java.lang.String |
toString(ObjectMatrix1D matrix)
Returns a string representation of the given matrix.
|
java.lang.String |
toString(ObjectMatrix2D matrix)
Returns a string representation of the given matrix.
|
java.lang.String |
toString(ObjectMatrix3D matrix)
Returns a string representation of the given matrix.
|
java.lang.String |
toTitleString(ObjectMatrix2D matrix,
java.lang.String[] rowNames,
java.lang.String[] columnNames,
java.lang.String rowAxisName,
java.lang.String columnAxisName,
java.lang.String title)
Returns a string representation of the given matrix with axis as well as rows and columns labeled.
|
java.lang.String |
toTitleString(ObjectMatrix3D matrix,
java.lang.String[] sliceNames,
java.lang.String[] rowNames,
java.lang.String[] columnNames,
java.lang.String sliceAxisName,
java.lang.String rowAxisName,
java.lang.String columnAxisName,
java.lang.String title)
Returns a string representation of the given matrix with axis as well as rows and columns labeled.
|
align, alignmentCode, alignRow, blanks, demo1, demo2, demo3, formatRow, lead, repeat, setAlignment, setColumnSeparator, setFormat, setMinColumnWidth, setPrintShape, setRowSeparator, setSliceSeparator, setupBlanksCache, shape, shape, shape, toString
clone
public Formatter()
public Formatter(java.lang.String alignment)
alignment
- the given alignment used to align a column.protected java.lang.String form(AbstractMatrix1D matrix, int index, Former formatter)
form
in class AbstractFormatter
protected java.lang.String form(ObjectMatrix1D matrix, int index, Former formatter)
protected java.lang.String[][] format(AbstractMatrix2D matrix)
format
in class AbstractFormatter
protected java.lang.String[][] format(ObjectMatrix2D matrix)
public java.lang.String toSourceCode(ObjectMatrix1D matrix)
matrix
- the matrix to format.public java.lang.String toSourceCode(ObjectMatrix2D matrix)
matrix
- the matrix to format.public java.lang.String toSourceCode(ObjectMatrix3D matrix)
matrix
- the matrix to format.protected java.lang.String toString(AbstractMatrix2D matrix)
toString
in class AbstractFormatter
matrix
- the matrix to convert.public java.lang.String toString(ObjectMatrix1D matrix)
matrix
- the matrix to convert.public java.lang.String toString(ObjectMatrix2D matrix)
matrix
- the matrix to convert.public java.lang.String toString(ObjectMatrix3D matrix)
matrix
- the matrix to convert.public java.lang.String toTitleString(ObjectMatrix2D matrix, java.lang.String[] rowNames, java.lang.String[] columnNames, java.lang.String rowAxisName, java.lang.String columnAxisName, java.lang.String title)
matrix
- The matrix to format.rowNames
- The headers of all rows (to be put to the left of the matrix).columnNames
- The headers of all columns (to be put to above the matrix).rowAxisName
- The label of the y-axis.columnAxisName
- The label of the x-axis.title
- The overall title of the matrix to be formatted.public java.lang.String toTitleString(ObjectMatrix3D matrix, java.lang.String[] sliceNames, java.lang.String[] rowNames, java.lang.String[] columnNames, java.lang.String sliceAxisName, java.lang.String rowAxisName, java.lang.String columnAxisName, java.lang.String title)
matrix
- The matrix to format.sliceNames
- The headers of all slices (to be put above each slice).rowNames
- The headers of all rows (to be put to the left of the matrix).columnNames
- The headers of all columns (to be put to above the matrix).sliceAxisName
- The label of the z-axis (to be put above each slice).rowAxisName
- The label of the y-axis.columnAxisName
- The label of the x-axis.title
- The overall title of the matrix to be formatted.Jump to the Colt Homepage