use of android.icu.impl.StandardPlural in project j2objc by google.
the class PluralRanges method add.
/**
* 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
* @deprecated This API is ICU internal only.
* @hide draft / provisional / internal are hidden on Android
*/
@Deprecated
public void add(StandardPlural rangeStart, StandardPlural rangeEnd, StandardPlural result) {
if (isFrozen) {
throw new UnsupportedOperationException();
}
explicit[result.ordinal()] = true;
if (rangeStart == null) {
for (StandardPlural rs : StandardPlural.values()) {
if (rangeEnd == null) {
for (StandardPlural re : StandardPlural.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 (StandardPlural re : StandardPlural.values()) {
matrix.setIfNew(rangeStart, re, result);
}
} else {
explicit[rangeStart.ordinal()] = true;
explicit[rangeEnd.ordinal()] = true;
matrix.setIfNew(rangeStart, rangeEnd, result);
}
}
use of android.icu.impl.StandardPlural in project j2objc by google.
the class PluralRangesTest method TestBasic.
@Test
public void TestBasic() {
PluralRanges a = new PluralRanges();
a.add(StandardPlural.ONE, StandardPlural.OTHER, StandardPlural.ONE);
StandardPlural actual = a.get(StandardPlural.ONE, StandardPlural.OTHER);
assertEquals("range", StandardPlural.ONE, actual);
a.freeze();
try {
a.add(StandardPlural.ONE, StandardPlural.ONE, StandardPlural.ONE);
errln("Failed to cause exception on frozen instance");
} catch (UnsupportedOperationException e) {
}
}
Aggregations