Minus signs are only allowed in the whole number part - i.e.,
"-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and
will result in a ParseException.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| private NumberFormat | wholeFormat
The format used for the whole number. |
| Access | Constructor and Description |
|---|---|
| public | ProperFractionFormat()
Create a proper formatting instance with the default number format for the whole, numerator, and denominator. |
| public | ProperFractionFormat(NumberFormat
the custom format for the whole, numerator, and
denominator. format)Create a proper formatting instance with a custom number format for the whole, numerator, and denominator. |
| public | ProperFractionFormat(NumberFormat
the custom format for the whole. wholeFormat, NumberFormat the custom format for the numerator. numeratorFormat, NumberFormat the custom format for the denominator. denominatorFormat)Create a proper formatting instance with a custom number format for each of the whole, numerator, and denominator. |
| Modifier and Type | Method and Description |
|---|---|
| public StringBuffer | Returns: the value passed in as toAppendTo.the object to format. fraction, 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)Overrides org. Formats a |
| public NumberFormat | |
| public Fraction | Returns: the parsedFraction object.the string to parse source, ParsePosition input/ouput parsing parameter. pos)Overrides org. Parses a string to produce a |
| public void |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serializable version identifier | |
| wholeFormat | back to summary |
|---|---|
| private NumberFormat wholeFormat The format used for the whole number. | |
| ProperFractionFormat | back to summary |
|---|---|
| public ProperFractionFormat() Create a proper formatting instance with the default number format for the whole, numerator, and denominator. | |
| ProperFractionFormat | back to summary |
|---|---|
| public ProperFractionFormat(NumberFormat format) Create a proper formatting instance with a custom number format for the whole, numerator, and denominator.
| |
| ProperFractionFormat | back to summary |
|---|---|
| public ProperFractionFormat(NumberFormat wholeFormat, NumberFormat numeratorFormat, NumberFormat denominatorFormat) Create a proper formatting instance with a custom number format for each of the whole, numerator, and denominator.
| |
| format | back to summary |
|---|---|
| public StringBuffer format(Fraction fraction, StringBuffer toAppendTo, FieldPosition pos) Overrides org. Formats a
| |
| getWholeFormat | back to summary |
|---|---|
| public NumberFormat getWholeFormat() Access the whole format.
| |
| parse | back to summary |
|---|---|
| public Fraction parse(String source, ParsePosition pos) Overrides org. Parses a string to produce a
Minus signs are only allowed in the whole number part - i.e.,
"-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and
will result in a
| |
| setWholeFormat | back to summary |
|---|---|
| public void setWholeFormat(NumberFormat format) Modify the whole format.
| |