Package com.ibm.icu.text
Class NumberingSystem
- java.lang.Object
-
- com.ibm.icu.text.NumberingSystem
-
public class NumberingSystem extends java.lang.Object
NumberingSystem
is the base class for all number systems. This class provides the interface for setting different numbering system types, whether it be a simple alternate digit system such as Thai digits or Devanagari digits, or an algorithmic numbering system such as Hebrew numbering or Chinese numbering.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NumberingSystem.LocaleLookupData
-
Field Summary
Fields Modifier and Type Field Description private boolean
algorithmic
private static CacheBase<java.lang.String,NumberingSystem,NumberingSystem.LocaleLookupData>
cachedLocaleData
Cache to hold the NumberingSystems by Locale.private static CacheBase<java.lang.String,NumberingSystem,java.lang.Void>
cachedStringData
Cache to hold the NumberingSystems by name.private java.lang.String
desc
static NumberingSystem
LATIN
For convenience, an instance representing the latn numbering system, which corresponds to digits in the ASCII range '0' through '9'.private java.lang.String
name
private static java.lang.String[]
OTHER_NS_KEYWORDS
private int
radix
-
Constructor Summary
Constructors Constructor Description NumberingSystem()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
getAvailableNames()
Returns a string array containing a list of the names of numbering systems currently known to ICU.java.lang.String
getDescription()
Returns the description string of the current numbering system.static NumberingSystem
getInstance()
Returns the default numbering system for the defaultFORMAT
locale.static NumberingSystem
getInstance(int radix_in, boolean isAlgorithmic_in, java.lang.String desc_in)
Factory method for creating a numbering system.static NumberingSystem
getInstance(ULocale locale)
Returns the default numbering system for the specified ULocale.private static NumberingSystem
getInstance(java.lang.String name_in, int radix_in, boolean isAlgorithmic_in, java.lang.String desc_in)
Factory method for creating a numbering system.static NumberingSystem
getInstance(java.util.Locale inLocale)
Returns the default numbering system for the specified locale.static NumberingSystem
getInstanceByName(java.lang.String name)
Returns a numbering system from one of the predefined numbering systems known to ICU.java.lang.String
getName()
Returns the string representing the name of the numbering system.int
getRadix()
Returns the radix of the current numbering system.boolean
isAlgorithmic()
Returns the numbering system's algorithmic status.static boolean
isValidDigitString(java.lang.String str)
Convenience method to determine if a given digit string is valid for use as a descriptor of a numeric ( non-algorithmic ) numbering system.(package private) static NumberingSystem
lookupInstanceByLocale(NumberingSystem.LocaleLookupData localeLookupData)
private static NumberingSystem
lookupInstanceByName(java.lang.String name)
-
-
-
Field Detail
-
OTHER_NS_KEYWORDS
private static final java.lang.String[] OTHER_NS_KEYWORDS
-
LATIN
public static final NumberingSystem LATIN
For convenience, an instance representing the latn numbering system, which corresponds to digits in the ASCII range '0' through '9'.
-
desc
private java.lang.String desc
-
radix
private int radix
-
algorithmic
private boolean algorithmic
-
name
private java.lang.String name
-
cachedLocaleData
private static CacheBase<java.lang.String,NumberingSystem,NumberingSystem.LocaleLookupData> cachedLocaleData
Cache to hold the NumberingSystems by Locale.
-
cachedStringData
private static CacheBase<java.lang.String,NumberingSystem,java.lang.Void> cachedStringData
Cache to hold the NumberingSystems by name.
-
-
Method Detail
-
getInstance
public static NumberingSystem getInstance(int radix_in, boolean isAlgorithmic_in, java.lang.String desc_in)
Factory method for creating a numbering system.- Parameters:
radix_in
- The radix for this numbering system. ICU currently supports only numbering systems whose radix is 10.isAlgorithmic_in
- Specifies whether the numbering system is algorithmic (true) or numeric (false).desc_in
- String used to describe the characteristics of the numbering system. For numeric systems, this string contains the digits used by the numbering system, in order, starting from zero. For algorithmic numbering systems, the string contains the name of the RBNF ruleset in the locale's NumberingSystemRules section that will be used to format numbers using this numbering system.
-
getInstance
private static NumberingSystem getInstance(java.lang.String name_in, int radix_in, boolean isAlgorithmic_in, java.lang.String desc_in)
Factory method for creating a numbering system.- Parameters:
name_in
- The string representing the name of the numbering system.radix_in
- The radix for this numbering system. ICU currently supports only numbering systems whose radix is 10.isAlgorithmic_in
- Specifies whether the numbering system is algorithmic (true) or numeric (false).desc_in
- String used to describe the characteristics of the numbering system. For numeric systems, this string contains the digits used by the numbering system, in order, starting from zero. For algorithmic numbering systems, the string contains the name of the RBNF ruleset in the locale's NumberingSystemRules section that will be used to format numbers using this numbering system.
-
getInstance
public static NumberingSystem getInstance(java.util.Locale inLocale)
Returns the default numbering system for the specified locale.
-
getInstance
public static NumberingSystem getInstance(ULocale locale)
Returns the default numbering system for the specified ULocale.
-
lookupInstanceByLocale
static NumberingSystem lookupInstanceByLocale(NumberingSystem.LocaleLookupData localeLookupData)
-
getInstance
public static NumberingSystem getInstance()
Returns the default numbering system for the defaultFORMAT
locale.- See Also:
ULocale.Category.FORMAT
-
getInstanceByName
public static NumberingSystem getInstanceByName(java.lang.String name)
Returns a numbering system from one of the predefined numbering systems known to ICU. Numbering system names are based on the numbering systems defined in CLDR. To get a list of available numbering systems, use the getAvailableNames method.- Parameters:
name
- The name of the desired numbering system. Numbering system names often correspond with the name of the script they are associated with. For example, "thai" for Thai digits, "hebr" for Hebrew numerals.- Returns:
- The NumberingSystem instance, or null if not available.
-
lookupInstanceByName
private static NumberingSystem lookupInstanceByName(java.lang.String name)
-
getAvailableNames
public static java.lang.String[] getAvailableNames()
Returns a string array containing a list of the names of numbering systems currently known to ICU.- Returns:
- An array of strings in alphabetical (invariant) order.
-
isValidDigitString
public static boolean isValidDigitString(java.lang.String str)
Convenience method to determine if a given digit string is valid for use as a descriptor of a numeric ( non-algorithmic ) numbering system. In order for a digit string to be valid, it must contain exactly ten Unicode code points.
-
getRadix
public int getRadix()
Returns the radix of the current numbering system.
-
getDescription
public java.lang.String getDescription()
Returns the description string of the current numbering system. The description string describes the characteristics of the numbering system. For numeric systems, this string contains the digits used by the numbering system, in order, starting from zero. For algorithmic numbering systems, the string contains the name of the RBNF ruleset in the locale's NumberingSystemRules section that will be used to format numbers using this numbering system.
-
getName
public java.lang.String getName()
Returns the string representing the name of the numbering system.
-
isAlgorithmic
public boolean isAlgorithmic()
Returns the numbering system's algorithmic status. If true, the numbering system is algorithmic and uses an RBNF formatter to format numerals. If false, the numbering system is numeric and uses a fixed set of digits.
-
-