net.sf.freecol.client.gui.i18n
Class NumberRules

java.lang.Object
  extended by net.sf.freecol.client.gui.i18n.NumberRules

public class NumberRules
extends java.lang.Object

See the Common Locale Data Repository.


Field Summary
static Number DUAL_NUMBER_RULE
          A rule that assigns 1 to category "one", 2 to category "two" and all other numbers to category "other".
private static java.util.logging.Logger logger
           
private static java.util.Map<java.lang.String,Number> numberMap
           
static Number OTHER_NUMBER_RULE
          A rule that always returns category "other".
static Number PLURAL_NUMBER_RULE
          A rule that assigns 1 to category "one" and all other numbers to category "other".
static Number ZERO_ONE_NUMBER_RULE
          A rule that assigns 0 and 1 to category "one", and all other number to category "other".
 
Constructor Summary
NumberRules(java.io.InputStream in)
          Creates a new NumberRules instance from the given input stream, which must contain an XML representation of the CLDR plural rules.
 
Method Summary
static Number getNumberForLanguage(java.lang.String lang)
          Returns a rule appropriate for the given language, or the OTHER_NUMBER_RULE if none has been defined.
static boolean isInitialized()
          Describe isInitialized method here.
static void load(java.io.InputStream in)
          Describe load method here.
private static void readChild(javax.xml.stream.XMLStreamReader in)
          Describe readChild method here.
private static void readFromXML(javax.xml.stream.XMLStreamReader in)
          Describe readFromXML method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

OTHER_NUMBER_RULE

public static final Number OTHER_NUMBER_RULE
A rule that always returns category "other".


DUAL_NUMBER_RULE

public static final Number DUAL_NUMBER_RULE
A rule that assigns 1 to category "one", 2 to category "two" and all other numbers to category "other".


PLURAL_NUMBER_RULE

public static final Number PLURAL_NUMBER_RULE
A rule that assigns 1 to category "one" and all other numbers to category "other".


ZERO_ONE_NUMBER_RULE

public static final Number ZERO_ONE_NUMBER_RULE
A rule that assigns 0 and 1 to category "one", and all other number to category "other".


numberMap

private static java.util.Map<java.lang.String,Number> numberMap
Constructor Detail

NumberRules

public NumberRules(java.io.InputStream in)
Creates a new NumberRules instance from the given input stream, which must contain an XML representation of the CLDR plural rules.

Parameters:
in - an InputStream value
Method Detail

getNumberForLanguage

public static Number getNumberForLanguage(java.lang.String lang)
Returns a rule appropriate for the given language, or the OTHER_NUMBER_RULE if none has been defined.

Parameters:
lang - a String value
Returns:
a Number value

isInitialized

public static boolean isInitialized()
Describe isInitialized method here.

Returns:
a boolean value

load

public static void load(java.io.InputStream in)
Describe load method here.

Parameters:
in - an InputStream value

readFromXML

private static void readFromXML(javax.xml.stream.XMLStreamReader in)
                         throws javax.xml.stream.XMLStreamException
Describe readFromXML method here.

Parameters:
in - a XMLStreamReader value
Throws:
javax.xml.stream.XMLStreamException - if an error occurs

readChild

private static void readChild(javax.xml.stream.XMLStreamReader in)
                       throws javax.xml.stream.XMLStreamException
Describe readChild method here.

Parameters:
in - a XMLStreamReader value
Throws:
javax.xml.stream.XMLStreamException - if an error occurs