mondrian.util
Class Format.NumericFormat

java.lang.Object
  extended by mondrian.util.Format.BasicFormat
      extended by mondrian.util.Format.FallbackFormat
          extended by 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.

 

Field Summary
(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.FallbackFormat
token
 
Fields inherited from class mondrian.util.Format.BasicFormat
code
 
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)
           
 
Method Summary
(package private)  void format(double n, StringBuilder buf)
           
(package private)  void format(long n, StringBuilder buf)
           
(package private)  boolean isApplicableTo(double n)
          Returns whether this format can handle a given value.
 
Methods inherited from class mondrian.util.Format.FallbackFormat
format, format
 
Methods inherited from class mondrian.util.Format.BasicFormat
format, formatNull, isApplicableTo, isDate, isNumeric, isString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

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)
Method Detail

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

SourceForge.net_Logo