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.math.BigDecimal; | 5 import java.math.BigDecimal; |
6 import java.math.MathContext; | 6 import java.math.MathContext; |
7 import java.text.ParseException; | 7 import java.text.ParseException; |
8 import java.text.ParsePosition; | 8 import java.text.ParsePosition; |
9 import java.util.HashSet; | 9 import java.util.HashSet; |
10 import java.util.Iterator; | 10 import java.util.Iterator; |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 * A class that holds information about all currency affix patterns for the lo
cale. This allows | 805 * A class that holds information about all currency affix patterns for the lo
cale. This allows |
806 * the parser to accept currencies in any format that are valid for the locale
. | 806 * the parser to accept currencies in any format that are valid for the locale
. |
807 */ | 807 */ |
808 private static class CurrencyAffixPatterns { | 808 private static class CurrencyAffixPatterns { |
809 private final Set<AffixHolder> set = new HashSet<AffixHolder>(); | 809 private final Set<AffixHolder> set = new HashSet<AffixHolder>(); |
810 | 810 |
811 private static final ConcurrentHashMap<ULocale, CurrencyAffixPatterns> curre
ncyAffixPatterns = | 811 private static final ConcurrentHashMap<ULocale, CurrencyAffixPatterns> curre
ncyAffixPatterns = |
812 new ConcurrentHashMap<ULocale, CurrencyAffixPatterns>(); | 812 new ConcurrentHashMap<ULocale, CurrencyAffixPatterns>(); |
813 | 813 |
814 static void addToState(ULocale uloc, ParserState state) { | 814 static void addToState(ULocale uloc, ParserState state) { |
815 if (!currencyAffixPatterns.contains(uloc)) { | 815 if (!currencyAffixPatterns.containsKey(uloc)) { |
816 // There can be multiple threads computing the same CurrencyAffixPattern
s simultaneously, | 816 // There can be multiple threads computing the same CurrencyAffixPattern
s simultaneously, |
817 // but that scenario is harmless. | 817 // but that scenario is harmless. |
818 CurrencyAffixPatterns value = new CurrencyAffixPatterns(uloc); | 818 CurrencyAffixPatterns value = new CurrencyAffixPatterns(uloc); |
819 currencyAffixPatterns.put(uloc, value); | 819 currencyAffixPatterns.put(uloc, value); |
820 } | 820 } |
821 CurrencyAffixPatterns instance = currencyAffixPatterns.get(uloc); | 821 CurrencyAffixPatterns instance = currencyAffixPatterns.get(uloc); |
822 state.affixHolders.addAll(instance.set); | 822 state.affixHolders.addAll(instance.set); |
823 } | 823 } |
824 | 824 |
825 private CurrencyAffixPatterns(ULocale uloc) { | 825 private CurrencyAffixPatterns(ULocale uloc) { |
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 * @param cp The code point to test. Returns false if cp is negative. | 2101 * @param cp The code point to test. Returns false if cp is negative. |
2102 * @param state The current {@link ParserState}, used for determining strict m
ode. | 2102 * @param state The current {@link ParserState}, used for determining strict m
ode. |
2103 * @return true if cp is bidi or whitespace in lenient mode; false otherwise. | 2103 * @return true if cp is bidi or whitespace in lenient mode; false otherwise. |
2104 */ | 2104 */ |
2105 private static boolean isIgnorable(int cp, ParserState state) { | 2105 private static boolean isIgnorable(int cp, ParserState state) { |
2106 if (cp < 0) return false; | 2106 if (cp < 0) return false; |
2107 if (UNISET_BIDI.contains(cp)) return true; | 2107 if (UNISET_BIDI.contains(cp)) return true; |
2108 return state.mode == ParseMode.LENIENT && UNISET_WHITESPACE.contains(cp); | 2108 return state.mode == ParseMode.LENIENT && UNISET_WHITESPACE.contains(cp); |
2109 } | 2109 } |
2110 } | 2110 } |
LEFT | RIGHT |