public class ExponentialFormat
extends java.text.NumberFormat
Modified by: Joseph A. Huwaldt
Format
,
NumberFormat
,
Serialized FormConstructor and Description |
---|
ExponentialFormat()
Construct an exponential format using default settings.
|
ExponentialFormat(java.text.DecimalFormat format)
Create an ExponentialFormat based on the given format.
|
ExponentialFormat(java.util.Locale locale)
Construct an exponential format using the specified Locale.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Create a deep copy of this number format object.
|
boolean |
equals(java.lang.Object obj)
Overrides equals
|
java.lang.StringBuffer |
format(double number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Format a double to produce a string.
|
java.lang.StringBuffer |
format(long number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Format a long to produce a string.
|
int |
getMaximumFractionDigits()
Returns the maximum number of digits allowed in the fraction portion of a number.
|
int |
getMinimumExponentDigits()
Return the minimum number of digits being used to represent the exponent when
formatting a number.
|
int |
getMinimumFractionDigits()
Returns the minimum number of digits allowed in the fraction portion of a number.
|
java.math.RoundingMode |
getRoundingMode()
Gets the RoundingMode used in this NumberFormat.
|
int |
hashCode()
Overrides hashCode
|
static void |
main(java.lang.String[] args)
A simple static method to test this class.
|
java.lang.Number |
parse(java.lang.String text,
java.text.ParsePosition parsePosition)
Returns an instance of Number with a value matching the given string.
|
void |
setMaximumFractionDigits(int newValue)
Sets the maximum number of digits allowed in the fraction portion of a number.
|
void |
setMinimumExponentDigits(int number)
Set the minimum number of digits to use for the exponent when formatting a
number.
|
void |
setMinimumFractionDigits(int newValue)
Sets the minimum number of digits allowed in the fraction portion of a number.
|
void |
setRoundingMode(java.math.RoundingMode roundingMode)
Sets the RoundingMode used in this NumberFormat.
|
format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumIntegerDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumIntegerDigits, setMinimumIntegerDigits, setParseIntegerOnly
public ExponentialFormat()
public ExponentialFormat(java.util.Locale locale)
public ExponentialFormat(java.text.DecimalFormat format)
format
- The decimal format that will parse parts of the exponential.public void setMinimumExponentDigits(int number)
public int getMinimumExponentDigits()
public void setMaximumFractionDigits(int newValue)
setMaximumFractionDigits
in class java.text.NumberFormat
public int getMaximumFractionDigits()
getMaximumFractionDigits
in class java.text.NumberFormat
public int getMinimumFractionDigits()
getMinimumFractionDigits
in class java.text.NumberFormat
public void setMinimumFractionDigits(int newValue)
setMinimumFractionDigits
in class java.text.NumberFormat
public void setRoundingMode(java.math.RoundingMode roundingMode)
setRoundingMode
in class java.text.NumberFormat
public java.math.RoundingMode getRoundingMode()
getRoundingMode
in class java.text.NumberFormat
public java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.NumberFormat
number
- The double to format.toAppendTo
- Where the text is to be appended.pos
- On input: an alignment field, if desired.
On output: the offsets of the alignment fieldpublic java.lang.StringBuffer format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.NumberFormat
number
- The double to format.toAppendTo
- Where the text is to be appended.pos
- On input: an alignment field, if desired.
On output: the offsets of the alignment fieldpublic java.lang.Number parse(java.lang.String text, java.text.ParsePosition parsePosition)
parse
in class java.text.NumberFormat
text
- The String to be parsed. Performance can be greatly enhanced
if all "+" signs are removed from the text before parsing.parsePosition
- On entry, where to begin parsing; on exit,
just past the last parsed character. If parsing fails, the
index will not move and the error index will be set.public java.lang.Object clone()
clone
in class java.text.NumberFormat
public boolean equals(java.lang.Object obj)
equals
in class java.text.NumberFormat
public int hashCode()
hashCode
in class java.text.NumberFormat
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception