Package com.imsl.math
Class PrintMatrixFormat
java.lang.Object
com.imsl.math.PrintMatrixFormat
- Direct Known Subclasses:
PrintMatrixFormatEx2
This class can be used to customize the actions of PrintMatrix.
By default, entries are formatted using the default NumberFormat
for the current default locale. As of JDK1.3, none of these
NumberFormat objects support scientific notation. To enable
scientific notation, set the NumberFormat property to null.
There is no way to simultaneously support scientific notation
and locale-correct formatting.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThis flag as the type argument to format, indicates that the formatting string for ending a column label is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for beginning a column label row is to be returned.static final intThis flag as the type argument to format, indicates that the formatted string for beginning an entry is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for beginning a matrix is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for beginning a row is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for beginning a row label is to be returned.static final intThis flag as the type argument to format, indicates that the formatted string for a given column label is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for ending a column label is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for ending a column label row is to be returned.static final intThis flag as the type argument to format, indicates that the formatted string for ending an entry is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for ending a matrix is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for ending a row is to be returned.static final intThis flag as the type argument to format, indicates that the formatting string for ending a row label is to be returned.static final intThis flag as the type argument to format, indicates that the formatted string for a given entry is to be returned.protected NumberFormatThe NumberFormat to be used in formatting double and Complex entries.static final intThis flag as the type argument to format, indicates that the formatted string for a given row label is to be returned. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformat(int type, Object entry, int row, int col, ParsePosition pos) Returns a formatted string.Returns the NumberFormat to be used in formatting double and Complex entries.voidsetColumnLabels(String[] columnLabels) Turns on column labeling using the given labels.voidsetFirstColumnNumber(int firstColumnNumber) Turns on column labeling with index numbers and sets the index for the label of the first column.voidsetFirstRowNumber(int firstRowNumber) Turns on row labeling with index numbers and sets the index for the label of the first row.voidTurns off column labels.voidTurns off row labels.voidsetNumberFormat(NumberFormat numberFormat) Sets the NumberFormat to be used in formatting double and Complex entries.
-
Field Details
-
BEGIN_MATRIX
public static final int BEGIN_MATRIXThis flag as the type argument to format, indicates that the formatting string for beginning a matrix is to be returned. -
END_MATRIX
public static final int END_MATRIXThis flag as the type argument to format, indicates that the formatting string for ending a matrix is to be returned. -
BEGIN_COLUMN_LABELS
public static final int BEGIN_COLUMN_LABELSThis flag as the type argument to format, indicates that the formatting string for beginning a column label row is to be returned. -
END_COLUMN_LABELS
public static final int END_COLUMN_LABELSThis flag as the type argument to format, indicates that the formatting string for ending a column label row is to be returned. -
BEGIN_COLUMN_LABEL
public static final int BEGIN_COLUMN_LABELThis flag as the type argument to format, indicates that the formatting string for ending a column label is to be returned. -
COLUMN_LABEL
public static final int COLUMN_LABELThis flag as the type argument to format, indicates that the formatted string for a given column label is to be returned. -
END_COLUMN_LABEL
public static final int END_COLUMN_LABELThis flag as the type argument to format, indicates that the formatting string for ending a column label is to be returned. -
BEGIN_ROW
public static final int BEGIN_ROWThis flag as the type argument to format, indicates that the formatting string for beginning a row is to be returned. -
END_ROW
public static final int END_ROWThis flag as the type argument to format, indicates that the formatting string for ending a row is to be returned. -
BEGIN_ROW_LABEL
public static final int BEGIN_ROW_LABELThis flag as the type argument to format, indicates that the formatting string for beginning a row label is to be returned. -
ROW_LABEL
public static final int ROW_LABELThis flag as the type argument to format, indicates that the formatted string for a given row label is to be returned. -
END_ROW_LABEL
public static final int END_ROW_LABELThis flag as the type argument to format, indicates that the formatting string for ending a row label is to be returned. -
BEGIN_ENTRY
public static final int BEGIN_ENTRYThis flag as the type argument to format, indicates that the formatted string for beginning an entry is to be returned. -
ENTRY
public static final int ENTRYThis flag as the type argument to format, indicates that the formatted string for a given entry is to be returned. -
END_ENTRY
public static final int END_ENTRYThis flag as the type argument to format, indicates that the formatted string for ending an entry is to be returned. -
numberFormat
The NumberFormat to be used in formatting double and Complex entries.- See Also:
-
-
Constructor Details
-
PrintMatrixFormat
public PrintMatrixFormat()Constructs a PrintMatrixFormat object.
-
-
Method Details
-
setNumberFormat
Sets the NumberFormat to be used in formatting double and Complex entries.- Parameters:
numberFormat- aNumberFormator null. Ifnullthen numbers will be formatted usingInteger.toString(int), orObject.toString().
-
getNumberFormat
Returns the NumberFormat to be used in formatting double and Complex entries. -
setNoColumnLabels
public void setNoColumnLabels()Turns off column labels. -
setNoRowLabels
public void setNoRowLabels()Turns off row labels. -
setFirstRowNumber
public void setFirstRowNumber(int firstRowNumber) Turns on row labeling with index numbers and sets the index for the label of the first row.- Parameters:
firstRowNumber- is the number for the first row label. This is usually 0 or 1. The default is 0.
-
setFirstColumnNumber
public void setFirstColumnNumber(int firstColumnNumber) Turns on column labeling with index numbers and sets the index for the label of the first column.- Parameters:
firstColumnNumber- is the number for the first column label. This is usually 0 or 1. The default is 0.
-
setColumnLabels
Turns on column labeling using the given labels.- Parameters:
columnLabels- is an array ofStrings to be used as column labels. If there are more columns than labels, the labels are reused.
-
format
Returns a formatted string. This method is used by the methodsprintandprintHTMLinPrintMatrix. This method can be overridden to gain finer control over printing.- Parameters:
type- is the type of string requested.type return value BEGIN_MATRIX Tag for the beginning of the matrix. END_MATRIX Tag for the end of the matrix. BEGIN_COLUMN_LABELS Tag for the beginning of the column labels row. END_COLUMN_LABELS Tag for the end of the column labels row. BEGIN_COLUMN_LABEL Tag for the beginning of a column label. END_COLUMN_LABEL Tag for the end of a column label. COLUMN_LABEL The label of the specified column. BEGIN_ROW Tag for the beginning of a row. END_ROW Tag for the end of a row. BEGIN_ROW_LABEL Tag for the beginning of a row label. END_ROW_LABEL Tag for the end of a row label. ROW_LABEL The label of the specified row. ENTRY The row-col entry of the matrix entry- is the entry to be formatted. This is only used if type equals ENTRY. For other values of type, this can be set to null.row- is the (0-based) row number of the element to be formatted. This is -1 if there is no row number associated with this request.col- is the (0-based) column number of the element to be formatted. This is -1 if there is no column number associated with this request.pos- is a ParsePosition object used to indicate the alignment center of the return string. This is used only if type==ENTRY. If the entry is adoublethen the index is the position of the decimal point. If the entry is anintthen the index is the position of the end of the formatted integer.- Returns:
- is the
Stringto be put into the printed table. - See Also:
-