LEFT | RIGHT |
(no file at all) | |
| 1 // © 2017 and later: Unicode, Inc. and others. |
| 2 // License & terms of use: http://www.unicode.org/copyright.html#License |
| 3 package com.ibm.icu.impl.number.rounders; |
| 4 |
| 5 import com.ibm.icu.impl.number.FormatQuantity; |
| 6 import com.ibm.icu.impl.number.Rounder; |
| 7 |
| 8 public class MagnitudeRounder extends Rounder { |
| 9 |
| 10 public static interface IProperties extends IBasicRoundingProperties {} |
| 11 |
| 12 public static boolean useFractionFormat(IProperties properties) { |
| 13 return properties.getMinimumFractionDigits() != IProperties.DEFAULT_MINIMUM_
FRACTION_DIGITS |
| 14 || properties.getMaximumFractionDigits() != IProperties.DEFAULT_MAXIMUM_
FRACTION_DIGITS; |
| 15 } |
| 16 |
| 17 public static MagnitudeRounder getInstance(IBasicRoundingProperties properties
) { |
| 18 return new MagnitudeRounder(properties); |
| 19 } |
| 20 |
| 21 private MagnitudeRounder(IBasicRoundingProperties properties) { |
| 22 super(properties); |
| 23 } |
| 24 |
| 25 @Override |
| 26 public void apply(FormatQuantity input) { |
| 27 input.roundToMagnitude(-maxFrac, mathContext); |
| 28 applyDefaults(input); |
| 29 } |
| 30 } |
LEFT | RIGHT |