Package com.ibm.icu.impl
Class StaticUnicodeSets
java.lang.Object
com.ibm.icu.impl.StaticUnicodeSets
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 ClassesModifier and TypeClassDescriptionstatic enum
(package private) static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StaticUnicodeSets.Key
chooseCurrency
(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
(String str, StaticUnicodeSets.Key key1) Checks if the UnicodeSet given by key1 contains the given string.static StaticUnicodeSets.Key
chooseFrom
(String str, StaticUnicodeSets.Key key1, StaticUnicodeSets.Key key2) Checks if the UnicodeSet given by either key1 or key2 contains the string.private static UnicodeSet
private static UnicodeSet
static UnicodeSet
get
(StaticUnicodeSets.Key key) Gets the static-allocated UnicodeSet according to the provided key.private static void
saveSet
(StaticUnicodeSets.Key key, String unicodeSetPattern)
-
Field Details
-
unicodeSets
-
-
Constructor Details
-
StaticUnicodeSets
public StaticUnicodeSets()
-
-
Method Details
-
get
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
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(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
Looks through all Currency-related sets for the given string, returning the first match or null if no match was round. -
computeUnion
-
computeUnion
private static UnicodeSet computeUnion(StaticUnicodeSets.Key k1, StaticUnicodeSets.Key k2, StaticUnicodeSets.Key k3) -
saveSet
-