Home | History | Annotate | Download | only in calendar
      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 
     15 public class ChineseTestCase extends TestCase {
     16 
     17     /**
     18      * Initialize an object using a Julian day number and
     19      * the corresponding fields for the calendar being tested.
     20      *
     21      * @param era the ERA field of tested calendar on the given Julian
     22      * day
     23      * @param year the YEAR field of tested calendar on the given
     24      * Julian day
     25      * @param month the MONTH (1-based) field of tested calendar on
     26      * the given Julian day
     27      * @param isLeapMonth if true, treat month as a leap month
     28      * @param dayOfMonth the DAY_OF_MONTH field of tested calendar on the
     29      * given Julian day
     30      * @param dayOfWeek the DAY_OF_WEEK field of tested calendar on given
     31      * Julian day
     32      */
     33     public ChineseTestCase(double julian,
     34                            int era, int year, int month,
     35                            boolean isLeapMonth, int dayOfMonth, int dayOfWeek) {
     36 
     37         setTime(new Date(JULIAN_EPOCH + (long)(ONE_DAY * julian)));
     38 
     39         set(Calendar.ERA, era);
     40         set(Calendar.YEAR, year);
     41         set(Calendar.MONTH, month - 1);
     42         set(Calendar.IS_LEAP_MONTH, isLeapMonth?1:0);
     43         set(Calendar.DAY_OF_MONTH, dayOfMonth);
     44         set(Calendar.DAY_OF_WEEK, dayOfWeek);
     45     }
     46 
     47     /**
     48      * Return a String representation of this test case's time.
     49      */
     50     public String toString() {
     51         return dowToString(get(Calendar.DAY_OF_WEEK)) +
     52             get(Calendar.YEAR) + "of" + get(Calendar.ERA) +
     53             "/" + (get(Calendar.MONTH)+1) +
     54             (get(Calendar.IS_LEAP_MONTH)==1?"(leap)":"") + "/" +
     55             get(Calendar.DAY_OF_MONTH);
     56     }
     57 }
     58