Пример #1
0
 /**
  * Internal method for building. If the start or end are null, it means everything of that type.
  *
  * @param rangeStart plural category for the start of the range
  * @param rangeEnd plural category for the end of the range
  * @param result the resulting plural category
  * @internal
  * @deprecated This API is ICU internal only.
  */
 @Deprecated
 public void add(
     StandardPluralCategories rangeStart,
     StandardPluralCategories rangeEnd,
     StandardPluralCategories result) {
   if (isFrozen) {
     throw new UnsupportedOperationException();
   }
   explicit[result.ordinal()] = true;
   if (rangeStart == null) {
     for (StandardPluralCategories rs : StandardPluralCategories.values()) {
       if (rangeEnd == null) {
         for (StandardPluralCategories re : StandardPluralCategories.values()) {
           matrix.setIfNew(rs, re, result);
         }
       } else {
         explicit[rangeEnd.ordinal()] = true;
         matrix.setIfNew(rs, rangeEnd, result);
       }
     }
   } else if (rangeEnd == null) {
     explicit[rangeStart.ordinal()] = true;
     for (StandardPluralCategories re : StandardPluralCategories.values()) {
       matrix.setIfNew(rangeStart, re, result);
     }
   } else {
     explicit[rangeStart.ordinal()] = true;
     explicit[rangeEnd.ordinal()] = true;
     matrix.setIfNew(rangeStart, rangeEnd, result);
   }
 }
Пример #2
0
 @Override
 public String toString() {
   StringBuilder result = new StringBuilder();
   for (StandardPluralCategories i : StandardPluralCategories.values()) {
     for (StandardPluralCategories j : StandardPluralCategories.values()) {
       StandardPluralCategories x = get(i, j);
       if (x != null) {
         result.append(i + " & " + j + " → " + x + ";\n");
       }
     }
   }
   return result.toString();
 }