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
final Format.FormatLocale locale
digitsLeftOfPoint
final int digitsLeftOfPoint
zeroesLeftOfPoint
final int zeroesLeftOfPoint
digitsRightOfPoint
final int digitsRightOfPoint
zeroesRightOfPoint
final int zeroesRightOfPoint
digitsRightOfExp
final int digitsRightOfExp
zeroesRightOfExp
final 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
final char expChar
expSign
final boolean expSign
useDecimal
final boolean useDecimal
useThouSep
final 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