Package com.ibm.icu.util

Examples of com.ibm.icu.util.IndianCalendar


           new TestCase(2450138.501917,    PHALGUNA,      6,  SUN,   000),
           new TestCase(2465737.501960,    KARTIKA,      19,  WED,   000),
           new TestCase(2486076.502016,    ASADHA,       27,  SUN,   000),
        };
       
        IndianCalendar testCalendar = new IndianCalendar();
        testCalendar.setLenient(true);
        doTestCases(tests, testCalendar);
    }
View Full Code Here


        testCalendar.setLenient(true);
        doTestCases(tests, testCalendar);
    }

    public void TestBasic() {
        IndianCalendar cal = new IndianCalendar();
        cal.clear();
        cal.set(1000, 0, 30);
        logln("1000/0/30-> " +
              cal.get(YEAR) + "/" +
              cal.get(MONTH) + "/" +
              cal.get(DATE));
        cal.clear();
        cal.set(1, 0, 30);
        logln("1/0/30 -> " +
              cal.get(YEAR) + "/" +
              cal.get(MONTH) + "/" +
              cal.get(DATE));
    }
View Full Code Here

    public void TestCoverage() {

        {
            // new IndianCalendar(TimeZone)
            IndianCalendar cal = new IndianCalendar(TimeZone.getDefault());
            if(cal == null){
                errln("could not create IndianCalendar with TimeZone");
            }
        }

        {
            // new IndianCalendar(ULocale)
            IndianCalendar cal = new IndianCalendar(ULocale.getDefault());
            if(cal == null){
                errln("could not create IndianCalendar with ULocale");
            }
        }
       
        {
            // new IndianCalendar(Locale)
            IndianCalendar cal = new IndianCalendar(Locale.getDefault());
            if(cal == null){
                errln("could not create IndianCalendar with Locale");
            }
        }
       
        {                                                                                      
            // new IndianCalendar(TimeZone, Locale)                                            
            IndianCalendar cal = new IndianCalendar(TimeZone.getDefault(),Locale.getDefault());
            if(cal == null){                                                                   
                errln("could not create IndianCalendar with TimeZone, Locale");                
            }                                                                                  
        }                                                                                      
                                                                                               
        {                                                                                      
            // new IndianCalendar(TimeZone, ULocale)                                           
            IndianCalendar cal = new IndianCalendar(TimeZone.getDefault(),ULocale.getDefault());
            if(cal == null){                                                                   
                errln("could not create IndianCalendar with TimeZone, ULocale");               
            }                                                                                  
        }                                                                                      
       
        {
            // new IndianCalendar(Date)
            IndianCalendar cal = new IndianCalendar(new Date());
            if(cal == null){
                errln("could not create IndianCalendar with Date");
            }
        }
        {
            // new IndianCalendar(int year, int month, int date)
            IndianCalendar cal = new IndianCalendar(1917, IndianCalendar.CHAITRA, 1);
            if(cal == null){
                errln("could not create IndianCalendar with year,month,date");
            }
        }
        {
            // new IndianCalendar(int year, int month, int date, int hour, int minute, int second)
            IndianCalendar cal = new IndianCalendar(1917, IndianCalendar.CHAITRA, 1, 1, 1, 1);
            if(cal == null){
                errln("could not create IndianCalendar with year,month,date,hour,minute,second");
            }
        }
   
        {
            // data
            String[] calendarLocales = {
                "bn_IN", "gu_IN", "hi_IN", "kn_IN", "ml_IN", "or_IN", "pa_IN", "ta_IN", "te_IN"
            };

            String[] formatLocales = {
                "en", "fr", "bn", "gu", "hi", "kn", "ml", "or", "pa", "ta", "te"
            };

            for (int i = 0; i < calendarLocales.length; ++i) {
                String calLocName = calendarLocales[i];
                Locale calLocale = LocaleUtility.getLocaleFromName(calLocName);
                IndianCalendar cal = new IndianCalendar(calLocale);
                cal.set(-1039, 9, 21);

                for (int j = 0; j < formatLocales.length; j++  ) {
                    String locName = formatLocales[j];
                    Locale formatLocale = LocaleUtility.getLocaleFromName(locName);
                    DateFormat format = DateFormat.getDateTimeInstance(cal, DateFormat.FULL, DateFormat.FULL, formatLocale);
View Full Code Here

        DateFormat gDF = DateFormat.getDateInstance(gCal,DateFormat.FULL);
        logln("gregorian calendar: " + gDF.format(gToday) +
              " + 2 months = " + gDF.format(gFuture));

        // Indian Calendar
        IndianCalendar iCal= new IndianCalendar();
        Date iToday=iCal.getTime();
        iCal.add(IndianCalendar.MONTH,2);
        Date iFuture=iCal.getTime();
        DateFormat iDF = DateFormat.getDateInstance(iCal,DateFormat.FULL);
        logln("Indian calendar: " + iDF.format(iToday) +
              " + 2 months = " + iDF.format(iFuture));

    }
View Full Code Here

     * Test limits of the Indian calendar
     */
    public void TestLimits() {
        Calendar cal = Calendar.getInstance();
        cal.set(2007, Calendar.JANUARY, 1);
        IndianCalendar indian = new IndianCalendar();
        doLimitsTest(indian, null, cal.getTime());
        doTheoreticalLimitsTest(indian, true);
    }
View Full Code Here

    {
        public Object[] getTestObjects()
        {
            Locale locales[] = SerializableTest.getLocales();
            TimeZone jst = TimeZone.getTimeZone("Asia/Calcutta");
            IndianCalendar calendars[] = new IndianCalendar[locales.length];
           
            for (int i = 0; i < locales.length; i += 1) {
                calendars[i] = new IndianCalendar(jst, locales[i]);
            }
           
            return calendars;
        }
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.IndianCalendar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.