Package com.ibm.icu.impl
Class StaticUnicodeSets
- java.lang.Object
-
- com.ibm.icu.impl.StaticUnicodeSets
-
public class StaticUnicodeSets extends java.lang.Object
This class statically initializes UnicodeSets, originally built for number parsing. Microbenchmarks show this to bring a very sizeable performance boost. IMPORTANT ASSUMPTION FOR NUMBER PARSING: All of the sets contain code points (no strings) and they are all case-folded. If this assumption were ever broken, logic in classes such as SymbolMatcher would need to be updated in order to return well-formed sets upon calls to getLeadCodePoints().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StaticUnicodeSets.Key
(package private) static class
StaticUnicodeSets.ParseDataSink
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<StaticUnicodeSets.Key,UnicodeSet>
unicodeSets
-
Constructor Summary
Constructors Constructor Description StaticUnicodeSets()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StaticUnicodeSets.Key
chooseCurrency(java.lang.String str)
Looks through all Currency-related sets for the given string, returning the first match or null if no match was round.static StaticUnicodeSets.Key
chooseFrom(java.lang.String str, StaticUnicodeSets.Key key1)
Checks if the UnicodeSet given by key1 contains the given string.static StaticUnicodeSets.Key
chooseFrom(java.lang.String str, StaticUnicodeSets.Key key1, StaticUnicodeSets.Key key2)
Checks if the UnicodeSet given by either key1 or key2 contains the string.private static UnicodeSet
computeUnion(StaticUnicodeSets.Key k1, StaticUnicodeSets.Key k2)
private static UnicodeSet
computeUnion(StaticUnicodeSets.Key k1, StaticUnicodeSets.Key k2, StaticUnicodeSets.Key k3)
static UnicodeSet
get(StaticUnicodeSets.Key key)
Gets the static-allocated UnicodeSet according to the provided key.private static void
saveSet(StaticUnicodeSets.Key key, java.lang.String unicodeSetPattern)
-
-
-
Field Detail
-
unicodeSets
private static final java.util.Map<StaticUnicodeSets.Key,UnicodeSet> unicodeSets
-
-
Method Detail
-
get
public static UnicodeSet get(StaticUnicodeSets.Key key)
Gets the static-allocated UnicodeSet according to the provided key.- Parameters:
key
- The desired UnicodeSet according to the enum in this file.- Returns:
- The requested UnicodeSet. Guaranteed to be frozen and non-null, but may be empty if an error occurred during data loading.
-
chooseFrom
public static StaticUnicodeSets.Key chooseFrom(java.lang.String str, StaticUnicodeSets.Key key1)
Checks if the UnicodeSet given by key1 contains the given string.- Parameters:
str
- The string to check.key1
- The set to check.- Returns:
- key1 if the set contains str, or COUNT if not.
-
chooseFrom
public static StaticUnicodeSets.Key chooseFrom(java.lang.String str, StaticUnicodeSets.Key key1, StaticUnicodeSets.Key key2)
Checks if the UnicodeSet given by either key1 or key2 contains the string. Exported as U_COMMON_API for numparse_decimal.cpp- Parameters:
str
- The string to check.key1
- The first set to check.key2
- The second set to check.- Returns:
- key1 if that set contains str; key2 if that set contains str; or COUNT if neither set contains str.
-
chooseCurrency
public static StaticUnicodeSets.Key chooseCurrency(java.lang.String str)
Looks through all Currency-related sets for the given string, returning the first match or null if no match was round.
-
computeUnion
private static UnicodeSet computeUnion(StaticUnicodeSets.Key k1, StaticUnicodeSets.Key k2)
-
computeUnion
private static UnicodeSet computeUnion(StaticUnicodeSets.Key k1, StaticUnicodeSets.Key k2, StaticUnicodeSets.Key k3)
-
saveSet
private static void saveSet(StaticUnicodeSets.Key key, java.lang.String unicodeSetPattern)
-
-