src/share/classes/java/text/DigitList.java

Print this page




  45 /**
  46  * Digit List. Private to DecimalFormat.
  47  * Handles the transcoding
  48  * between numeric values and strings of characters.  Only handles
  49  * non-negative numbers.  The division of labor between DigitList and
  50  * DecimalFormat is that DigitList handles the radix 10 representation
  51  * issues; DecimalFormat handles the locale-specific issues such as
  52  * positive/negative, grouping, decimal point, currency, and so on.
  53  *
  54  * A DigitList is really a representation of a floating point value.
  55  * It may be an integer value; we assume that a double has sufficient
  56  * precision to represent all digits of a long.
  57  *
  58  * The DigitList representation consists of a string of characters,
  59  * which are the digits radix 10, from '0' to '9'.  It also has a radix
  60  * 10 exponent associated with it.  The value represented by a DigitList
  61  * object can be computed by mulitplying the fraction f, where 0 <= f < 1,
  62  * derived by placing all the digits of the list to the right of the
  63  * decimal point, by 10^exponent.
  64  *
  65  * @see  Locale
  66  * @see  Format
  67  * @see  NumberFormat
  68  * @see  DecimalFormat
  69  * @see  ChoiceFormat
  70  * @see  MessageFormat
  71  * @author       Mark Davis, Alan Liu
  72  */
  73 final class DigitList implements Cloneable {
  74     /**
  75      * The maximum number of significant digits in an IEEE 754 double, that
  76      * is, in a Java double.  This must not be increased, or garbage digits
  77      * will be generated, and should not be decreased, or accuracy will be lost.
  78      */
  79     public static final int MAX_COUNT = 19; // == Long.toString(Long.MAX_VALUE).length()
  80 
  81     /**
  82      * These data members are intentionally public and can be set directly.
  83      *
  84      * The value represented is given by placing the decimal point before
  85      * digits[decimalAt].  If decimalAt is < 0, then leading zeros between




  45 /**
  46  * Digit List. Private to DecimalFormat.
  47  * Handles the transcoding
  48  * between numeric values and strings of characters.  Only handles
  49  * non-negative numbers.  The division of labor between DigitList and
  50  * DecimalFormat is that DigitList handles the radix 10 representation
  51  * issues; DecimalFormat handles the locale-specific issues such as
  52  * positive/negative, grouping, decimal point, currency, and so on.
  53  *
  54  * A DigitList is really a representation of a floating point value.
  55  * It may be an integer value; we assume that a double has sufficient
  56  * precision to represent all digits of a long.
  57  *
  58  * The DigitList representation consists of a string of characters,
  59  * which are the digits radix 10, from '0' to '9'.  It also has a radix
  60  * 10 exponent associated with it.  The value represented by a DigitList
  61  * object can be computed by mulitplying the fraction f, where 0 <= f < 1,
  62  * derived by placing all the digits of the list to the right of the
  63  * decimal point, by 10^exponent.
  64  *
  65  * @see  java.util.Locale
  66  * @see  Format
  67  * @see  NumberFormat
  68  * @see  DecimalFormat
  69  * @see  ChoiceFormat
  70  * @see  MessageFormat
  71  * @author       Mark Davis, Alan Liu
  72  */
  73 final class DigitList implements Cloneable {
  74     /**
  75      * The maximum number of significant digits in an IEEE 754 double, that
  76      * is, in a Java double.  This must not be increased, or garbage digits
  77      * will be generated, and should not be decreased, or accuracy will be lost.
  78      */
  79     public static final int MAX_COUNT = 19; // == Long.toString(Long.MAX_VALUE).length()
  80 
  81     /**
  82      * These data members are intentionally public and can be set directly.
  83      *
  84      * The value represented is given by placing the decimal point before
  85      * digits[decimalAt].  If decimalAt is < 0, then leading zeros between