cern.colt.matrix.tobject.algo
Class ObjectFormatter
- java.lang.Object
-
- cern.colt.PersistentObject
-
- cern.colt.matrix.AbstractFormatter
-
- cern.colt.matrix.tobject.algo.ObjectFormatter
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class ObjectFormatter extends AbstractFormatter
Flexible, well human readable matrix print formatting. Each cell is converted usingObject.toString(). For examples seedoublealgo.Formatterwhich is just the same except that it operates on doubles.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class cern.colt.matrix.AbstractFormatter
CENTER, DECIMAL, DEFAULT_COLUMN_SEPARATOR, DEFAULT_MIN_COLUMN_WIDTH, DEFAULT_ROW_SEPARATOR, DEFAULT_SLICE_SEPARATOR, LEFT, RIGHT
-
-
Constructor Summary
Constructors Constructor and Description ObjectFormatter()Constructs and returns a matrix formatter with alignment LEFT.ObjectFormatter(java.lang.String alignment)Constructs and returns a matrix formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringtoSourceCode(ObjectMatrix1D matrix)Returns a string s such that Object[] m = s is a legal Java statement.java.lang.StringtoSourceCode(ObjectMatrix2D matrix)Returns a string s such that Object[] m = s is a legal Java statement.java.lang.StringtoSourceCode(ObjectMatrix3D matrix)Returns a string s such that Object[] m = s is a legal Java statement.java.lang.StringtoString(ObjectMatrix1D matrix)Returns a string representation of the given matrix.java.lang.StringtoString(ObjectMatrix2D matrix)Returns a string representation of the given matrix.java.lang.StringtoString(ObjectMatrix3D matrix)Returns a string representation of the given matrix.java.lang.StringtoTitleString(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.StringtoTitleString(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.-
Methods inherited from class cern.colt.matrix.AbstractFormatter
setAlignment, setColumnSeparator, setFormat, setMinColumnWidth, setPrintShape, setRowSeparator, setSliceSeparator, shape, shape, shape
-
Methods inherited from class cern.colt.PersistentObject
clone
-
-
-
-
Constructor Detail
-
ObjectFormatter
public ObjectFormatter()
Constructs and returns a matrix formatter with alignment LEFT.
-
ObjectFormatter
public ObjectFormatter(java.lang.String alignment)
Constructs and returns a matrix formatter.- Parameters:
alignment- the given alignment used to align a column.
-
-
Method Detail
-
toSourceCode
public java.lang.String toSourceCode(ObjectMatrix1D matrix)
Returns a string s such that Object[] m = s is a legal Java statement.- Parameters:
matrix- the matrix to format.
-
toSourceCode
public java.lang.String toSourceCode(ObjectMatrix2D matrix)
Returns a string s such that Object[] m = s is a legal Java statement.- Parameters:
matrix- the matrix to format.
-
toSourceCode
public java.lang.String toSourceCode(ObjectMatrix3D matrix)
Returns a string s such that Object[] m = s is a legal Java statement.- Parameters:
matrix- the matrix to format.
-
toString
public java.lang.String toString(ObjectMatrix1D matrix)
Returns a string representation of the given matrix.- Parameters:
matrix- the matrix to convert.
-
toString
public java.lang.String toString(ObjectMatrix2D matrix)
Returns a string representation of the given matrix.- Parameters:
matrix- the matrix to convert.
-
toString
public java.lang.String toString(ObjectMatrix3D matrix)
Returns a string representation of the given matrix.- Parameters:
matrix- the matrix to convert.
-
toTitleString
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)
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 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. 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG