Class PluralRules
- java.lang.Object
-
- com.vmware.vipclient.i18n.l2.plural.parser.PluralRules
-
- All Implemented Interfaces:
java.io.Serializable
public class PluralRules extends java.lang.Object implements java.io.Serializable- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPluralRules.FixedDecimalstatic classPluralRules.FixedDecimalRangestatic classPluralRules.FixedDecimalSamplesA list of NumberInfo that includes all values with the same visibleFractionDigitCount.static interfacePluralRules.IFixedDecimalstatic classPluralRules.Operandstatic classPluralRules.PluralTypestatic classPluralRules.SampleTypeSelection parameter for either integer-only or decimal-only.
-
Field Summary
Fields Modifier and Type Field Description static PluralRulesDEFAULTThe default rulesstatic java.lang.StringKEYWORD_FEWprotected static java.util.List<java.lang.String>KEYWORD_LISTstatic java.lang.StringKEYWORD_MANYstatic java.lang.StringKEYWORD_ONEstatic java.lang.StringKEYWORD_OTHERstatic java.lang.StringKEYWORD_TWOstatic java.lang.StringKEYWORD_ZEROstatic doubleNO_UNIQUE_VALUE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static PluralRulesforLocale(java.util.Locale locale, PluralRules.PluralType type)static PluralRulesgetInstance(java.lang.String rule)Creates a PluralRules from a rule if it is parsable, otherwise returns null.static PluralRulesgetInstance(java.util.Map<java.lang.String,java.lang.String> rule)java.lang.StringgetRules(java.lang.String keyword)static PluralRulesparse(java.lang.String rule)Parses a plural rules string and returns a PluralRules.static PluralRulesparse(java.util.Map<java.lang.String,java.lang.String> rules)java.lang.Stringselect(double number)Given a number, returns the keyword of the first rule that applies to the number.java.lang.Stringselect(PluralRules.FixedDecimal number)Deprecated.
-
-
-
Field Detail
-
KEYWORD_ZERO
public static final java.lang.String KEYWORD_ZERO
- See Also:
- Constant Field Values
-
KEYWORD_ONE
public static final java.lang.String KEYWORD_ONE
- See Also:
- Constant Field Values
-
KEYWORD_TWO
public static final java.lang.String KEYWORD_TWO
- See Also:
- Constant Field Values
-
KEYWORD_FEW
public static final java.lang.String KEYWORD_FEW
- See Also:
- Constant Field Values
-
KEYWORD_MANY
public static final java.lang.String KEYWORD_MANY
- See Also:
- Constant Field Values
-
KEYWORD_OTHER
public static final java.lang.String KEYWORD_OTHER
- See Also:
- Constant Field Values
-
NO_UNIQUE_VALUE
public static final double NO_UNIQUE_VALUE
- See Also:
- Constant Field Values
-
KEYWORD_LIST
protected static final java.util.List<java.lang.String> KEYWORD_LIST
-
DEFAULT
public static final PluralRules DEFAULT
The default rules
-
-
Method Detail
-
parse
public static PluralRules parse(java.lang.String rule) throws java.text.ParseException
Parses a plural rules string and returns a PluralRules.- Parameters:
rule- the rule string.- Throws:
java.text.ParseException
-
parse
public static PluralRules parse(java.util.Map<java.lang.String,java.lang.String> rules) throws java.text.ParseException
- Throws:
java.text.ParseException
-
getInstance
public static PluralRules getInstance(java.lang.String rule)
Creates a PluralRules from a rule if it is parsable, otherwise returns null.- Parameters:
description- the rule rule.- Returns:
- the PluralRules
-
getInstance
public static PluralRules getInstance(java.util.Map<java.lang.String,java.lang.String> rule)
-
select
public java.lang.String select(double number)
Given a number, returns the keyword of the first rule that applies to the number.- Parameters:
number- The number for which the rule has to be determined.- Returns:
- The keyword of the selected rule.
-
select
@Deprecated public java.lang.String select(PluralRules.FixedDecimal number)
Deprecated.- Parameters:
number-- Returns:
-
getRules
public java.lang.String getRules(java.lang.String keyword)
-
forLocale
public static PluralRules forLocale(java.util.Locale locale, PluralRules.PluralType type)
-
-