コード例 #1
0
ファイル: PluralRanges.java プロジェクト: dacut/juliet
 /** Internal method for setting. */
 @SuppressWarnings("unused")
 void set(
     StandardPluralCategories start,
     StandardPluralCategories end,
     StandardPluralCategories result) {
   data[start.ordinal() * StandardPluralCategories.COUNT + end.ordinal()] =
       result == null ? (byte) -1 : (byte) result.ordinal();
 }
コード例 #2
0
ファイル: PluralRanges.java プロジェクト: dacut/juliet
 @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();
 }
コード例 #3
0
ファイル: PluralRanges.java プロジェクト: dacut/juliet
 /**
  * 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);
   }
 }
コード例 #4
0
ファイル: PluralRanges.java プロジェクト: dacut/juliet
 /** Internal method for setting; throws exception if already set. */
 void setIfNew(
     StandardPluralCategories start,
     StandardPluralCategories end,
     StandardPluralCategories result) {
   byte old = data[start.ordinal() * StandardPluralCategories.COUNT + end.ordinal()];
   if (old >= 0) {
     throw new IllegalArgumentException(
         "Previously set value for <"
             + start
             + ", "
             + end
             + ", "
             + StandardPluralCategories.VALUES.get(old)
             + ">");
   }
   data[start.ordinal() * StandardPluralCategories.COUNT + end.ordinal()] =
       result == null ? (byte) -1 : (byte) result.ordinal();
 }
コード例 #5
0
ファイル: PluralRanges.java プロジェクト: dacut/juliet
 /** Internal method for getting. */
 StandardPluralCategories get(StandardPluralCategories start, StandardPluralCategories end) {
   byte result = data[start.ordinal() * StandardPluralCategories.COUNT + end.ordinal()];
   return result < 0 ? null : StandardPluralCategories.VALUES.get(result);
 }
コード例 #6
0
ファイル: PluralRanges.java プロジェクト: dacut/juliet
 /**
  * Internal method to determines whether the StandardPluralCategories was explicitly used in any
  * add statement.
  *
  * @param count plural category to test
  * @return true if set
  * @internal
  * @deprecated This API is ICU internal only.
  */
 @Deprecated
 public boolean isExplicitlySet(StandardPluralCategories count) {
   return explicit[count.ordinal()];
 }