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

Print this page

        

*** 269,279 **** * @param source Value to be converted; must not be Inf, -Inf, Nan, * or a value <= 0. * @param maximumFractionDigits The most fractional digits which should * be converted. */ ! public final void set(boolean isNegative, double source, int maximumFractionDigits) { set(isNegative, source, maximumFractionDigits, true); } /** * Set the digit list to a representation of the given double value. --- 269,279 ---- * @param source Value to be converted; must not be Inf, -Inf, Nan, * or a value <= 0. * @param maximumFractionDigits The most fractional digits which should * be converted. */ ! final void set(boolean isNegative, double source, int maximumFractionDigits) { set(isNegative, source, maximumFractionDigits, true); } /** * Set the digit list to a representation of the given double value.
*** 286,299 **** * @param fixedPoint If true, then maximumDigits is the maximum * fractional digits to be converted. If false, total digits. */ final void set(boolean isNegative, double source, int maximumDigits, boolean fixedPoint) { ! FloatingDecimal fd = new FloatingDecimal(source); ! boolean hasBeenRoundedUp = fd.digitsRoundedUp(); ! boolean allDecimalDigits = fd.decimalDigitsExact(); ! String digitsString = fd.toJavaFormatString(); set(isNegative, digitsString, hasBeenRoundedUp, allDecimalDigits, maximumDigits, fixedPoint); } --- 286,300 ---- * @param fixedPoint If true, then maximumDigits is the maximum * fractional digits to be converted. If false, total digits. */ final void set(boolean isNegative, double source, int maximumDigits, boolean fixedPoint) { ! FloatingDecimal.BinaryToASCIIConverter fdConverter = FloatingDecimal.getBinaryToASCIIConverter(source); ! boolean hasBeenRoundedUp = fdConverter.digitsRoundedUp(); ! boolean allDecimalDigits = fdConverter.decimalDigitsExact(); ! assert !fdConverter.isExceptional(); ! String digitsString = fdConverter.toJavaFormatString(); set(isNegative, digitsString, hasBeenRoundedUp, allDecimalDigits, maximumDigits, fixedPoint); }
*** 303,313 **** * DDDDDE+/-DDDDD. * @param roundedUp Boolean value indicating if the s digits were rounded-up. * @param allDecimalDigits Boolean value indicating if the digits in s are * an exact decimal representation of the double that was passed. */ ! final void set(boolean isNegative, String s, boolean roundedUp, boolean allDecimalDigits, int maximumDigits, boolean fixedPoint) { this.isNegative = isNegative; int len = s.length(); char[] source = getDataChars(len); --- 304,314 ---- * DDDDDE+/-DDDDD. * @param roundedUp Boolean value indicating if the s digits were rounded-up. * @param allDecimalDigits Boolean value indicating if the digits in s are * an exact decimal representation of the double that was passed. */ ! private void set(boolean isNegative, String s, boolean roundedUp, boolean allDecimalDigits, int maximumDigits, boolean fixedPoint) { this.isNegative = isNegative; int len = s.length(); char[] source = getDataChars(len);
*** 605,615 **** } /** * Utility routine to set the value of the digit list from a long */ ! public final void set(boolean isNegative, long source) { set(isNegative, source, 0); } /** * Set the digit list to a representation of the given long value. --- 606,616 ---- } /** * Utility routine to set the value of the digit list from a long */ ! final void set(boolean isNegative, long source) { set(isNegative, source, 0); } /** * Set the digit list to a representation of the given long value.
*** 618,628 **** * Long.MIN_VALUE. * @param maximumDigits The most digits which should be converted. * If maximumDigits is lower than the number of significant digits * in source, the representation will be rounded. Ignored if <= 0. */ ! public final void set(boolean isNegative, long source, int maximumDigits) { this.isNegative = isNegative; // This method does not expect a negative number. However, // "source" can be a Long.MIN_VALUE (-9223372036854775808), // if the number being formatted is a Long.MIN_VALUE. In that --- 619,629 ---- * Long.MIN_VALUE. * @param maximumDigits The most digits which should be converted. * If maximumDigits is lower than the number of significant digits * in source, the representation will be rounded. Ignored if <= 0. */ ! final void set(boolean isNegative, long source, int maximumDigits) { this.isNegative = isNegative; // This method does not expect a negative number. However, // "source" can be a Long.MIN_VALUE (-9223372036854775808), // if the number being formatted is a Long.MIN_VALUE. In that