1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 // 2016 and later: Unicode, Inc. and others. 3 // License & terms of use: http://www.unicode.org/copyright.html#License 4 /** 5 ******************************************************************************* 6 * Copyright (C) 2001-2010, International Business Machines Corporation and * 7 * others. All Rights Reserved. * 8 ******************************************************************************* 9 */ 10 package android.icu.dev.test.calendar; 11 import java.util.Date; 12 13 import android.icu.util.Calendar; 14 import android.icu.testsharding.MainTestShard; 15 16 @MainTestShard 17 public class ChineseTestCase extends TestCase { 18 19 /** 20 * Initialize an object using a Julian day number and 21 * the corresponding fields for the calendar being tested. 22 * 23 * @param era the ERA field of tested calendar on the given Julian 24 * day 25 * @param year the YEAR field of tested calendar on the given 26 * Julian day 27 * @param month the MONTH (1-based) field of tested calendar on 28 * the given Julian day 29 * @param isLeapMonth if true, treat month as a leap month 30 * @param dayOfMonth the DAY_OF_MONTH field of tested calendar on the 31 * given Julian day 32 * @param dayOfWeek the DAY_OF_WEEK field of tested calendar on given 33 * Julian day 34 */ 35 public ChineseTestCase(double julian, 36 int era, int year, int month, 37 boolean isLeapMonth, int dayOfMonth, int dayOfWeek) { 38 39 setTime(new Date(JULIAN_EPOCH + (long)(ONE_DAY * julian))); 40 41 set(Calendar.ERA, era); 42 set(Calendar.YEAR, year); 43 set(Calendar.MONTH, month - 1); 44 set(Calendar.IS_LEAP_MONTH, isLeapMonth?1:0); 45 set(Calendar.DAY_OF_MONTH, dayOfMonth); 46 set(Calendar.DAY_OF_WEEK, dayOfWeek); 47 } 48 49 /** 50 * Return a String representation of this test case's time. 51 */ 52 @Override 53 public String toString() { 54 return dowToString(get(Calendar.DAY_OF_WEEK)) + 55 get(Calendar.YEAR) + "of" + get(Calendar.ERA) + 56 "/" + (get(Calendar.MONTH)+1) + 57 (get(Calendar.IS_LEAP_MONTH)==1?"(leap)":"") + "/" + 58 get(Calendar.DAY_OF_MONTH); 59 } 60 } 61