Class StaticUnicodeSets

java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.StaticUnicodeSets

public class StaticUnicodeSets extends 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().
  • Constructor Details

    • StaticUnicodeSets

      public StaticUnicodeSets()
  • Method Details

    • 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(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(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(String str)
      Looks through all Currency-related sets for the given string, returning the first match or null if no match was round.