|
32 | 32 | package cc.tweaked.cobalt.internal.doubles; |
33 | 33 |
|
34 | 34 | import org.checkerframework.checker.signedness.qual.Unsigned; |
| 35 | +import org.squiddev.cobalt.Buffer; |
35 | 36 |
|
36 | 37 | import static cc.tweaked.cobalt.internal.doubles.Assert.requireArg; |
37 | 38 |
|
@@ -120,7 +121,7 @@ private DoubleToStringConverter() { |
120 | 121 | * If either of them is NULL or the value is not special then the |
121 | 122 | * function returns false. |
122 | 123 | */ |
123 | | - private static void handleSpecialValues(double value, FormatOptions fo, CharBuffer resultBuilder) { |
| 124 | + private static void handleSpecialValues(double value, FormatOptions fo, Buffer resultBuilder) { |
124 | 125 | boolean sign = value < 0.0; |
125 | 126 |
|
126 | 127 | int effectiveWidth = fo.width(); |
@@ -164,7 +165,7 @@ private static void createExponentialRepresentation( |
164 | 165 | int length, |
165 | 166 | int exponent, |
166 | 167 | FormatOptions fo, |
167 | | - CharBuffer resultBuilder |
| 168 | + Buffer resultBuilder |
168 | 169 | ) { |
169 | 170 | requireArg(decimalDigits.length() != 0, "decimalDigits must not be empty"); |
170 | 171 | requireArg(length <= decimalDigits.length(), "length must be smaller than decimalDigits"); |
@@ -246,7 +247,7 @@ private static void createDecimalRepresentation( |
246 | 247 | double value, |
247 | 248 | int digitsAfterPoint, |
248 | 249 | FormatOptions fo, |
249 | | - CharBuffer resultBuilder |
| 250 | + Buffer resultBuilder |
250 | 251 | ) { |
251 | 252 | int decimalPoint = decimalDigits.getPointPosition(); |
252 | 253 | int digitsLength = decimalDigits.length(); |
@@ -395,7 +396,7 @@ private static int calculateExpWidth( |
395 | 396 | * MAX_FIXED_DIGITS_AFTER_POINT</code><br/> |
396 | 397 | * characters (one additional character for the sign, and one for the decimal point). |
397 | 398 | */ |
398 | | - public static void toFixed(double value, int requestedDigits, FormatOptions formatOptions, CharBuffer resultBuilder) { |
| 399 | + public static void toFixed(double value, int requestedDigits, FormatOptions formatOptions, Buffer resultBuilder) { |
399 | 400 | // DOUBLE_CONVERSION_ASSERT(MAX_FIXED_DIGITS_BEFORE_POINT == 60); |
400 | 401 |
|
401 | 402 | if (Doubles.isSpecial(value)) { |
@@ -442,7 +443,7 @@ public static void toFixed(double value, int requestedDigits, FormatOptions form |
442 | 443 | * @param formatOptions |
443 | 444 | * @throws IllegalArgumentException if <code>requestedDigits > MAX_EXPONENTIAL_DIGITS</code> |
444 | 445 | */ |
445 | | - public static void toExponential(double value, int requestedDigits, FormatOptions formatOptions, CharBuffer resultBuilder) { |
| 446 | + public static void toExponential(double value, int requestedDigits, FormatOptions formatOptions, Buffer resultBuilder) { |
446 | 447 | if (Doubles.isSpecial(value)) { |
447 | 448 | handleSpecialValues(value, formatOptions, resultBuilder); |
448 | 449 | return; |
@@ -512,7 +513,7 @@ public static void toExponential(double value, int requestedDigits, FormatOption |
512 | 513 | * @throws IllegalArgumentException when <code>precision < MIN_PRECISION_DIGITS</code> or |
513 | 514 | * <code>precision > MAX_PRECISION_DIGITS</code> |
514 | 515 | */ |
515 | | - public static void toPrecision(double value, int precision, FormatOptions formatOptions, CharBuffer resultBuilder) { |
| 516 | + public static void toPrecision(double value, int precision, FormatOptions formatOptions, Buffer resultBuilder) { |
516 | 517 | if (Doubles.isSpecial(value)) { |
517 | 518 | handleSpecialValues(value, formatOptions, resultBuilder); |
518 | 519 | return; |
@@ -562,7 +563,7 @@ public static void toPrecision(double value, int precision, FormatOptions format |
562 | 563 | * @param formatOptions Additional options for this number's formatting. |
563 | 564 | * @param resultBuilder The buffer to output to. |
564 | 565 | */ |
565 | | - public static void toHex(double value, int requestedDigits, FormatOptions formatOptions, CharBuffer resultBuilder) { |
| 566 | + public static void toHex(double value, int requestedDigits, FormatOptions formatOptions, Buffer resultBuilder) { |
566 | 567 | if (Doubles.isSpecial(value)) { |
567 | 568 | handleSpecialValues(value, formatOptions, resultBuilder); |
568 | 569 | return; |
@@ -651,7 +652,7 @@ private static boolean shouldEmitMinus(double value) { |
651 | 652 | return (Double.doubleToRawLongBits(value) & Doubles.SIGN_MASK) != 0 && value != 0.0; |
652 | 653 | } |
653 | 654 |
|
654 | | - private static void appendSign(double value, FormatOptions formatOptions, CharBuffer resultBuilder) { |
| 655 | + private static void appendSign(double value, FormatOptions formatOptions, Buffer resultBuilder) { |
655 | 656 | if (shouldEmitMinus(value)) { |
656 | 657 | resultBuilder.append('-'); |
657 | 658 | } else if (formatOptions.spaceWhenPositive()) { |
@@ -771,7 +772,7 @@ static void doubleToAscii(double v, DtoaMode mode, int requestedDigits, DecimalR |
771 | 772 | * Add character padding to the builder. If count is non-positive, |
772 | 773 | * nothing is added to the builder. |
773 | 774 | */ |
774 | | - private static void addPadding(CharBuffer sb, char character, int count) { |
| 775 | + private static void addPadding(Buffer sb, char character, int count) { |
775 | 776 | for (int i = count; i > 0; i--) sb.append(character); |
776 | 777 | } |
777 | 778 |
|
|
0 commit comments