Package mondrian.util
Class Format.NumericFormat
- java.lang.Object
-
- mondrian.util.Format.BasicFormat
-
- mondrian.util.Format.JavaFormat
-
- mondrian.util.Format.NumericFormat
-
- Enclosing class:
- Format
static class Format.NumericFormat extends Format.JavaFormat
NumericFormat is an implementation ofFormat.BasicFormat
which prints numbers with a given number of decimal places, leading zeroes, in exponential notation, etc.It is implemented using
MondrianFloatingDecimal
.
-
-
Field Summary
Fields Modifier and Type Field 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
-
Fields inherited from class mondrian.util.Format.BasicFormat
code
-
-
Constructor Summary
Constructors Constructor Description 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class mondrian.util.Format.JavaFormat
format, format
-
Methods inherited from class mondrian.util.Format.BasicFormat
format, formatNull, isApplicableTo
-
-
-
-
Field Detail
-
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
-
cachedThousandSeparatorPositions
final ArrayStack<Integer> cachedThousandSeparatorPositions
-
-
Constructor Detail
-
NumericFormat
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)
-
-
Method Detail
-
getFormatType
mondrian.util.Format.FormatType getFormatType()
- Overrides:
getFormatType
in classFormat.BasicFormat
-
format
void format(double n, StringBuilder buf)
- Overrides:
format
in classFormat.JavaFormat
-
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 classFormat.BasicFormat
- Parameters:
n
- value- Returns:
- Whether this format is applicable for a given value
-
format
void format(long n, StringBuilder buf)
- Overrides:
format
in classFormat.JavaFormat
-
-