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.BasicFormatwhich 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) intdecimalShiftNumber of decimal places to shift the number left before formatting it: 2 means multiply by 100; -3 means divide by 1000.(package private) intdigitsLeftOfPoint(package private) intdigitsRightOfExp(package private) intdigitsRightOfPoint(package private) charexpChar(package private) booleanexpSign(package private) Format.FormatLocalelocale(package private) booleanuseDecimal(package private) booleanuseThouSep(package private) intzeroesLeftOfPoint(package private) intzeroesRightOfExp(package private) intzeroesRightOfPoint-
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) voidformat(double n, StringBuilder buf)(package private) voidformat(long n, StringBuilder buf)(package private) mondrian.util.Format.FormatTypegetFormatType()(package private) booleanisApplicableTo(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:
getFormatTypein classFormat.BasicFormat
-
format
void format(double n, StringBuilder buf)- Overrides:
formatin classFormat.JavaFormat
-
isApplicableTo
boolean isApplicableTo(double n)
Description copied from class:Format.BasicFormatReturns 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:
isApplicableToin classFormat.BasicFormat- Parameters:
n- value- Returns:
- Whether this format is applicable for a given value
-
format
void format(long n, StringBuilder buf)- Overrides:
formatin classFormat.JavaFormat
-
-