The prefix and suffix "{" and "}" and the 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 vector 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.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | DEFAULT_PREFIX
The default prefix: "{". |
| private static final String | DEFAULT_SEPARATOR
The default separator: ", ". |
| 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 | separator
Separator. |
| private final String | suffix
Suffix. |
| private final String | trimmedPrefix
Trimmed prefix. |
| private final String | trimmedSeparator
Trimmed separator. |
| private final String | trimmedSuffix
Trimmed suffix. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | RealVectorFormat(final NumberFormat
the custom format for components. format)Create an instance with a custom number format for components. |
| public | RealVectorFormat(final String
prefix to use instead of the default "{" prefix, final String suffix to use instead of the default "}" suffix, final String separator to use instead of the default "; " separator)Create an instance with custom prefix, suffix and separator. |
| public | RealVectorFormat(final String
prefix to use instead of the default "{" prefix, final String suffix to use instead of the default "}" suffix, final String separator to use instead of the default "; " separator, 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 vector.RealVector object to format. v)This method calls |
| public StringBuffer | Returns: the value passed in as toAppendTo.the object to format. vector, 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 NumberFormat | |
| public static RealVectorFormat | Returns: the default real vector format.Returns the default real vector format for the current locale. |
| public static RealVectorFormat | 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 | |
| public ArrayRealVector | Returns: the parsedRealVector object.String to parse. source)Parse a string to produce a |
| public ArrayRealVector | Returns: the parsedRealVector object.String to parse. source, ParsePosition input/ouput parsing parameter. pos)Parse a string to produce a |
| DEFAULT_PREFIX | back to summary |
|---|---|
| private static final String DEFAULT_PREFIX The default prefix: "{". | |
| DEFAULT_SEPARATOR | back to summary |
|---|---|
| private static final String DEFAULT_SEPARATOR The default separator: ", ". | |
| 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. | |
| separator | back to summary |
|---|---|
| private final String separator Separator. | |
| suffix | back to summary |
|---|---|
| private final String suffix Suffix. | |
| trimmedPrefix | back to summary |
|---|---|
| private final String trimmedPrefix Trimmed prefix. | |
| trimmedSeparator | back to summary |
|---|---|
| private final String trimmedSeparator Trimmed separator. | |
| trimmedSuffix | back to summary |
|---|---|
| private final String trimmedSuffix Trimmed suffix. | |
| RealVectorFormat | back to summary |
|---|---|
| public RealVectorFormat() Create an instance with default settings. The instance uses the default prefix, suffix and separator: "{", "}", and "; " and the default number format for components. | |
| RealVectorFormat | back to summary |
|---|---|
| public RealVectorFormat(final NumberFormat format) Create an instance with a custom number format for components.
| |
| RealVectorFormat | back to summary |
|---|---|
| public RealVectorFormat(final String prefix, final String suffix, final String separator) Create an instance with custom prefix, suffix and separator. | |
| RealVectorFormat | back to summary |
|---|---|
| public RealVectorFormat(final String prefix, final String suffix, final String separator, final NumberFormat format) Create an instance with custom prefix, suffix, separator and format for components.
| |
| format | back to summary |
|---|---|
| public String format(RealVector v) This method calls
| |
| format | back to summary |
|---|---|
| public StringBuffer format(RealVector vector, 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
| |
| getFormat | back to summary |
|---|---|
| public NumberFormat getFormat() Get the components format.
| |
| getInstance | back to summary |
|---|---|
| public static RealVectorFormat getInstance() Returns the default real vector format for the current locale.
| |
| getInstance | back to summary |
|---|---|
| public static RealVectorFormat 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.
| |
| getSeparator | back to summary |
|---|---|
| public String getSeparator() Get the format separator between components.
| |
| getSuffix | back to summary |
|---|---|
| public String getSuffix() Get the format suffix.
| |
| parse | back to summary |
|---|---|
| public ArrayRealVector parse(String source) Parse a string to produce a
| |
| parse | back to summary |
|---|---|
| public ArrayRealVector parse(String source, ParsePosition pos) Parse a string to produce a
| |