public abstract class PluralRules
extends java.lang.Object
Helps to determine the plural category for a given number of units.
The predefined rules for any given language are based on CLDR-version 26 but can be overridden if necessary. The source data of the underlying algorithms to determine the plural category can be found in CLDR-repository-file "core.zip" along the path "common/supplemental/plurals.xml" for cardinal numbers and "common/supplemental/ordinals.xml" for ordinal numbers.
Specification: All concrete classes must be immutable.
| Constructor and Description |
|---|
PluralRules() |
| Modifier and Type | Method and Description |
|---|---|
abstract PluralCategory |
getCategory(long count)
Determines the plural category for given number of units.
|
abstract NumberType |
getNumberType()
Yields the number type these rules are referring to.
|
static PluralRules |
of(java.util.Locale locale,
NumberType numType)
Gets the localized plural rules for given language or
country.
|
static void |
register(java.util.Locale locale,
PluralRules rules)
Registers given plural rules for a language, possibly overriding
CLDR-default setting.
|
public static PluralRules of(java.util.Locale locale, NumberType numType)
Gets the localized plural rules for given language or country.
If no rules can be found then Time4J will choose the default rules
for cardinals which apply PluralCategory.ONE to n=1 and else
apply the fallback category PluralCategory.OTHER.
locale - locale which specifies the suitable plural rulesnumType - number typepublic static void register(java.util.Locale locale,
PluralRules rules)
Registers given plural rules for a language, possibly overriding CLDR-default setting.
locale - language or country which the rules shall be assigned torules - localized plural rulespublic abstract PluralCategory getCategory(long count)
Determines the plural category for given number of units.
count - integral number of unitsnullpublic abstract NumberType getNumberType()
Yields the number type these rules are referring to.