|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.math.PrintMatrixFormat
public class PrintMatrixFormat
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.
PrintMatrix
,
NumberFormat
,
Simple Example,
Example overriding format method.Field Summary | |
---|---|
static int |
BEGIN_COLUMN_LABEL
This flag as the type argument to format, indicates that the formatting string for ending a column label is to be returned. |
static int |
BEGIN_COLUMN_LABELS
This flag as the type argument to format, indicates that the formatting string for beginning a column label row is to be returned. |
static int |
BEGIN_ENTRY
This flag as the type argument to format, indicates that the formatted string for beginning an entry is to be returned. |
static int |
BEGIN_MATRIX
This flag as the type argument to format, indicates that the formatting string for beginning a matrix is to be returned. |
static int |
BEGIN_ROW
This flag as the type argument to format, indicates that the formatting string for beginning a row is to be returned. |
static int |
BEGIN_ROW_LABEL
This flag as the type argument to format, indicates that the formatting string for beginning a row label is to be returned. |
static int |
COLUMN_LABEL
This flag as the type argument to format, indicates that the formatted string for a given column label is to be returned. |
static int |
END_COLUMN_LABEL
This flag as the type argument to format, indicates that the formatting string for ending a column label is to be returned. |
static int |
END_COLUMN_LABELS
This flag as the type argument to format, indicates that the formatting string for ending a column label row is to be returned. |
static int |
END_ENTRY
This flag as the type argument to format, indicates that the formatted string for ending an entry is to be returned. |
static int |
END_MATRIX
This flag as the type argument to format, indicates that the formatting string for ending a matrix is to be returned. |
static int |
END_ROW
This flag as the type argument to format, indicates that the formatting string for ending a row is to be returned. |
static int |
END_ROW_LABEL
This flag as the type argument to format, indicates that the formatting string for ending a row label is to be returned. |
static int |
ENTRY
This flag as the type argument to format, indicates that the formatted string for a given entry is to be returned. |
protected NumberFormat |
numberFormat
The NumberFormat to be used in formatting double and Complex entries. |
static int |
ROW_LABEL
This flag as the type argument to format, indicates that the formatted string for a given row label is to be returned. |
Constructor Summary | |
---|---|
PrintMatrixFormat()
Constructs a PrintMatrixFormat object. |
Method Summary | |
---|---|
String |
format(int type,
Object entry,
int row,
int col,
ParsePosition pos)
Returns a formatted string. |
NumberFormat |
getNumberFormat()
Returns the NumberFormat to be used in formatting double and Complex entries. |
void |
setColumnLabels(String[] columnLabels)
Turns on column labeling using the given labels. |
void |
setFirstColumnNumber(int firstColumnNumber)
Turns on column labeling with index numbers and sets the index for the label of the first column. |
void |
setFirstRowNumber(int firstRowNumber)
Turns on row labeling with index numbers and sets the index for the label of the first row. |
void |
setNoColumnLabels()
Turns off column labels. |
void |
setNoRowLabels()
Turns off row labels. |
void |
setNumberFormat(NumberFormat numberFormat)
Sets the NumberFormat to be used in formatting double and Complex entries. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BEGIN_COLUMN_LABEL
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int BEGIN_COLUMN_LABELS
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int BEGIN_ENTRY
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int BEGIN_MATRIX
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int BEGIN_ROW
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int BEGIN_ROW_LABEL
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int COLUMN_LABEL
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int END_COLUMN_LABEL
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int END_COLUMN_LABELS
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int END_ENTRY
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int END_MATRIX
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int END_ROW
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int END_ROW_LABEL
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuespublic static final int ENTRY
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field Valuesprotected NumberFormat numberFormat
Complex
public static final int ROW_LABEL
format(int type, Object entry, int row, int col, ParsePosition pos)
,
Constant Field ValuesConstructor Detail |
---|
public PrintMatrixFormat()
Method Detail |
---|
public String format(int type, Object entry, int row, int col, ParsePosition pos)
print
and printHTML
in PrintMatrix
.
This method can be overridden to gain finer control over printing.
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 a double
then the index
is the position of the decimal point.
If the entry is an int
then the index
is the position of the end of the formatted integer.
String
to be put into the printed table.BEGIN_MATRIX
,
END_MATRIX
,
BEGIN_COLUMN_LABELS
,
END_COLUMN_LABELS
,
BEGIN_COLUMN_LABEL
,
END_COLUMN_LABEL
,
COLUMN_LABEL
,
BEGIN_ROW
,
END_ROW
,
BEGIN_ROW_LABEL
,
END_ROW_LABEL
,
ROW_LABEL
,
ENTRY
public NumberFormat getNumberFormat()
public void setColumnLabels(String[] columnLabels)
columnLabels
- is an array of String
s to be used
as column labels. If there are more columns than labels,
the labels are reused.public void setFirstColumnNumber(int firstColumnNumber)
firstColumnNumber
- is the number for the first column label.
This is usually 0 or 1. The default is 0.public void setFirstRowNumber(int firstRowNumber)
firstRowNumber
- is the number for the first row label.
This is usually 0 or 1. The default is 0.public void setNoColumnLabels()
public void setNoRowLabels()
public void setNumberFormat(NumberFormat numberFormat)
numberFormat
- a NumberFormat
or null.
If null
then numbers will be formatted using
Integer.toString(int)
, or
Object.toString()
.
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |