| java.lang.Object java.text.Format java.text.NumberFormat java.text.ChoiceFormat
ChoiceFormat | public class ChoiceFormat extends NumberFormat (Code) | | 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.
|
Constructor Summary | |
public | ChoiceFormat(double[] limits, String[] formats) Constructs a new ChoiceFormat with the specified ranges and associated
strings.
Parameters: limits - an array of double, the ranges are greater or equal to thevalue in lower index up to less than the value in the nexthigher index. | public | ChoiceFormat(String template) Constructs a new ChoiceFormat with the strings and ranges parsed from the
specified pattern. |
Method Summary | |
public void | applyPattern(String template) Parses the pattern to determine new strings and ranges for this
ChoiceFormat. | public Object | clone() Answers a new instance of ChoiceFormat with the same ranges and strings
as this ChoiceFormat. | public boolean | equals(Object object) Compares the specified object to this ChoiceFormat and answer if they are
equal. | public StringBuffer | format(double value, StringBuffer buffer, FieldPosition field) Appends to the specified StringBuffer the string associated with the
range in which the specified double value fits. | public StringBuffer | format(long value, StringBuffer buffer, FieldPosition field) Appends to the specified StringBuffer the string associated with the
range in which the specified long value fits. | public Object[] | getFormats() Answers the Strings associated with the ranges of this ChoiceFormat. | public double[] | getLimits() Answers the ranges of this ChoiceFormat.
an array of double, the ranges are greater or equal to the valuein lower index up to less than the value in the next higherindex. | public int | hashCode() Answers an integer hash code for the receiver. | final public static double | nextDouble(double value) Answers the double value which is closest to the specified double but
larger. | public static double | nextDouble(double value, boolean increment) Answers the double value which is closest to the specified double but
either larger or smaller as specified. | public Number | parse(String string, ParsePosition position) Parse a Double from the specified String starting at the index specified
by the ParsePosition. | final public static double | previousDouble(double value) Answers the double value which is closest to the specified double but
smaller. | public void | setChoices(double[] limits, String[] formats) Sets the ranges and associated strings of this ChoiceFormat.
Parameters: limits - an array of double, the ranges are greater or equal to thevalue in lower index up to less than the value in the nexthigher index. | public String | toPattern() Answers the pattern of this ChoiceFormat which specified the ranges and
their associated strings. |
ChoiceFormat | public ChoiceFormat(double[] limits, String[] formats)(Code) | | Constructs a new ChoiceFormat with the specified ranges and associated
strings.
Parameters: limits - an array of double, the ranges are greater or equal to thevalue in lower index up to less than the value in the nexthigher index. The bounds of the lowest and highest indexes arenegative and positive infinity. Parameters: formats - the strings associated with the ranges. The lower bound of theassociated range is at the same index as the string. |
ChoiceFormat | public ChoiceFormat(String template)(Code) | | Constructs a new ChoiceFormat with the strings and ranges parsed from the
specified pattern.
Parameters: template - the pattern of strings and ranges exception: IllegalArgumentException - then an error occurs parsing the pattern |
applyPattern | public void applyPattern(String template)(Code) | | Parses the pattern to determine new strings and ranges for this
ChoiceFormat.
Parameters: template - the pattern of strings and ranges exception: IllegalArgumentException - then an error occurs parsing the pattern |
clone | public Object clone()(Code) | | Answers a new instance of ChoiceFormat with the same ranges and strings
as this ChoiceFormat.
a shallow copy of this ChoiceFormat See Also: java.lang.Cloneable |
equals | public boolean equals(Object object)(Code) | | 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.
Parameters: object - the object to compare with this object true if the specified object is equal to this ChoiceFormat, falseotherwise See Also: ChoiceFormat.hashCode |
format | public StringBuffer format(double value, StringBuffer buffer, FieldPosition field)(Code) | | Appends to the specified StringBuffer the string associated with the
range in which the specified double value fits.
Parameters: value - the double to format Parameters: buffer - the StringBuffer Parameters: field - a FieldPosition which is ignored the StringBuffer parameter buffer |
format | public StringBuffer format(long value, StringBuffer buffer, FieldPosition field)(Code) | | Appends to the specified StringBuffer the string associated with the
range in which the specified long value fits.
Parameters: value - the long to format Parameters: buffer - the StringBuffer Parameters: field - a FieldPosition which is ignored the StringBuffer parameter buffer |
getFormats | public Object[] getFormats()(Code) | | Answers the Strings associated with the ranges of this ChoiceFormat.
an array of String |
getLimits | public double[] getLimits()(Code) | | Answers the ranges of this ChoiceFormat.
an array of double, the ranges are greater or equal to the valuein lower index up to less than the value in the next higherindex. The bounds of the lowest and highest indexes are negativeand positive infinity. |
hashCode | public int hashCode()(Code) | | Answers an integer hash code for the receiver. Objects which are equal
answer the same value for this method.
the receiver's hash See Also: ChoiceFormat.equals |
nextDouble | final public static double nextDouble(double value)(Code) | | Answers the double value which is closest to the specified double but
larger.
Parameters: value - a double value the next larger double value |
nextDouble | public static double nextDouble(double value, boolean increment)(Code) | | Answers the double value which is closest to the specified double but
either larger or smaller as specified.
Parameters: value - a double value Parameters: increment - true to get a larger value, false to get a smaller value the next larger or smaller double value |
parse | public Number parse(String string, ParsePosition position)(Code) | | 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.
Parameters: string - the String to parse Parameters: position - the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred a Double resulting from the parse, or Double.NaN if there is anerror |
previousDouble | final public static double previousDouble(double value)(Code) | | Answers the double value which is closest to the specified double but
smaller.
Parameters: value - a double value the next smaller double value |
setChoices | public void setChoices(double[] limits, String[] formats)(Code) | | Sets the ranges and associated strings of this ChoiceFormat.
Parameters: limits - an array of double, the ranges are greater or equal to thevalue in lower index up to less than the value in the nexthigher index. The bounds of the lowest and highest indexes arenegative and positive infinity. Parameters: formats - the strings associated with the ranges. The lower bound of therange is at the same index as the string. |
toPattern | public String toPattern()(Code) | | Answers the pattern of this ChoiceFormat which specified the ranges and
their associated strings.
the pattern |
Methods inherited from java.text.Format | public Object clone()(Code)(Java Doc) String convertPattern(String template, String fromChars, String toChars, boolean check)(Code)(Java Doc) final public String format(Object object)(Code)(Java Doc) abstract public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)(Code)(Java Doc) public AttributedCharacterIterator formatToCharacterIterator(Object object)(Code)(Java Doc) static Object getInternalField(String fieldName, Object target)(Code)(Java Doc) public Object parseObject(String string) throws ParseException(Code)(Java Doc) abstract public Object parseObject(String string, ParsePosition position)(Code)(Java Doc) static boolean upTo(String string, ParsePosition position, StringBuffer buffer, char stop)(Code)(Java Doc) static boolean upToWithQuotes(String string, ParsePosition position, StringBuffer buffer, char stop, char start)(Code)(Java Doc)
|
|
|