]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/tests/core/src/com/ibm/icu/dev/test/calendar/ChineseTestCase.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / tests / core / src / com / ibm / icu / dev / test / calendar / ChineseTestCase.java
1 /**\r
2  *******************************************************************************\r
3  * Copyright (C) 2001-2010, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 package com.ibm.icu.dev.test.calendar;\r
8 import java.util.Date;\r
9 \r
10 import com.ibm.icu.util.Calendar;\r
11 \r
12 public class ChineseTestCase extends TestCase {\r
13 \r
14     /**\r
15      * Initialize an object using a Julian day number and\r
16      * the corresponding fields for the calendar being tested.\r
17      *\r
18      * @param era the ERA field of tested calendar on the given Julian\r
19      * day\r
20      * @param year the YEAR field of tested calendar on the given\r
21      * Julian day\r
22      * @param month the MONTH (1-based) field of tested calendar on\r
23      * the given Julian day\r
24      * @param isLeapMonth if true, treat month as a leap month\r
25      * @param dayOfMonth the DAY_OF_MONTH field of tested calendar on the\r
26      * given Julian day\r
27      * @param dayOfWeek the DAY_OF_WEEK field of tested calendar on given\r
28      * Julian day\r
29      */\r
30     public ChineseTestCase(double julian,\r
31                            int era, int year, int month,\r
32                            boolean isLeapMonth, int dayOfMonth, int dayOfWeek) {\r
33 \r
34         setTime(new Date(JULIAN_EPOCH + (long)(ONE_DAY * julian)));\r
35         \r
36         set(Calendar.ERA, era);\r
37         set(Calendar.YEAR, year);\r
38         set(Calendar.MONTH, month - 1);\r
39         set(Calendar.IS_LEAP_MONTH, isLeapMonth?1:0);\r
40         set(Calendar.DAY_OF_MONTH, dayOfMonth);\r
41         set(Calendar.DAY_OF_WEEK, dayOfWeek);\r
42     }\r
43 \r
44     /**\r
45      * Return a String representation of this test case's time.\r
46      */\r
47     public String toString() {\r
48         return dowToString(get(Calendar.DAY_OF_WEEK)) +\r
49             get(Calendar.YEAR) + "of" + get(Calendar.ERA) +\r
50             "/" + (get(Calendar.MONTH)+1) +\r
51             (get(Calendar.IS_LEAP_MONTH)==1?"(leap)":"") + "/" +\r
52             get(Calendar.DAY_OF_MONTH);\r
53     }\r
54 }\r