Package cern.colt.matrix.objectalgo
Class Formatter
java.lang.Object
cern.colt.PersistentObject
cern.colt.matrix.impl.AbstractFormatter
cern.colt.matrix.objectalgo.Formatter
- All Implemented Interfaces:
Serializable
,Cloneable
Flexible, well human readable matrix print formatting.
Each cell is converted using
Object.toString()
.
For examples see doublealgo.Formatter
which is just the same except that it operates on doubles.- Version:
- 1.1, 11/22/99
- See Also:
-
Field Summary
Fields inherited from class cern.colt.matrix.impl.AbstractFormatter
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
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
form
(AbstractMatrix1D matrix, int index, Former formatter) Converts a given cell to a String; no alignment considered.protected String
form
(ObjectMatrix1D matrix, int index, Former formatter) Converts a given cell to a String; no alignment considered.protected String[][]
format
(AbstractMatrix2D matrix) Returns a string representations of all cells; no alignment considered.protected String[][]
format
(ObjectMatrix2D matrix) Returns a string representations of all cells; no alignment considered.toSourceCode
(ObjectMatrix1D matrix) Returns a string s such that Object[] m = s is a legal Java statement.toSourceCode
(ObjectMatrix2D matrix) Returns a string s such that Object[] m = s is a legal Java statement.toSourceCode
(ObjectMatrix3D matrix) Returns a string s such that Object[] m = s is a legal Java statement.protected String
toString
(AbstractMatrix2D matrix) Returns a string representation of the given matrix.toString
(ObjectMatrix1D matrix) Returns a string representation of the given matrix.toString
(ObjectMatrix2D matrix) Returns a string representation of the given matrix.toString
(ObjectMatrix3D matrix) Returns a string representation of the given matrix.toTitleString
(ObjectMatrix2D matrix, String[] rowNames, String[] columnNames, String rowAxisName, String columnAxisName, String title) Returns a string representation of the given matrix with axis as well as rows and columns labeled.toTitleString
(ObjectMatrix3D matrix, String[] sliceNames, String[] rowNames, String[] columnNames, String sliceAxisName, String rowAxisName, String columnAxisName, String title) Returns a string representation of the given matrix with axis as well as rows and columns labeled.Methods inherited from class cern.colt.matrix.impl.AbstractFormatter
align, alignmentCode, alignRow, blanks, demo1, demo2, demo3, formatRow, lead, repeat, setAlignment, setColumnSeparator, setFormat, setMinColumnWidth, setPrintShape, setRowSeparator, setSliceSeparator, setupBlanksCache, shape, shape, shape, toString
Methods inherited from class cern.colt.PersistentObject
clone
-
Constructor Details
-
Formatter
public Formatter()Constructs and returns a matrix formatter with alignment LEFT. -
Formatter
Constructs and returns a matrix formatter.- Parameters:
alignment
- the given alignment used to align a column.
-
-
Method Details
-
form
Converts a given cell to a String; no alignment considered.- Specified by:
form
in classAbstractFormatter
-
form
Converts a given cell to a String; no alignment considered. -
format
Returns a string representations of all cells; no alignment considered.- Specified by:
format
in classAbstractFormatter
-
format
Returns a string representations of all cells; no alignment considered. -
toSourceCode
Returns a string s such that Object[] m = s is a legal Java statement.- Parameters:
matrix
- the matrix to format.
-
toSourceCode
Returns a string s such that Object[] m = s is a legal Java statement.- Parameters:
matrix
- the matrix to format.
-
toSourceCode
Returns a string s such that Object[] m = s is a legal Java statement.- Parameters:
matrix
- the matrix to format.
-
toString
Returns a string representation of the given matrix.- Overrides:
toString
in classAbstractFormatter
- Parameters:
matrix
- the matrix to convert.
-
toString
Returns a string representation of the given matrix.- Parameters:
matrix
- the matrix to convert.
-
toString
Returns a string representation of the given matrix.- Parameters:
matrix
- the matrix to convert.
-
toString
Returns a string representation of the given matrix.- Parameters:
matrix
- the matrix to convert.
-
toTitleString
public String toTitleString(ObjectMatrix2D matrix, String[] rowNames, String[] columnNames, String rowAxisName, String columnAxisName, String title) Returns a string representation of the given matrix with axis as well as rows and columns labeled. Pass null to one or more parameters to indicate that the corresponding decoration element shall not appear in the string converted matrix.- Parameters:
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.- Returns:
- the matrix converted to a string.
-
toTitleString
public String toTitleString(ObjectMatrix3D matrix, String[] sliceNames, String[] rowNames, String[] columnNames, String sliceAxisName, String rowAxisName, String columnAxisName, String title) Returns a string representation of the given matrix with axis as well as rows and columns labeled. Pass null to one or more parameters to indicate that the corresponding decoration element shall not appear in the string converted matrix.- Parameters:
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.- Returns:
- the matrix converted to a string.
-