nxm matrix in components list format
"{{a00,a01, ...,
a0m-1},{a10,
a11, ..., a1m-1},{...},{
an-10, an-11, ...,
an-1m-1}}".
The prefix and suffix "{" and "}", the row prefix and suffix "{" and "}", the row separator "," and the column separator "," can be replaced by any user-defined strings. The number format for components can be configured.
White space is ignored at parse time, even if it is in the prefix, suffix or separator specifications. So even if the default separator does include a space character that is used at format time, both input string "{{1,1,1}}" and " { { 1 , 1 , 1 } } " will be parsed without error and the same matrix will be returned. In the second case, however, the parse position after parsing will be just after the closing curly brace, i.e. just before the trailing space.
Note
the grouping functionality of the used NumberFormat is
disabled to prevent problems when parsing (e.g. 1,345.34 would be a valid number
but conflicts with the default column separator).
| Modifier and Type | Field and Description |
|---|---|
| private final String | columnSeparator
Column separator. |
| private static final String | DEFAULT_COLUMN_SEPARATOR
The default column separator: ",". |
| private static final String | DEFAULT_PREFIX
The default prefix: "{". |
| private static final String | DEFAULT_ROW_PREFIX
The default row prefix: "{". |
| private static final String | DEFAULT_ROW_SEPARATOR
The default row separator: ",". |
| private static final String | DEFAULT_ROW_SUFFIX
The default row suffix: "}". |
| private static final String | DEFAULT_SUFFIX
The default suffix: "}". |
| private final NumberFormat | format
The format used for components. |
| private final String | prefix
Prefix. |
| private final String | rowPrefix
Row prefix. |
| private final String | rowSeparator
Row separator. |
| private final String | rowSuffix
Row suffix. |
| private final String | suffix
Suffix. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | RealMatrixFormat(final NumberFormat
the custom format for components. format)Create an instance with a custom number format for components. |
| public | RealMatrixFormat(final String
prefix to use instead of the default "{" prefix, final String suffix to use instead of the default "}" suffix, final String row prefix to use instead of the default "{" rowPrefix, final String row suffix to use instead of the default "}" rowSuffix, final String tow separator to use instead of the default ";" rowSeparator, final String column separator to use instead of the default ", " columnSeparator)Create an instance with custom prefix, suffix and separator. |
| public | RealMatrixFormat(final String
prefix to use instead of the default "{" prefix, final String suffix to use instead of the default "}" suffix, final String row prefix to use instead of the default "{" rowPrefix, final String row suffix to use instead of the default "}" rowSuffix, final String tow separator to use instead of the default ";" rowSeparator, final String column separator to use instead of the default ", " columnSeparator, final NumberFormat the custom format for components. format)Create an instance with custom prefix, suffix, separator and format for components. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: a formatted matrix.RealMatrix object to format. m)This method calls |
| public StringBuffer | Returns: the value passed in as toAppendTo.the object to format. matrix, StringBuffer where the text is to be appended toAppendTo, FieldPosition On input: an alignment field, if desired. On output: the
offsets of the alignment field pos)Formats a |
| public static Locale[] | Returns: available real vector format locales.Get the set of locales for which real vectors formats are available. |
| public String | Returns: format separator between components.Get the format separator between components. |
| public NumberFormat | |
| public static RealMatrixFormat | Returns: the default real vector format.Returns the default real vector format for the current locale. |
| public static RealMatrixFormat | Returns: the real vector format specific to the given locale.the specific locale used by the format. locale)Returns the default real vector format for the given locale. |
| public String | |
| public String | |
| public String | Returns: format separator for rows.Get the format separator between rows of the matrix. |
| public String | |
| public String | |
| public RealMatrix | Returns: the parsedRealMatrix object.String to parse. source)Parse a string to produce a |
| public RealMatrix | Returns: the parsedRealMatrix object.String to parse. source, ParsePosition input/ouput parsing parameter. pos)Parse a string to produce a |
| columnSeparator | back to summary |
|---|---|
| private final String columnSeparator Column separator. | |
| DEFAULT_COLUMN_SEPARATOR | back to summary |
|---|---|
| private static final String DEFAULT_COLUMN_SEPARATOR The default column separator: ",". | |
| DEFAULT_PREFIX | back to summary |
|---|---|
| private static final String DEFAULT_PREFIX The default prefix: "{". | |
| DEFAULT_ROW_PREFIX | back to summary |
|---|---|
| private static final String DEFAULT_ROW_PREFIX The default row prefix: "{". | |
| DEFAULT_ROW_SEPARATOR | back to summary |
|---|---|
| private static final String DEFAULT_ROW_SEPARATOR The default row separator: ",". | |
| DEFAULT_ROW_SUFFIX | back to summary |
|---|---|
| private static final String DEFAULT_ROW_SUFFIX The default row suffix: "}". | |
| DEFAULT_SUFFIX | back to summary |
|---|---|
| private static final String DEFAULT_SUFFIX The default suffix: "}". | |
| format | back to summary |
|---|---|
| private final NumberFormat format The format used for components. | |
| prefix | back to summary |
|---|---|
| private final String prefix Prefix. | |
| rowPrefix | back to summary |
|---|---|
| private final String rowPrefix Row prefix. | |
| rowSeparator | back to summary |
|---|---|
| private final String rowSeparator Row separator. | |
| rowSuffix | back to summary |
|---|---|
| private final String rowSuffix Row suffix. | |
| suffix | back to summary |
|---|---|
| private final String suffix Suffix. | |
| RealMatrixFormat | back to summary |
|---|---|
| public RealMatrixFormat() Create an instance with default settings. The instance uses the default prefix, suffix and row/column separator: "[", "]", ";" and ", " and the default number format for components. | |
| RealMatrixFormat | back to summary |
|---|---|
| public RealMatrixFormat(final NumberFormat format) Create an instance with a custom number format for components.
| |
| RealMatrixFormat | back to summary |
|---|---|
| public RealMatrixFormat(final String prefix, final String suffix, final String rowPrefix, final String rowSuffix, final String rowSeparator, final String columnSeparator) Create an instance with custom prefix, suffix and separator.
| |
| RealMatrixFormat | back to summary |
|---|---|
| public RealMatrixFormat(final String prefix, final String suffix, final String rowPrefix, final String rowSuffix, final String rowSeparator, final String columnSeparator, final NumberFormat format) Create an instance with custom prefix, suffix, separator and format for components.
| |
| format | back to summary |
|---|---|
| public String format(RealMatrix m) This method calls
| |
| format | back to summary |
|---|---|
| public StringBuffer format(RealMatrix matrix, StringBuffer toAppendTo, FieldPosition pos) Formats a
| |
| getAvailableLocales | back to summary |
|---|---|
| public static Locale[] getAvailableLocales() Get the set of locales for which real vectors formats are available. This is the same set as the
| |
| getColumnSeparator | back to summary |
|---|---|
| public String getColumnSeparator() Get the format separator between components.
| |
| getFormat | back to summary |
|---|---|
| public NumberFormat getFormat() Get the components format.
| |
| getInstance | back to summary |
|---|---|
| public static RealMatrixFormat getInstance() Returns the default real vector format for the current locale.
| |
| getInstance | back to summary |
|---|---|
| public static RealMatrixFormat getInstance(final Locale locale) Returns the default real vector format for the given locale.
| |
| getPrefix | back to summary |
|---|---|
| public String getPrefix() Get the format prefix.
| |
| getRowPrefix | back to summary |
|---|---|
| public String getRowPrefix() Get the format prefix.
| |
| getRowSeparator | back to summary |
|---|---|
| public String getRowSeparator() Get the format separator between rows of the matrix.
| |
| getRowSuffix | back to summary |
|---|---|
| public String getRowSuffix() Get the format suffix.
| |
| getSuffix | back to summary |
|---|---|
| public String getSuffix() Get the format suffix.
| |
| parse | back to summary |
|---|---|
| public RealMatrix parse(String source) Parse a string to produce a
| |
| parse | back to summary |
|---|---|
| public RealMatrix parse(String source, ParsePosition pos) Parse a string to produce a
| |