public class PrintMatrixFormat extends Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
PrintMatrixFormat()
Constructs a PrintMatrixFormat object.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final int BEGIN_MATRIX
public static final int END_MATRIX
public static final int BEGIN_COLUMN_LABELS
public static final int END_COLUMN_LABELS
public static final int BEGIN_COLUMN_LABEL
public static final int COLUMN_LABEL
public static final int END_COLUMN_LABEL
public static final int BEGIN_ROW
public static final int END_ROW
public static final int BEGIN_ROW_LABEL
public static final int ROW_LABEL
public static final int END_ROW_LABEL
public static final int BEGIN_ENTRY
public static final int ENTRY
public static final int END_ENTRY
protected NumberFormat numberFormat
Complex
public PrintMatrixFormat()
public void setNumberFormat(NumberFormat numberFormat)
numberFormat
- a NumberFormat
or null.
If null
then numbers will be formatted using
Integer.toString(int)
, or
Object.toString()
.public NumberFormat getNumberFormat()
public void setNoColumnLabels()
public void setNoRowLabels()
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 setFirstColumnNumber(int firstColumnNumber)
firstColumnNumber
- is the number for the first column label.
This is usually 0 or 1. The default is 0.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 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.PrintMatrixFormat.BEGIN_MATRIX
,
PrintMatrixFormat.END_MATRIX
,
PrintMatrixFormat.BEGIN_COLUMN_LABELS
,
PrintMatrixFormat.END_COLUMN_LABELS
,
PrintMatrixFormat.BEGIN_COLUMN_LABEL
,
PrintMatrixFormat.END_COLUMN_LABEL
,
PrintMatrixFormat.COLUMN_LABEL
,
PrintMatrixFormat.BEGIN_ROW
,
PrintMatrixFormat.END_ROW
,
PrintMatrixFormat.BEGIN_ROW_LABEL
,
PrintMatrixFormat.END_ROW_LABEL
,
PrintMatrixFormat.ROW_LABEL
,
PrintMatrixFormat.ENTRY
Copyright © 2020 Rogue Wave Software. All rights reserved.