LEFT | RIGHT |
(no file at all) | |
1 // © 2017 and later: Unicode, Inc. and others. | 1 // © 2017 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html#License | 2 // License & terms of use: http://www.unicode.org/copyright.html#License |
3 package com.ibm.icu.impl.number; | 3 package com.ibm.icu.impl.number; |
4 | 4 |
5 import java.math.BigDecimal; | 5 import java.math.BigDecimal; |
6 import java.math.MathContext; | 6 import java.math.MathContext; |
7 import java.math.RoundingMode; | 7 import java.math.RoundingMode; |
8 import java.text.FieldPosition; | 8 import java.text.FieldPosition; |
9 | 9 |
10 import com.ibm.icu.impl.StandardPlural; | 10 import com.ibm.icu.impl.StandardPlural; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 primary = new BigDecimal(primary).round(mathContext).longValueExact(); | 404 primary = new BigDecimal(primary).round(mathContext).longValueExact(); |
405 primaryPrecision = computePrecision(primary); | 405 primaryPrecision = computePrecision(primary); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 @Override | 409 @Override |
410 public void roundToInfinity() { | 410 public void roundToInfinity() { |
411 // noop | 411 // noop |
412 } | 412 } |
413 | 413 |
| 414 @Override |
| 415 public void truncate() { |
| 416 roundToMagnitude(0, RoundingUtils.mathContextUnlimited(RoundingMode.FLOOR)
); |
| 417 } |
| 418 |
414 /** | 419 /** |
415 * Multiply the internal number by the specified multiplicand. This method for
ces the internal | 420 * Multiply the internal number by the specified multiplicand. This method for
ces the internal |
416 * representation into a BigDecimal. If you are multiplying by a power of 10,
use {@link | 421 * representation into a BigDecimal. If you are multiplying by a power of 10,
use {@link |
417 * #adjustMagnitude} instead. | 422 * #adjustMagnitude} instead. |
418 * | 423 * |
419 * @param multiplicand The number to be passed to {@link BigDecimal#multiply}. | 424 * @param multiplicand The number to be passed to {@link BigDecimal#multiply}. |
420 */ | 425 */ |
421 @Override | 426 @Override |
422 public void multiplyBy(BigDecimal multiplicand) { | 427 public void multiplyBy(BigDecimal multiplicand) { |
423 convertToBigDecimal(); | 428 convertToBigDecimal(); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 } | 885 } |
881 | 886 |
882 @Override | 887 @Override |
883 public void populateUFieldPosition(FieldPosition fp) { | 888 public void populateUFieldPosition(FieldPosition fp) { |
884 if (fp instanceof UFieldPosition) { | 889 if (fp instanceof UFieldPosition) { |
885 ((UFieldPosition) fp) | 890 ((UFieldPosition) fp) |
886 .setFractionDigits((int) getPluralOperand(Operand.v), (long) getPlural
Operand(Operand.f)); | 891 .setFractionDigits((int) getPluralOperand(Operand.v), (long) getPlural
Operand(Operand.f)); |
887 } | 892 } |
888 } | 893 } |
889 } | 894 } |
LEFT | RIGHT |