1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 /* 3 ******************************************************************************* 4 * Copyright (C) 1996-2012, International Business Machines Corporation and * 5 * others. All Rights Reserved. * 6 ******************************************************************************* 7 * 8 */ 9 10 package android.icu.dev.test.serializable; 11 12 import java.util.Locale; 13 14 import android.icu.util.BuddhistCalendar; 15 import android.icu.util.Calendar; 16 import android.icu.util.ChineseCalendar; 17 import android.icu.util.CopticCalendar; 18 import android.icu.util.DangiCalendar; 19 import android.icu.util.EthiopicCalendar; 20 import android.icu.util.GregorianCalendar; 21 import android.icu.util.HebrewCalendar; 22 import android.icu.util.IndianCalendar; 23 import android.icu.util.IslamicCalendar; 24 import android.icu.util.JapaneseCalendar; 25 import android.icu.util.PersianCalendar; 26 import android.icu.util.TaiwanCalendar; 27 import android.icu.util.TimeZone; 28 import android.icu.util.ULocale; 29 30 /** 31 * @author emader 32 * 33 * TODO To change the template for this generated type comment go to 34 * Window - Preferences - Java - Code Style - Code Templates 35 */ 36 public class CalendarTests 37 { 38 static class CalendarHandler implements SerializableTest.Handler 39 { 40 public Object[] getTestObjects() 41 { 42 Locale locales[] = SerializableTest.getLocales(); 43 TimeZone pst = TimeZone.getTimeZone("America/Los_Angeles"); 44 Calendar calendars[] = new Calendar[locales.length]; 45 46 for (int i = 0; i < locales.length; i += 1) { 47 calendars[i] = Calendar.getInstance(pst, locales[i]); 48 } 49 50 return calendars; 51 } 52 53 public boolean hasSameBehavior(Object a, Object b) 54 { 55 Calendar cal_a = (Calendar) a; 56 Calendar cal_b = (Calendar) b; 57 long now = System.currentTimeMillis(); 58 59 cal_a.setTimeInMillis(now); 60 cal_a.roll(Calendar.MONTH, 1); 61 62 cal_b.setTimeInMillis(now); 63 cal_b.roll(Calendar.MONTH, 1); 64 65 return cal_a.getTime().equals(cal_a.getTime()); 66 } 67 } 68 69 static class BuddhistCalendarHandler extends CalendarHandler 70 { 71 public Object[] getTestObjects() 72 { 73 Locale locales[] = SerializableTest.getLocales(); 74 TimeZone tst = TimeZone.getTimeZone("Asia/Bangkok"); 75 BuddhistCalendar calendars[] = new BuddhistCalendar[locales.length]; 76 77 for (int i = 0; i < locales.length; i += 1) { 78 calendars[i] = new BuddhistCalendar(tst, locales[i]); 79 } 80 81 return calendars; 82 } 83 } 84 85 static class ChineseCalendarHandler extends CalendarHandler 86 { 87 public Object[] getTestObjects() 88 { 89 Locale locales[] = SerializableTest.getLocales(); 90 TimeZone cst = TimeZone.getTimeZone("Asia/Shanghai"); 91 ChineseCalendar calendars[] = new ChineseCalendar[locales.length]; 92 93 for (int i = 0; i < locales.length; i += 1) { 94 calendars[i] = new ChineseCalendar(cst, locales[i]); 95 } 96 97 return calendars; 98 } 99 } 100 101 static class CopticCalendarHandler extends CalendarHandler 102 { 103 public Object[] getTestObjects() 104 { 105 Locale locales[] = SerializableTest.getLocales(); 106 TimeZone ast = TimeZone.getTimeZone("Europe/Athens"); 107 CopticCalendar calendars[] = new CopticCalendar[locales.length]; 108 109 for (int i = 0; i < locales.length; i += 1) { 110 calendars[i] = new CopticCalendar(ast, locales[i]); 111 } 112 113 return calendars; 114 } 115 } 116 117 static class DangiCalendarHandler extends CalendarHandler 118 { 119 public Object[] getTestObjects() 120 { 121 Locale locales[] = SerializableTest.getLocales(); 122 TimeZone kst = TimeZone.getTimeZone("Asia/Seoul"); 123 DangiCalendar calendars[] = new DangiCalendar[locales.length]; 124 125 for (int i = 0; i < locales.length; i += 1) { 126 calendars[i] = new DangiCalendar(kst, ULocale.forLocale(locales[i])); 127 } 128 129 return calendars; 130 } 131 } 132 133 static class EthiopicCalendarHandler extends CalendarHandler 134 { 135 public Object[] getTestObjects() 136 { 137 Locale locales[] = SerializableTest.getLocales(); 138 TimeZone ast = TimeZone.getTimeZone("Africa/Addis_Ababa"); 139 EthiopicCalendar calendars[] = new EthiopicCalendar[locales.length]; 140 141 for (int i = 0; i < locales.length; i += 1) { 142 calendars[i] = new EthiopicCalendar(ast, locales[i]); 143 } 144 145 return calendars; 146 } 147 } 148 149 static class GregorianCalendarHandler extends CalendarHandler 150 { 151 public Object[] getTestObjects() 152 { 153 Locale locales[] = SerializableTest.getLocales(); 154 TimeZone pst = TimeZone.getTimeZone("America/Los_Angeles"); 155 GregorianCalendar calendars[] = new GregorianCalendar[locales.length]; 156 157 for (int i = 0; i < locales.length; i += 1) { 158 calendars[i] = new GregorianCalendar(pst, locales[i]); 159 } 160 161 return calendars; 162 } 163 } 164 165 static class HebrewCalendarHandler extends CalendarHandler 166 { 167 public Object[] getTestObjects() 168 { 169 Locale locales[] = SerializableTest.getLocales(); 170 TimeZone jst = TimeZone.getTimeZone("Asia/Jerusalem"); 171 HebrewCalendar calendars[] = new HebrewCalendar[locales.length]; 172 173 for (int i = 0; i < locales.length; i += 1) { 174 calendars[i] = new HebrewCalendar(jst, locales[i]); 175 } 176 177 return calendars; 178 } 179 } 180 181 static class IndianCalendarHandler extends CalendarHandler 182 { 183 public Object[] getTestObjects() 184 { 185 Locale locales[] = SerializableTest.getLocales(); 186 TimeZone jst = TimeZone.getTimeZone("Asia/Calcutta"); 187 IndianCalendar calendars[] = new IndianCalendar[locales.length]; 188 189 for (int i = 0; i < locales.length; i += 1) { 190 calendars[i] = new IndianCalendar(jst, locales[i]); 191 } 192 193 return calendars; 194 } 195 } 196 197 static class IslamicCalendarHandler extends CalendarHandler 198 { 199 public Object[] getTestObjects() { 200 Locale locales[] = SerializableTest.getLocales(); 201 TimeZone cst = TimeZone.getTimeZone("Africa/Cairo"); 202 IslamicCalendar calendars[] = new IslamicCalendar[locales.length]; 203 204 for (int i = 0; i < locales.length; i += 1) { 205 calendars[i] = new IslamicCalendar(cst, locales[i]); 206 } 207 208 return calendars; 209 } 210 } 211 212 static class JapaneseCalendarHandler extends CalendarHandler 213 { 214 public Object[] getTestObjects() 215 { 216 Locale locales[] = SerializableTest.getLocales(); 217 TimeZone jst = TimeZone.getTimeZone("Asia/Tokyo"); 218 JapaneseCalendar calendars[] = new JapaneseCalendar[locales.length]; 219 220 for (int i = 0; i < locales.length; i += 1) { 221 calendars[i] = new JapaneseCalendar(jst, locales[i]); 222 } 223 224 return calendars; 225 } 226 } 227 228 static class PersianCalendarHandler extends CalendarHandler 229 { 230 public Object[] getTestObjects() 231 { 232 Locale locales[] = SerializableTest.getLocales(); 233 TimeZone kst = TimeZone.getTimeZone("Asia/Tehran"); 234 PersianCalendar calendars[] = new PersianCalendar[locales.length]; 235 236 for (int i = 0; i < locales.length; i += 1) { 237 calendars[i] = new PersianCalendar(kst, ULocale.forLocale(locales[i])); 238 } 239 240 return calendars; 241 } 242 } 243 244 static class TaiwanCalendarHandler extends CalendarHandler { 245 public Object[] getTestObjects() { 246 Locale locales[] = SerializableTest.getLocales(); 247 TimeZone cst = TimeZone.getTimeZone("Asia/Shanghai"); 248 TaiwanCalendar calendars[] = new TaiwanCalendar[locales.length]; 249 250 for (int i = 0; i < locales.length; i += 1) { 251 calendars[i] = new TaiwanCalendar(cst, locales[i]); 252 } 253 254 return calendars; 255 } 256 } 257 258 public static void main(String[] args) 259 { 260 //nothing needed yet... 261 } 262 } 263