|
ArciMath BigDecimal v2.05 now with BigDecimalFormat |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--java.text.Format
|
+--be.arci.text.BigDecimalFormat
BigDecimalFormat is an implementation of java.text.Format that parses and formats (large) decimal numbers. Many new options and features of BigDecimalFormat make it much more advanced than the standard java.text.DecimalFormat (we use the unqualified class name DecimalFormat further on). Therefor we decided to let BigDecimalFormat format not only ArciMath BigDecimal numbers, but also all Java's primitive numeric types, Java's standard large number classes java.math.BigInteger and java.math.BigDecimal, and all Number objects having a decimal String representation, like com.ibm.math.BigDecimal and com.tce.math.TBigDecimal.
BigDecimalFormat's parsing is very lenient, to accept common user input styles as well as output from BigDecimalFormat's own format methods.
BigDecimalFormat uses intermediate ArciMath BigDecimal objects for all arithmetic, rounding, and toString() representation.
For access to member descriptions use the navigation bar on top.
Also, BigDecimalFormat uses the ArciMath BigDecimal class for all arithmetic, which offers a very strong protection against overflow both by the range of numbers that can be represented as ArciMath BigDecimal objects, and by ArciMath's performant but safe algorithms, throwing an ArithmeticException on overflow.
BigDecimalFormat outputs decimal digits starting with the DecimalFormatSymbols- defined localized zero digit; as an example the decimal digit 5 is output as (char)(decimalFormatSymbols.getZeroDigit() + 5). During parsing BigDecimalFormat recognizes all Unicode characters that represent decimal digits, as defined by Character.digit(), as well as the ten consecutive characters starting with the localized zero digit defined in the DecimalFormatSymbols object. Thus BigDecimalFormat makes it possible to parse and format numbers in any locale where the decimal digits ocupy 10 consecutive places in de Unicode character table, offering support for Western (ISO-LATIN-1), Arabic-Indic, Extended Arabic-Indic, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Telugu, Kannada, Malayalam, Thai, Lao, Tibetan and Fullwidth digits.
For localization BigDecimalFormat builds on DecimalFormat, rather than directly parsing the localization rules in the java.text.resources.LocaleElements_xx_XX group of classfiles, because the latter are undocumented and indeed differ in different JDK versions.
The default BigDecimalFormat() constructor starts from a default
DecimalFormat object. The BigDecimalFormat(DecimalFormat)
constructor accepts the localized DecimalFormat objects typically delivered
by calls to java.text.NumberFormat's getNumberInstance,
getCurrencyInstance, getPercentInstance and
getScientificInstance methods.
(Currently, upto JDK13, all of these methods in NumberFormat are
hardcoded to return a DecimalFormat object, even though it is documented that
for some locales NumberFormat might return another type).
DecimalFormat patterns should all be compatible with BigDecimalFormat,
though the reverse is certainly not true.
The usual symbol for indicating the exponent is "E", but the user can set any other String to be used as exponent symbol (this should be a feature of DecimalFormatSymbols, but it isn't, and because DecimalFormatSymbols is final we made it a feature of BigDecimalFormat itself).
Negative exponents are formatted using the localized minus sign, not the prefix and suffix from the negative subpattern. This allows notations such as "(1.17E+5)" for the value -117,000. For positive exponents the user can specify to show a plus sign following the exponent symbol or not.
With exponent increments, formatting rounds the number to the sum of the actual integer digits that will be shown and the maximum number of decimal places (in DecimalFormat the number of formatted digits is fixed at 1 + the number of decimal places, making that some digits may get shifted from the decimal places into the integer field to make the exponent a multiple of it's increment). For example the pattern "000.0000E+03" sets a fixed length engineering format with 3 integer digits and 4 decimal places, and an exponent value of 2 digits.
setZeroPaddingChar().
The latter kind may be specified either through the API or through
the pattern syntax. Alignment is made easier if you keep positive and negative
prefix and positive and negative suffixes the same length.
For example, you can use FieldPosition to align numbers on the decimal point in two ways:
Note: JDK1.1 We cannot set the FieldPosition indexes in the JDK1.1.x version, due to a bug in java.text.FieldPosition (package private access to the relevant methods). However, we have noticed that the Java 2 version of BigDecimalFormat, that does set the FieldPosition indexes, works fine on Sun's JDK1.1.x virtual machines; apparently these virtual machines check for method accessibility at compile time only, not at runtime. As the FieldPosition treatment is the only difference between the JDK1.1 and Java2 versions of BigDecimalFormat, you could use the Java2 version on these virtual machines.
strict parsing adherence to the different
parts in a BigDecimal pattern.
If BigDecimalFormat.parse(String, ParsePosition) fails to parse
a String, it returns null and leaves the parse position
unchanged. The convenience method BigDecimalFormat.parse(String)
indicates parse failure by throwing a ParseException.
Here are the rules for lenient parsing; see the description of strict parsing
for possible areas of strict parsing:
parse integer only is set, parsing stops at the decimal separator, if any.
Decimal places, exponent or suffix that are present in the input but that
come after a decimal separator are ignored. ParsePosition index is set
at that decimal separator.
applyPattern() and
applyLocalizedPattern(), or indirectly using the API methods. When
using the default BigDecimalFormat() or the
BigDecimalFormat(DecimalFormat) constructors, the pattern and symbols
are read from the (default) DecimalFormat object.
Contains:
decimalFormatSymbols: these are the symbols used in localized patterns,
in format() and in parse()
exponentSymbol: logically belongs to DecimalFormatSymbols
parseIntegerOnly: is deprecated, affects parsing only
parsingStrictness: affects parsing only, sets the degree
to which a parsed number String should complie with different parts of a BigDecimalFormat
pattern.
plusSign: logically belongs to DecimalFormatSymbols
retainZeroTail: is in a strict sense a property of ArciMath BigDecimal, which
you can choose to respect in BigDecimalFormat.
rounding mode: sets the rounding mode used in calculations for truncating formatted
numbers and for applying multiplier and smallestModule
signalOverflow: sets strict interpretation of pattern maxima
smallestModule: can only be set through a pattern as a fixed point number, not if
exponential notation is needed to specify the smallestModule
zeroPaddingChar: we already had mixed feelings about the padding escape, so we decided not
to introduce another notation for the zeroPaddingChar
decimal separator
|
integer | decimal exponent
/ \|/ \ / \
(optional prefix)#,###,#00.0000####E+000##(optional suffix)
/ \ / ^
last grouping grouping optional, to always
separator size show the exponent sign
| + | repeat ('1 or more instances of') |
|---|---|
| * | repeat optional ('0 or more instances of') |
| { } | optional ('0 or 1 instances of') |
| [ X | Y | ... | Z ] | choose ('1 of the choices X to Z') |
| ( ) | group ('treat enclosed grammar specification as 1 symbol') |
| X..Y | range ('any of X up to Y, inclusive') |
| S - T | exclude ('symbols in S, except those in T') |
currencySign := '¤'
'¤' is Unicode character '\u00A4'
decimalSep := [ '.' | localizedDecimalSeparator ]
digitPlace := [ '#' | localizedDigit ]
exponentSymbol := [ "E" | localizedExponentSymbol ]
groupingSep := [ ',' | localizedGroupingSeparator ]
padEscape := '^'
patternSep := [ ';' | localizedPatternSeparator ]
percent := [ '%' | localizedPercent ]
perMille := [ '' | localizedPerMill ]
'' is Unicode character '\u2030'
plusSign := [ '+' | localizedPlusSign ]
quote := '\''
The single quote character
zeroDigit := [ '0' | localizedZeroDigit ]
nonZeroDigit := (zeroDigit + 1..9)
This is an arithmetic sum!
digit := [ zeroDigit | nonZeroDigit ]
char := [ ( '\u0000'..'\uFFFD' - quote ) | ( quote quote ) ]
expandedChar := [ percent |
perMille |
currencySign |
( currencySign currencySign ) ]
specialChar := [ currencySign |
decimalSep |
digit |
digitPlace |
groupingSep |
padEscape |
patternSep |
percent |
perMille ]
unquotedChar := [ ( char - specialChar ) | expandedChar ]
quotedChars := quote char+ quote
Grammar
pattern := posPattern { patternSep negPattern }
posPattern := subPattern
negPattern := subPattern
subPattern := [ ( { paddedPrefix } number { suffix } ) |
( { prefix } paddedNumber { suffix } ) |
( { prefix } number { paddedSuffix } ) ]
paddedPrefix := paddedAffix
paddedSuffix := paddedAffix
paddedAffix := [ ( padSpec affix ) | ( affix padSpec ) ]
prefix := affix
suffix := affix
affix := [ unquotedChar | quotedChars ]+
padSpec := padEscape padChar
padChar := char
paddedNumber := fixedPoint { padSpec } exponent
number := fixedPoint exponent
fixedPoint := [ integer |
( integer decimalSep ) |
( { integer } decimalSep mantissa ) ]
integer := [ minIntDigits+ |
( maxIntDigits+ minIntDigits* ) ]
minIntDigits := { groupingSep } digit+
maxIntDigits := { groupingSep } digitPlace+
mantissa := [ minDecPlaces |
( { minDecPlaces } maxDecPlaces ) ]
minDecPlaces := digit+
maxDecPlaces := digitPlace+
exponent := exponentSymbol { plusSign } exponentValue
exponentValue := [ minExpDigits |
( { minExpDigits } maxExpDigits ) ]
minExpDigits := digit+
maxExpDigits := digitPlace+
BigDecimal,
MathContext, Serialized Form| Field Summary | |
static int |
BASE_NUMBER_FIELD
Field constant that can be used to construct a FieldPosition object. |
static char |
CURRENCY_SIGN
The CURRENCY_SIGN is the standard Unicode symbol for currency. |
static int |
DECIMAL_FRACTION_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
DECIMAL_SEPARATOR_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
EXPONENT_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
EXPONENT_SIGN_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
EXPONENT_SYMBOL_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
EXPONENT_VALUE_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
INTEGER_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
NUMBER_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
PAD_AFTER_PREFIX
Constant for getPaddingPosition() and setPaddingPosition(), specifying to insert padding characters after the prefix. |
static int |
PAD_AFTER_SUFFIX
Constant for getPaddingPosition() and setPaddingPosition(), specifying to insert padding characters after the suffix. |
static int |
PAD_BEFORE_EXPONENT
Constant for getPaddingPosition() and setPaddingPosition(), specifying to insert padding characters before the exponent. |
static int |
PAD_BEFORE_PREFIX
Constant for getPaddingPosition() and setPaddingPosition(), specifying to insert padding characters before the prefix. |
static int |
PAD_BEFORE_SUFFIX
Constant for getPaddingPosition() and setPaddingPosition(), specifying to insert padding characters before the suffix. |
static int |
PADDING_FIELD
Field constant that can be used to construct a FieldPosition object. |
static int |
PARSE_LENIENT
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), specifying lenient parsing of number Strings. |
static int |
PARSE_MATCH_AFFIXES
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(). |
static int |
PARSE_MATCH_EXPONENT_SYMBOL
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), allowing only the exponent symbol set for the BigDecimalFormat as exponent symbol in a number String. |
static int |
PARSE_MATCH_GROUPING
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), requiring digit grouping if the grouping size set for the BigDecimalFormat is not zero. |
static int |
PARSE_MATCH_PADDING_CHAR
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), accepting only the padding character set for the BigDecimalFormat as padding in a number String. |
static int |
PARSE_MATCH_PADDING_POS
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), requiring any padding in a number String to occur at the padding position set for the BigDecimalFormat. |
static int |
PARSE_MATCH_PADDING_WIDTH
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), to enforce a correct number of padding characters. |
static int |
PARSE_MATCH_PREFIX
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), requiring a match with either the positive or the negative prefix when parsing a number String. |
static int |
PARSE_MATCH_SEPARATOR_CHARS
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), allowing only the grouping separator and the decimal (or monetary decimal for currency formats) separator characters set for the BigDecimalFormat's java.text.DecimalFormatSymbols as separator characters in a number String. |
static int |
PARSE_MATCH_SIGN_CHARS
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), allowing only the plus sign and minus sign set for the BigDecimalFormat or it's java.text.DecimalFormatSymbols as sign character in a number String. |
static int |
PARSE_MATCH_SUFFIX
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(), requiring a match with either the positive or the negative suffix when parsing a number String. |
static int |
PARSE_STRICT
Parsing strictness constant for getParsingStrictness() and setParsingStrictness(). |
static char |
PER_MILLE_SIGN
The PER_MILLE_SIGN is the standard Unicode symbol for per mille. |
static char |
PERCENT_SIGN
The PERCENT_SIGN is the standard Unicode symbol for percent. |
static int |
PREFIX_FIELD
Field constant that can be used to construct a FieldPosition object. |
static char |
QUOTE
The single quote character to embed special characters in pattern affixes |
static int |
SUFFIX_FIELD
Field constant that can be used to construct a FieldPosition object. |
| Constructor Summary | |
BigDecimalFormat()
Create a BigDecimalFormat using the default pattern and symbols for the default locale. |
|
BigDecimalFormat(java.text.DecimalFormat dfmt)
Convenience method to construct a localized BigDecimalFormat, based on e.g. one of the standard DecimalFormat's for a given locale, obtained using the factory methods on NumberFormat such as getInstance or getCurrencyInstance. |
|
BigDecimalFormat(java.lang.String sPattern)
Create a BigDecimalFormat from the given pattern and the symbols for the default locale. |
|
BigDecimalFormat(java.lang.String sPattern,
java.text.DecimalFormatSymbols dfsSymbols)
Create a BigDecimalFormat from the given pattern and symbols. |
|
BigDecimalFormat(java.lang.String sPattern,
java.util.Locale locale)
Create a BigDecimalFormat from the given pattern and the symbols for the given locale. |
|
| Method Summary | |
void |
applyLocalizedPattern(java.lang.String sLocalizedPattern)
Apply the given localized pattern to this BigDecimalFormat object. |
void |
applyPattern(java.lang.String sPattern)
Apply the given pattern to this BigDecimalFormat object. |
java.lang.Object |
clone()
Standard override; no change in semantics. |
boolean |
equals(java.lang.Object obj)
Overrides equals |
java.lang.String |
format(java.math.BigDecimal bdNumber)
Convenience method which formats a java.math.BigDecimal value to a String according to the pattern represented by this BigDecimalFormat. |
java.lang.String |
format(BigDecimal bdNumber)
Convenience method which formats an ArciMath BigDecimal value to a String according to the pattern represented by this BigDecimalFormat. |
java.lang.StringBuffer |
format(java.math.BigDecimal bdNumber,
java.lang.StringBuffer sbToAppendTo,
java.text.FieldPosition fPos)
Format a java.math.BigDecimal number. |
java.lang.StringBuffer |
format(BigDecimal bdNumber,
java.lang.StringBuffer sbToAppendTo,
java.text.FieldPosition fPos)
Format an ArciMath BigDecimal number. |
java.lang.String |
format(java.math.BigInteger biNumber)
Convenience method which formats a BigInteger value to a String according to the pattern represented by this BigDecimalFormat. |
java.lang.StringBuffer |
format(java.math.BigInteger biNumber,
java.lang.StringBuffer sbToAppendTo,
java.text.FieldPosition fPos)
Format a BigInteger number. |
java.lang.String |
format(double dNumber)
Convenience method which formats the decimal String representation of a double value to a String according to the pattern represented by this BigDecimalFormat. |
java.lang.StringBuffer |
format(double dNumber,
java.lang.StringBuffer sbToAppendTo,
java.text.FieldPosition fPos)
Formats a double value, with proper rendering of NaN and Infinite values. |
java.lang.String |
format(long lNumber)
Convenience method which formats a long value to a String according to the pattern represented by this BigDecimalFormat. |
java.lang.StringBuffer |
format(long lNumber,
java.lang.StringBuffer sbToAppendTo,
java.text.FieldPosition fPos)
Format a long value. |
java.lang.String |
format(java.lang.Number number)
Convenience method which formats the toString() representation of a Number value to a String according to the pattern represented by this BigDecimalFormat. |
java.lang.StringBuffer |
format(java.lang.Number number,
java.lang.StringBuffer sbToAppendTo,
java.text.FieldPosition fPos)
Format a Number. |
java.lang.StringBuffer |
format(java.lang.Object oNumber,
java.lang.StringBuffer sbToAppendTo,
java.text.FieldPosition fPos)
Formats an object to produce a string. |
boolean |
getCurrencyFormat()
true if this object represents a currency format. |
java.text.DecimalFormatSymbols |
getDecimalFormatSymbols()
Returns a clone of the decimal format symbols used by this BigDecimalFormat; changes to the returned object thus have no influence on the BigDecimalFormat. |
boolean |
getDecimalSeparatorAlwaysShown()
Returns wether the decimal separator is shown with integer numbers. |
boolean |
getExponentialNotation()
Return whether or not exponential notation is used. |
int |
getExponentIncrement()
Return the exponent increment used with exponential notation. |
boolean |
getExponentSignAlwaysShown()
Return whether the exponent sign is always shown. |
java.lang.String |
getExponentSymbol()
Get the symbol indicating the exponent in exponential notation and localized patterns. |
int |
getGroupingSize()
Return the grouping size. |
int |
getMaximumDecimalPlaces()
Returns the maximum number of digits to format in the decimal fraction of a number; this value has no effect on parsing. |
int |
getMaximumExponentDigits()
Return the maximum number of digits to format in the exponent value of a number with exponential notation; this value has no effect on parsing. |
int |
getMaximumIntegerDigits()
Returns the maximum number of digits to format in the integer portion of a number; this value has no effect on parsing. |
int |
getMinimumDecimalPlaces()
Returns the minimum number of digits to format in the decimal fraction of a number; this value has no effect on parsing. |
int |
getMinimumExponentDigits()
Return the minimum number of digits required in the exponent value of a number with exponential notation. |
int |
getMinimumIntegerDigits()
Returns the minimum number of digits required in the integer portion of a number. |
int |
getMultiplier()
Get the multiplier for use in percent, permill, etc. |
java.lang.String |
getNegativePrefix()
Get the negative prefix. |
java.lang.String |
getNegativeSuffix()
Get the negative suffix. |
char |
getPaddingChar()
Get the character used to pad a formatted number to the padding width. |
int |
getPaddingPosition()
Get the position at which to pad a formatted number that is shorter than the padding width. |
int |
getPaddingWidth()
Get the width to which the output of format() is to be padded. |
boolean |
getParseIntegerOnly()
Returns true if this format will parse numbers as integers only. |
int |
getParsingStrictness()
Returns the parsing strictness for this BigDecimalFormat. |
char |
getPlusSign()
Get the symbol indicating the localized plus sign. |
java.lang.String |
getPositivePrefix()
Get the positive prefix. |
java.lang.String |
getPositiveSuffix()
Get the positive suffix. |
boolean |
getRetainZeroTail()
Returns whether trailing zero digits in a number will be formatted as significand. |
int |
getRoundingMode()
Get the rounding mode used in rounding numbers to the maximum decimal places and to multiples of the smallest module, and in dividing parsed numbers by the multiplier property. |
boolean |
getSignalOverflow()
Return whether or not overflow is signalled during formatting. |
BigDecimal |
getSmallestModule()
Get the smallest modules to which this BigDecimalFormat rounds formatted numbers. |
int |
getZeroPaddingChar()
Get the character used to replace non-significant zeroes. |
int |
hashCode()
Overrides hashCode |
BigDecimal |
parse(java.lang.String sNumber)
Convenience method to parse a number from a String. |
BigDecimal |
parse(java.lang.String sNumber,
java.text.ParsePosition ppStatus)
Returns an ArciMath BigDecimal number parsed from the String argument. |
java.lang.Object |
parseObject(java.lang.String sNumber,
java.text.ParsePosition ppStatus)
Parses a String to produce an ArciMath BigDecimal object. |
void |
setCurrencyFormat(boolean swCurrencyFormat)
Set to true if this object has to represent a currency format. |
void |
setDecimalFormatSymbols(java.text.DecimalFormatSymbols dfsSymbols)
Sets the decimal format symbols to a clone of the argument; later changes to the argument thus have no influence on the BigDecimalFormat. |
void |
setDecimalSeparatorAlwaysShown(boolean swDecimalSeparatorAlwaysShown)
Sets wether the decimal separator is to be shown with integer numbers. |
void |
setExponentialNotation(boolean swExponentialNotation)
Set whether or not exponentional notation is used. |
void |
setExponentIncrement(int iExponentIncrement)
Sets the exponent increment used with exponential notation. |
void |
setExponentSignAlwaysShown(boolean swExponentSignAlwaysShown)
Set whether the exponent sign is always shown. |
void |
setExponentSymbol(java.lang.String sExponentSymbol)
Set the symbol indicating the exponent in exponential notation and localized patterns. |
void |
setGroupingSize(int iGroupingSize)
Set the grouping size. |
void |
setMaximumDecimalPlaces(int iMaximumDecimalPlaces)
Sets the maximum number of digits to format in the decimal fraction of a number; this value has no effect on parsing. maximumDecimalPlaces must be >= minimumDecimalPlaces. |
void |
setMaximumExponentDigits(int iMaximumExponentDigits)
Set the maximum number of digits to format in the exponent value of a number with exponential notation; this value has no effect on parsing. |
void |
setMaximumIntegerDigits(int iMaximumIntegerDigits)
Sets the maximum number of digits to format in the integer portion of a number; this value has no effect on parsing. maximumIntegerDigits must be >= minimumIntegerDigits. |
void |
setMinimumDecimalPlaces(int iMinimumDecimalPlaces)
Sets the minimum number of digits to format in the decimal fraction of a number; this value has no effect on parsing. minimumDecimalPlaces must be <= maximumDecimalPlaces. |
void |
setMinimumExponentDigits(int iMinimumExponentDigits)
Set the minimum number of digits required in the exponent value of a number with exponential notation. |
void |
setMinimumIntegerDigits(int iMinimumIntegerDigits)
Sets the minimum number of digits to format in the integer portion of a number; this value has no effect on parsing. minimumIntegerDigits must be <= maximumIntegerDigits. |
void |
setMultiplier(int iMultiplier)
Set the multiplier for use in percent, permill, etc. |
void |
setNegativePrefix(java.lang.String sNegativePrefix)
Set the negative prefix. |
void |
setNegativeSuffix(java.lang.String sNegativeSuffix)
Set the negative suffix. |
void |
setPaddingChar(char cPaddingChar)
Set the character used to pad a formatted number to the padding width. |
void |
setPaddingPosition(int iPaddingPosition)
Set the position at which to pad a formatted number that is shorter than the padding width. |
void |
setPaddingWidth(int iPaddingWidth)
Set the width to which the output of format() is to be padded. |
void |
setParseIntegerOnly(boolean swParseIntegerOnly)
Deprecated. This method is retained for compatibility with DecimalFormat only; we advise to obtain an integer number from the fully parsed ArciMath BigDecimal result, e.g. by the operation bdResult.setScale(0, roundingMode) |
void |
setParsingStrictness(int iParsingStrictness)
Sets the parsing strictness for this BigDecimalFormat. |
void |
setPlusSign(char cPlusSign)
Set the symbol indicating the localized plus sign. |
void |
setPositivePrefix(java.lang.String sPositivePrefix)
Set the positive prefix. |
void |
setPositiveSuffix(java.lang.String sPositiveSuffix)
Set the positive suffix. |
void |
setRetainZeroTail(boolean swRetainZeroTail)
Set whether trailing zero digits in a number will be formatted as significand. |
void |
setRoundingMode(int iRoundingMode)
Get the rounding mode used in rounding numbers to the maximum decimal places and to multiples of the smallest module, and in dividing parsed numbers by the multiplier property. |
void |
setSignalOverflow(boolean swSignalOverflow)
Set whether or not overflow is signalled on formatting. |
void |
setSmallestModule(BigDecimal bdSmallestModule)
Set the smallest modules to which this BigDecimalFormat rounds formatted numbers. |
void |
setZeroPaddingChar(int iZeroPaddingChar)
Set the character used to replace non-significant zeroes. |
| Methods inherited from class java.text.Format |
format, parseObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final char QUOTE
public static final char PERCENT_SIGN
setMultiplier(int),
setDecimalFormatSymbols(java.text.DecimalFormatSymbols)public static final char PER_MILLE_SIGN
setMultiplier(int),
setDecimalFormatSymbols(java.text.DecimalFormatSymbols)public static final char CURRENCY_SIGN
The CURRENCY_SIGN is not localized.
public static final int PREFIX_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int INTEGER_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int DECIMAL_SEPARATOR_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int DECIMAL_FRACTION_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int BASE_NUMBER_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int EXPONENT_SYMBOL_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int EXPONENT_SIGN_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int EXPONENT_VALUE_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int EXPONENT_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int NUMBER_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int SUFFIX_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int PADDING_FIELD
Note: In the JDK1.1 version the FieldPosition indexes are not set (see "FieldPosition alignment")
public static final int PAD_BEFORE_PREFIX
setPaddingPosition(int),
getPaddingPosition(),
PAD_AFTER_PREFIX,
PAD_BEFORE_EXPONENT,
PAD_BEFORE_SUFFIX,
PAD_AFTER_SUFFIXpublic static final int PAD_AFTER_PREFIX
setPaddingPosition(int),
getPaddingPosition(),
PAD_BEFORE_PREFIX,
PAD_BEFORE_EXPONENT,
PAD_BEFORE_SUFFIX,
PAD_AFTER_SUFFIXpublic static final int PAD_BEFORE_EXPONENT
setPaddingPosition(int),
getPaddingPosition(),
PAD_BEFORE_PREFIX,
PAD_AFTER_PREFIX,
PAD_AFTER_SUFFIXpublic static final int PAD_BEFORE_SUFFIX
setPaddingPosition(int),
getPaddingPosition(),
PAD_BEFORE_PREFIX,
PAD_AFTER_PREFIX,
PAD_BEFORE_EXPONENT,
PAD_AFTER_SUFFIXpublic static final int PAD_AFTER_SUFFIX
setPaddingPosition(int),
getPaddingPosition(),
PAD_BEFORE_PREFIX,
PAD_AFTER_PREFIX,
PAD_BEFORE_EXPONENT,
PAD_BEFORE_SUFFIXpublic static final int PARSE_LENIENT
setParsingStrictness(int),
getParsingStrictness(),
PARSE_STRICTpublic static final int PARSE_MATCH_PREFIX
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants, except with PARSE_MATCH_SIGN_CHARS.
getPositivePrefix(),
getNegativePrefix(),
setParsingStrictness(int),
getParsingStrictness(),
PARSE_MATCH_SUFFIX,
PARSE_MATCH_AFFIXESpublic static final int PARSE_MATCH_SUFFIX
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants.
getPositiveSuffix(),
getNegativeSuffix(),
setParsingStrictness(int),
getParsingStrictness(),
PARSE_MATCH_PREFIX,
PARSE_MATCH_AFFIXESpublic static final int PARSE_MATCH_AFFIXES
setParsingStrictness(int),
getParsingStrictness(),
PARSE_MATCH_PREFIX,
PARSE_MATCH_SUFFIXpublic static final int PARSE_MATCH_PADDING_CHAR
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants.
setParsingStrictness(int),
getParsingStrictness(),
getPaddingChar(),
PARSE_MATCH_PADDING_POS,
PARSE_MATCH_PADDING_WIDTHpublic static final int PARSE_MATCH_PADDING_POS
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants.
setParsingStrictness(int),
getParsingStrictness(),
getPaddingChar(),
PARSE_MATCH_PADDING_CHAR,
PARSE_MATCH_PADDING_WIDTHpublic static final int PARSE_MATCH_PADDING_WIDTH
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants.
setParsingStrictness(int),
getParsingStrictness(),
getPaddingChar(),
PARSE_MATCH_PADDING_CHAR,
PARSE_MATCH_PADDING_POSpublic static final int PARSE_MATCH_SIGN_CHARS
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants, except with PARSE_MATCH_PREFIX.
getPlusSign(),
"java.text.DecimalFormatSymbols.getMinusSign()",
setParsingStrictness(int),
getParsingStrictness()public static final int PARSE_MATCH_SEPARATOR_CHARS
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants.
getCurrencyFormat(),
setParsingStrictness(int),
getParsingStrictness(),
PARSE_MATCH_GROUPINGpublic static final int PARSE_MATCH_EXPONENT_SYMBOL
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants.
getExponentSymbol(),
setParsingStrictness(int),
getParsingStrictness()public static final int PARSE_MATCH_GROUPING
This constant can be combined ('|' operator) with other PARSE_MATCH_xxx constants.