| java.lang.Object | |||
| ↳ | java.text.Format | ||
| ↳ | java.text.NumberFormat | ||
| ↳ | java.text.ChoiceFormat | ||
ChoiceFormat is used to associate strings with ranges of double values. The strings and ranges are either specified using arrays or with a pattern which is parsed to determine the Strings and ranges.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.text.NumberFormat
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new ChoiceFormat with the specified ranges and associated
strings.
| |||||||||||
Constructs a new ChoiceFormat with the strings and ranges parsed from the
specified pattern.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Parses the pattern to determine new strings and ranges for this
ChoiceFormat.
| |||||||||||
Returns a new instance of ChoiceFormat with the same ranges and strings
as this ChoiceFormat.
| |||||||||||
Compares the specified object to this ChoiceFormat and answer if they are
equal.
| |||||||||||
Appends to the specified StringBuffer the string associated with the
range in which the specified double value fits.
| |||||||||||
Appends to the specified StringBuffer the string associated with the
range in which the specified long value fits.
| |||||||||||
Returns the Strings associated with the ranges of this ChoiceFormat.
| |||||||||||
Returns the ranges of this ChoiceFormat.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Returns the double value which is closest to the specified double but
larger.
| |||||||||||
Returns the double value which is closest to the specified double but
either larger or smaller as specified.
| |||||||||||
Parse a Double from the specified String starting at the index specified
by the ParsePosition.
| |||||||||||
Returns the double value which is closest to the specified double but
smaller.
| |||||||||||
Sets the ranges and associated strings of this ChoiceFormat.
| |||||||||||
Returns the pattern of this ChoiceFormat which specified the ranges and
their associated strings.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.text.NumberFormat
| |||||||||||
From class java.text.Format
| |||||||||||
From class java.lang.Object
| |||||||||||
Constructs a new ChoiceFormat with the specified ranges and associated strings.
| limits | an array of double, the ranges are greater or equal to the value in lower index up to less than the value in the next higher index. The bounds of the lowest and highest indexes are negative and positive infinity. |
|---|---|
| formats | the strings associated with the ranges. The lower bound of the associated range is at the same index as the string. |
Constructs a new ChoiceFormat with the strings and ranges parsed from the specified pattern.
| template | the pattern of strings and ranges |
|---|
| IllegalArgumentException | then an error occurs parsing the pattern |
|---|
Parses the pattern to determine new strings and ranges for this ChoiceFormat.
| template | the pattern of strings and ranges |
|---|
| IllegalArgumentException | then an error occurs parsing the pattern |
|---|
Returns a new instance of ChoiceFormat with the same ranges and strings as this ChoiceFormat.
Compares the specified object to this ChoiceFormat and answer if they are equal. The object must be an instance of ChoiceFormat and have the same limits and formats.
| object | the object to compare with this object |
|---|
Appends to the specified StringBuffer the string associated with the range in which the specified double value fits.
| value | the double to format |
|---|---|
| buffer | the StringBuffer |
| field | a FieldPosition which is ignored |
buffer
Appends to the specified StringBuffer the string associated with the range in which the specified long value fits.
| value | the long to format |
|---|---|
| buffer | the StringBuffer |
| field | a FieldPosition which is ignored |
buffer
Returns the Strings associated with the ranges of this ChoiceFormat.
Returns the ranges of this ChoiceFormat.
Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.
Returns the double value which is closest to the specified double but larger.
| value | a double value |
|---|
Returns the double value which is closest to the specified double but either larger or smaller as specified.
| value | a double value |
|---|---|
| increment | true to get a larger value, false to get a smaller value |
Parse a Double from the specified String starting at the index specified by the ParsePosition. The String is compared to the strings of this ChoiceFormat and if a match occurs, the answer is the lower bound of the corresponding range. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
| string | the String to parse |
|---|---|
| position | the ParsePosition, updated on return with the index following the parsed text, or on error the index is unchanged and the error index is set to the index where the error occurred |
Returns the double value which is closest to the specified double but smaller.
| value | a double value |
|---|
Sets the ranges and associated strings of this ChoiceFormat.
| limits | an array of double, the ranges are greater or equal to the value in lower index up to less than the value in the next higher index. The bounds of the lowest and highest indexes are negative and positive infinity. |
|---|---|
| formats | the strings associated with the ranges. The lower bound of the range is at the same index as the string. |
Returns the pattern of this ChoiceFormat which specified the ranges and their associated strings.