1 package org.robolectric.res; 2 3 public class Plural { 4 final String quantity, string; 5 final int num; 6 final boolean usedInEnglish; 7 Plural(String quantity, String string)8 Plural(String quantity, String string) { 9 this.quantity = quantity; 10 this.string = string; 11 if ("zero".equals(quantity)) { 12 num = 0; 13 usedInEnglish = false; 14 } else if ("one".equals(quantity)) { 15 num = 1; 16 usedInEnglish = true; 17 } else if ("two".equals(quantity)) { 18 num = 2; 19 usedInEnglish = false; 20 } else if ("other".equals(quantity)) { 21 num = -1; 22 usedInEnglish = true; 23 } else { 24 num = -1; 25 usedInEnglish = true; 26 } 27 } 28 getString()29 public String getString() { 30 return string; 31 } 32 33 @Override toString()34 public String toString() { 35 return quantity + "(" + num + "): " + string; 36 } 37 } 38