static class Format.NumericFormat extends Format.JavaFormat
Format.BasicFormat
which
prints numbers with a given number of decimal places, leading zeroes, in
exponential notation, etc.
It is implemented using MondrianFloatingDecimal
.
Modifier and Type | Field and Description |
---|---|
(package private) ArrayStack<Integer> |
cachedThousandSeparatorPositions |
(package private) int |
decimalShift
Number of decimal places to shift the number left before
formatting it: 2 means multiply by 100; -3 means divide by
1000.
|
(package private) int |
digitsLeftOfPoint |
(package private) int |
digitsRightOfExp |
(package private) int |
digitsRightOfPoint |
(package private) char |
expChar |
(package private) boolean |
expSign |
(package private) Format.FormatLocale |
locale |
(package private) boolean |
useDecimal |
(package private) boolean |
useThouSep |
(package private) int |
zeroesLeftOfPoint |
(package private) int |
zeroesRightOfExp |
(package private) int |
zeroesRightOfPoint |
code
Constructor and Description |
---|
Format.NumericFormat(String token,
Format.FormatLocale locale,
int expFormat,
int digitsLeftOfPoint,
int zeroesLeftOfPoint,
int digitsRightOfPoint,
int zeroesRightOfPoint,
int digitsRightOfExp,
int zeroesRightOfExp,
boolean useDecimal,
boolean useThouSep,
String formatString) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
format(double n,
StringBuilder buf) |
(package private) void |
format(long n,
StringBuilder buf) |
(package private) mondrian.util.Format.FormatType |
getFormatType() |
(package private) boolean |
isApplicableTo(double n)
Returns whether this format can handle a given value.
|
format, format
format, formatNull, isApplicableTo
final Format.FormatLocale locale
final int digitsLeftOfPoint
final int zeroesLeftOfPoint
final int digitsRightOfPoint
final int zeroesRightOfPoint
final int digitsRightOfExp
final int zeroesRightOfExp
int decimalShift
final char expChar
final boolean expSign
final boolean useDecimal
final boolean useThouSep
final ArrayStack<Integer> cachedThousandSeparatorPositions
Format.NumericFormat(String token, Format.FormatLocale locale, int expFormat, int digitsLeftOfPoint, int zeroesLeftOfPoint, int digitsRightOfPoint, int zeroesRightOfPoint, int digitsRightOfExp, int zeroesRightOfExp, boolean useDecimal, boolean useThouSep, String formatString)
mondrian.util.Format.FormatType getFormatType()
getFormatType
in class Format.BasicFormat
void format(double n, StringBuilder buf)
format
in class Format.JavaFormat
boolean isApplicableTo(double n)
Format.BasicFormat
Usually returns true; one notable exception is a format for negative numbers which causes the number to be underflow to zero and therefore be ineligible for the negative format.
isApplicableTo
in class Format.BasicFormat
n
- valuevoid format(long n, StringBuilder buf)
format
in class Format.JavaFormat