Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(762)

Unified Diff: main/classes/core/src/com/ibm/icu/impl/number/FormatQuantityBCD.java

Issue 329960043: ticket:13177 NumberFormat2 from Shane's branch Base URL: svn+ssh://source.icu-project.org/repos/icu/trunk/icu4j/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: main/classes/core/src/com/ibm/icu/impl/number/FormatQuantityBCD.java
===================================================================
--- main/classes/core/src/com/ibm/icu/impl/number/FormatQuantityBCD.java (revision 40289)
+++ main/classes/core/src/com/ibm/icu/impl/number/FormatQuantityBCD.java (working copy)
@@ -134,17 +134,25 @@
}
@Override
- public void setIntegerFractionLength(int minInt, int maxInt, int minFrac, int maxFrac) {
+ public void setIntegerLength(int minInt, int maxInt) {
// Validation should happen outside of FormatQuantity, e.g., in the Rounder class.
assert minInt >= 0;
assert maxInt >= minInt;
+
+ // Save values into internal state
+ // Negation is safe for minFrac/maxFrac because -Integer.MAX_VALUE > Integer.MIN_VALUE
+ lOptPos = maxInt;
+ lReqPos = minInt;
+ }
+
+ @Override
+ public void setFractionLength(int minFrac, int maxFrac) {
+ // Validation should happen outside of FormatQuantity, e.g., in the Rounder class.
assert minFrac >= 0;
assert maxFrac >= minFrac;
// Save values into internal state
// Negation is safe for minFrac/maxFrac because -Integer.MAX_VALUE > Integer.MIN_VALUE
- lOptPos = maxInt;
- lReqPos = minInt;
rReqPos = -minFrac;
rOptPos = -maxFrac;
}
@@ -176,6 +184,9 @@
@Override
public void multiplyBy(BigDecimal multiplicand) {
+ if (isInfinite() || isZero() || isNaN()) {
+ return;
+ }
BigDecimal temp = toBigDecimal();
temp = temp.multiply(multiplicand);
setToBigDecimal(temp);
@@ -510,6 +521,7 @@
*
* @param n The value to consume.
*/
+ @Override
public void setToBigDecimal(BigDecimal n) {
setBcdToZero();
flags = 0;

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b