FileDocCategorySizeDatePackage
PluralRules.javaAPI DocAndroid 1.5 API3257Wed May 06 22:41:54 BST 2009android.content.res

PluralRules

public abstract class PluralRules extends Object

Fields Summary
static final int
QUANTITY_OTHER
static final int
QUANTITY_ZERO
static final int
QUANTITY_ONE
static final int
QUANTITY_TWO
static final int
QUANTITY_FEW
static final int
QUANTITY_MANY
static final int
ID_OTHER
private static PluralRules
cs
private static PluralRules
en
Constructors Summary
Methods Summary
final intattrForNumber(int n)


       

        
        return PluralRules.attrForQuantity(quantityForNumber(n));
    
static final intattrForQuantity(int quantity)

        // see include/utils/ResourceTypes.h
        switch (quantity) {
            case QUANTITY_ZERO: return 0x01000005;
            case QUANTITY_ONE:  return 0x01000006;
            case QUANTITY_TWO:  return 0x01000007;
            case QUANTITY_FEW:  return 0x01000008;
            case QUANTITY_MANY: return 0x01000009;
            default:            return ID_OTHER;
        }
    
abstract intquantityForNumber(int n)

static final android.content.res.PluralRulesruleForLocale(java.util.Locale locale)

        String lang = locale.getLanguage();
        if ("cs".equals(lang)) {
            if (cs == null) cs = new cs();
            return cs;
        }
        else {
            if (en == null) en = new en();
            return en;
        }
    
static final java.lang.StringstringForQuantity(int quantity)

        switch (quantity) {
            case QUANTITY_ZERO:
                return "zero";
            case QUANTITY_ONE:
                return "one";
            case QUANTITY_TWO:
                return "two";
            case QUANTITY_FEW:
                return "few";
            case QUANTITY_MANY:
                return "many";
            default:
                return "other";
        }