LEFT | RIGHT |
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.util.HashMap; | 5 import java.util.HashMap; |
6 import java.util.Locale; | 6 import java.util.Locale; |
7 import java.util.Map; | 7 import java.util.Map; |
8 | 8 |
9 import com.ibm.icu.impl.number.Format.BeforeTargetAfterFormat; | 9 import com.ibm.icu.impl.number.Format.BeforeTargetAfterFormat; |
10 import com.ibm.icu.impl.number.Format.SingularFormat; | 10 import com.ibm.icu.impl.number.Format.SingularFormat; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 if (MeasureFormat.useMeasureFormat(properties)) { | 96 if (MeasureFormat.useMeasureFormat(properties)) { |
97 canUseFastTrack = false; | 97 canUseFastTrack = false; |
98 format.addBeforeFormat(MeasureFormat.getInstance(symbols, properties)); | 98 format.addBeforeFormat(MeasureFormat.getInstance(symbols, properties)); |
99 } | 99 } |
100 if (CurrencyFormat.useCurrency(properties)) { | 100 if (CurrencyFormat.useCurrency(properties)) { |
101 canUseFastTrack = false; | 101 canUseFastTrack = false; |
102 if (CompactDecimalFormat.useCompactDecimalFormat(properties)) { | 102 if (CompactDecimalFormat.useCompactDecimalFormat(properties)) { |
103 format.addBeforeFormat(CompactDecimalFormat.getInstance(symbols, propert
ies)); | 103 format.addBeforeFormat(CompactDecimalFormat.getInstance(symbols, propert
ies)); |
104 } else if (ScientificFormat.useScientificNotation(properties)) { | 104 } else if (ScientificFormat.useScientificNotation(properties)) { |
| 105 // TODO: Should the currency rounder or scientific rounder be used in
this case? |
| 106 // For now, default to using the scientific rounder. |
105 format.addBeforeFormat(PositiveNegativeAffixFormat.getInstance(symbols,
properties)); | 107 format.addBeforeFormat(PositiveNegativeAffixFormat.getInstance(symbols,
properties)); |
106 Rounder rounder = CurrencyFormat.getCurrencyRounder(symbols, properties)
; | 108 format.addBeforeFormat(ScientificFormat.getInstance(symbols, properties)
); |
107 format.addBeforeFormat(ScientificFormat.getInstance(symbols, properties,
rounder)); | |
108 } else { | 109 } else { |
109 format.addBeforeFormat(CurrencyFormat.getCurrencyRounder(symbols, proper
ties)); | 110 format.addBeforeFormat(CurrencyFormat.getCurrencyRounder(symbols, proper
ties)); |
110 format.addBeforeFormat(CurrencyFormat.getCurrencyModifier(symbols, prope
rties)); | 111 format.addBeforeFormat(CurrencyFormat.getCurrencyModifier(symbols, prope
rties)); |
111 } | 112 } |
112 } else { | 113 } else { |
113 if (CompactDecimalFormat.useCompactDecimalFormat(properties)) { | 114 if (CompactDecimalFormat.useCompactDecimalFormat(properties)) { |
114 canUseFastTrack = false; | 115 canUseFastTrack = false; |
115 format.addBeforeFormat(CompactDecimalFormat.getInstance(symbols, propert
ies)); | 116 format.addBeforeFormat(CompactDecimalFormat.getInstance(symbols, propert
ies)); |
116 } else if (ScientificFormat.useScientificNotation(properties)) { | 117 } else if (ScientificFormat.useScientificNotation(properties)) { |
117 canUseFastTrack = false; | 118 canUseFastTrack = false; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 277 |
277 if (uLocale == null) uLocale = ULocale.getDefault(); | 278 if (uLocale == null) uLocale = ULocale.getDefault(); |
278 PluralRules rules = threadLocalRulesCache.get().get(uLocale); | 279 PluralRules rules = threadLocalRulesCache.get().get(uLocale); |
279 if (rules == null) { | 280 if (rules == null) { |
280 rules = PluralRules.forLocale(uLocale); | 281 rules = PluralRules.forLocale(uLocale); |
281 threadLocalRulesCache.get().put(uLocale, rules); | 282 threadLocalRulesCache.get().put(uLocale, rules); |
282 } | 283 } |
283 return rules; | 284 return rules; |
284 } | 285 } |
285 } | 286 } |
LEFT | RIGHT |