Exemplo n.º 1
0
 /**
  * @param keyword for example "few" or "other"
  * @return the index of the plural form corresponding to the keyword
  * @throws IllegalArgumentException if the keyword is not a plural form
  */
 public static final int indexFromString(CharSequence keyword) {
   StandardPlural p = orNullFromString(keyword);
   if (p != null) {
     return p.ordinal();
   } else {
     throw new IllegalArgumentException(keyword.toString());
   }
 }
Exemplo n.º 2
0
 /**
  * @param keyword for example "few" or "other"
  * @return the index of the plural form corresponding to the keyword, or OTHER_INDEX
  */
 public static final int indexOrOtherIndexFromString(CharSequence keyword) {
   StandardPlural p = orNullFromString(keyword);
   return p != null ? p.ordinal() : OTHER.ordinal();
 }
Exemplo n.º 3
0
 /**
  * @param keyword for example "few" or "other"
  * @return the index of the plural form corresponding to the keyword, or a negative value
  */
 public static final int indexOrNegativeFromString(CharSequence keyword) {
   StandardPlural p = orNullFromString(keyword);
   return p != null ? p.ordinal() : -1;
 }