Exemple #1
0
 /*
  * Initializes the <code>PluralRules</code> object.
  * Postcondition:<br/>
  *   <code>ulocale</code>    :  is <code>locale</code><br/>
  *   <code>pluralRules</code>:  if <code>rules</code> != <code>null</code>
  *                              it's set to rules, otherwise it is the
  *                              predefined plural rule set for the locale
  *                              <code>ulocale</code>.<br/>
  *   <code>parsedValues</code>: is <code>null</code><br/>
  *   <code>pattern</code>:      is <code>null</code><br/>
  *   <code>numberFormat</code>: a <code>NumberFormat</code> for the locale
  *                              <code>ulocale</code>.
  */
 private void Init(PluralRules rules, PluralType type, ULocale locale, NumberFormat numberFormat)
 {
     ulocale     = locale;
     pluralRules = (rules == null) ? PluralRules.ForLocale(ulocale, type)
                                   : rules;
     pluralRulesWrapper = new PluralSelectorAdapter(pluralRules); // ICU4N: Have to pass a reference to pluralRules in the constructor
     ResetPattern();
     this.numberFormat = (numberFormat == null) ? NumberFormat.GetInstance(ulocale) : numberFormat;
 }
Exemple #2
0
 /*
  * Initializes the <code>PluralRules</code> object.
  * Postcondition:<br/>
  *   <code>ulocale</code>    :  is <code>locale</code><br/>
  *   <code>pluralRules</code>:  if <code>rules</code> != <code>null</code>
  *                              it's set to rules, otherwise it is the
  *                              predefined plural rule set for the locale
  *                              <code>ulocale</code>.<br/>
  *   <code>parsedValues</code>: is <code>null</code><br/>
  *   <code>pattern</code>:      is <code>null</code><br/>
  *   <code>numberFormat</code>: a <code>NumberFormat</code> for the locale
  *                              <code>ulocale</code>.
  */
 private void Init(PluralRules rules, PluralType type, UCultureInfo locale, NumberFormat numberFormat)
 {
     ulocale     = locale;
     pluralRules = (rules == null) ? PluralRules.ForLocale(ulocale, type) // ICU4N TODO: Make extension method for UCultureInfo.GetPluralRules(PluralType)..?
                                   : rules;
     pluralRulesWrapper = new PluralSelectorAdapter(pluralRules);         // ICU4N: Have to pass a reference to pluralRules in the constructor
     ResetPattern();
     this.numberFormat = (numberFormat == null) ? NumberFormat.GetInstance(ulocale) : numberFormat;
 }
Exemple #3
0
 private void ReadObject(Stream @in)
 {
     // ICU4N TODO: Object serialization
     //@in.defaultReadObject();
     pluralRulesWrapper = new PluralSelectorAdapter(pluralRules);
     // Ignore the parsedValues from an earlier class version (before ICU 4.8)
     // and rebuild the msgPattern.
     parsedValues = null;
     if (pattern != null)
     {
         ApplyPattern(pattern);
     }
 }