mondrian.util
Class Format.NumericFormat
java.lang.Object
mondrian.util.Format.BasicFormat
mondrian.util.Format.FallbackFormat
mondrian.util.Format.NumericFormat
- Enclosing class:
- Format
static class Format.NumericFormat
- extends Format.FallbackFormat
NumericFormat is an implementation of Format.BasicFormat
which
prints numbers with a given number of decimal places, leading zeroes, in
exponential notation, etc.
It is implemented using Format.FloatingDecimal
, which is a
barely-modified version of java.lang.FloatingDecimal
.
-
-
Constructor Summary |
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
locale
Format.FormatLocale locale
digitsLeftOfPoint
int digitsLeftOfPoint
zeroesLeftOfPoint
int zeroesLeftOfPoint
digitsRightOfPoint
int digitsRightOfPoint
zeroesRightOfPoint
int zeroesRightOfPoint
digitsRightOfExp
int digitsRightOfExp
zeroesRightOfExp
int zeroesRightOfExp
decimalShift
int decimalShift
- Number of decimal places to shift the number left before
formatting it: 2 means multiply by 100; -3 means divide by
1000.
expChar
char expChar
expSign
boolean expSign
useDecimal
boolean useDecimal
useThouSep
boolean useThouSep
Format.NumericFormat
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)
format
void format(double n,
StringBuilder buf)
- Overrides:
format
in class Format.FallbackFormat
isApplicableTo
boolean isApplicableTo(double n)
- Description copied from class:
Format.BasicFormat
- Returns whether this format can handle a given value.
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.
- Overrides:
isApplicableTo
in class Format.BasicFormat
- Parameters:
n
- value
- Returns:
- Whether this format is applicable for a given value
format
void format(long n,
StringBuilder buf)
- Overrides:
format
in class Format.FallbackFormat