当前位置: 首页>>代码示例>>Java>>正文


Java BuddhistChronology.getInstance方法代码示例

本文整理汇总了Java中org.joda.time.chrono.BuddhistChronology.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java BuddhistChronology.getInstance方法的具体用法?Java BuddhistChronology.getInstance怎么用?Java BuddhistChronology.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.chrono.BuddhistChronology的用法示例。


在下文中一共展示了BuddhistChronology.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChronology

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
/**
 * Gets the chronology, which is the GJChronology if a GregorianCalendar is used,
 * BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise.
 * The time zone specified is used in preference to that on the calendar.
 * 
 * @param object  the Calendar to convert, must not be null
 * @param zone  the specified zone to use, null means default zone
 * @return the chronology, never null
 * @throws NullPointerException if the object is null
 * @throws ClassCastException if the object is an invalid type
 */
public Chronology getChronology(Object object, DateTimeZone zone) {
    if (object.getClass().getName().endsWith(".BuddhistCalendar")) {
        return BuddhistChronology.getInstance(zone);
    } else if (object instanceof GregorianCalendar) {
        GregorianCalendar gc = (GregorianCalendar) object;
        long cutover = gc.getGregorianChange().getTime();
        if (cutover == Long.MIN_VALUE) {
            return GregorianChronology.getInstance(zone);
        } else if (cutover == Long.MAX_VALUE) {
            return JulianChronology.getInstance(zone);
        } else {
            return GJChronology.getInstance(zone, cutover, 4);
        }
    } else {
        return ISOChronology.getInstance(zone);
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:29,代码来源:CalendarConverter.java

示例2: testGetInstantChronology_RI

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testGetInstantChronology_RI() {
    DateTime dt = new DateTime(123L, BuddhistChronology.getInstance());
    assertEquals(BuddhistChronology.getInstance(), DateTimeUtils.getInstantChronology(dt));
    
    Instant i = new Instant(123L);
    assertEquals(ISOChronology.getInstanceUTC(), DateTimeUtils.getInstantChronology(i));
    
    AbstractInstant ai = new AbstractInstant() {
        public long getMillis() {
            return 0L;
        }
        public Chronology getChronology() {
            return null; // testing for this
        }
    };
    assertEquals(ISOChronology.getInstance(), DateTimeUtils.getInstantChronology(ai));
    
    assertEquals(ISOChronology.getInstance(), DateTimeUtils.getInstantChronology(null));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:TestDateTimeUtils.java

示例3: testMinus_RP

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testMinus_RP() {
    YearMonth test = new YearMonth(2002, 5, BuddhistChronology.getInstance());
    YearMonth result = test.minus(new Period(1, 1, 1, 1, 1, 1, 1, 1));
    YearMonth expected = new YearMonth(2001, 4, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.minus((ReadablePeriod) null);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestYearMonth_Basics.java

示例4: testGetIntervalChronology_RInterval

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testGetIntervalChronology_RInterval() {
    Interval dt = new Interval(123L, 456L, BuddhistChronology.getInstance());
    assertEquals(BuddhistChronology.getInstance(), DateTimeUtils.getIntervalChronology(dt));
    
    assertEquals(ISOChronology.getInstance(), DateTimeUtils.getIntervalChronology(null));
    
    MutableInterval ai = new MutableInterval() {
        public Chronology getChronology() {
            return null; // testing for this
        }
    };
    assertEquals(ISOChronology.getInstance(), DateTimeUtils.getIntervalChronology(ai));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:TestDateTimeUtils.java

示例5: testMinusDays_int

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testMinusDays_int() {
    YearMonthDay test = new YearMonthDay(2002, 5, 3, BuddhistChronology.getInstance());
    YearMonthDay result = test.minusDays(1);
    YearMonthDay expected = new YearMonthDay(2002, 5, 2, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.minusDays(0);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestYearMonthDay_Basics.java

示例6: testPlusHours_int

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testPlusHours_int() {
    TimeOfDay test = new TimeOfDay(1, 2, 3, 4, BuddhistChronology.getInstance());
    TimeOfDay result = test.plusHours(1);
    TimeOfDay expected = new TimeOfDay(2, 2, 3, 4, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.plusHours(0);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestTimeOfDay_Basics.java

示例7: testPlusDays_int

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testPlusDays_int() {
    YearMonthDay test = new YearMonthDay(2002, 5, 3, BuddhistChronology.getInstance());
    YearMonthDay result = test.plusDays(1);
    YearMonthDay expected = new YearMonthDay(2002, 5, 4, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.plusDays(0);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestYearMonthDay_Basics.java

示例8: testPlusYears_int

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testPlusYears_int() {
    YearMonthDay test = new YearMonthDay(2002, 5, 3, BuddhistChronology.getInstance());
    YearMonthDay result = test.plusYears(1);
    YearMonthDay expected = new YearMonthDay(2003, 5, 3, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.plusYears(0);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestYearMonthDay_Basics.java

示例9: testPlus_RP

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testPlus_RP() {
    MonthDay test = new MonthDay(6, 5, BuddhistChronology.getInstance());
    MonthDay result = test.plus(new Period(1, 2, 3, 4, 5, 6, 7, 8));
    MonthDay expected = new MonthDay(8, 9, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.plus((ReadablePeriod) null);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestMonthDay_Basics.java

示例10: testMinusSeconds_int

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testMinusSeconds_int() {
    TimeOfDay test = new TimeOfDay(1, 2, 3, 4, BuddhistChronology.getInstance());
    TimeOfDay result = test.minusSeconds(1);
    TimeOfDay expected = new TimeOfDay(1, 2, 2, 4, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.minusSeconds(0);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestTimeOfDay_Basics.java

示例11: testPlusMonths_int

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testPlusMonths_int() {
    YearMonthDay test = new YearMonthDay(2002, 5, 3, BuddhistChronology.getInstance());
    YearMonthDay result = test.plusMonths(1);
    YearMonthDay expected = new YearMonthDay(2002, 6, 3, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.plusMonths(0);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestYearMonthDay_Basics.java

示例12: testPlusMillis_int

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testPlusMillis_int() {
    TimeOfDay test = new TimeOfDay(1, 2, 3, 4, BuddhistChronology.getInstance());
    TimeOfDay result = test.plusMillis(1);
    TimeOfDay expected = new TimeOfDay(1, 2, 3, 5, BuddhistChronology.getInstance());
    assertEquals(expected, result);
    
    result = test.plusMillis(0);
    assertSame(test, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestTimeOfDay_Basics.java

示例13: testSetIntoInterval_Object2

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testSetIntoInterval_Object2() throws Exception {
    Interval i = new Interval(0L, 123L, CopticChronology.getInstance());
    MutableInterval m = new MutableInterval(-1000L, 1000L, BuddhistChronology.getInstance());
    ReadableIntervalConverter.INSTANCE.setInto(m, i, GJChronology.getInstance());
    assertEquals(0L, m.getStartMillis());
    assertEquals(123L, m.getEndMillis());
    assertEquals(GJChronology.getInstance(), m.getChronology());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:TestReadableIntervalConverter.java

示例14: testSetIntoInterval_Object3

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testSetIntoInterval_Object3() throws Exception {
    MutableInterval i = new MutableInterval(0L, 123L) {
        public Chronology getChronology() {
            return null; // bad
        }
    };
    MutableInterval m = new MutableInterval(-1000L, 1000L, BuddhistChronology.getInstance());
    ReadableIntervalConverter.INSTANCE.setInto(m, i, GJChronology.getInstance());
    assertEquals(0L, m.getStartMillis());
    assertEquals(123L, m.getEndMillis());
    assertEquals(GJChronology.getInstance(), m.getChronology());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:TestReadableIntervalConverter.java

示例15: testConstructor_Object_Chronology1

import org.joda.time.chrono.BuddhistChronology; //导入方法依赖的package包/类
public void testConstructor_Object_Chronology1() throws Throwable {
    DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
    DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
    Interval base = new Interval(dt1, dt2);
    
    MutableInterval test = new MutableInterval(base, BuddhistChronology.getInstance());
    assertEquals(dt1.getMillis(), test.getStartMillis());
    assertEquals(dt2.getMillis(), test.getEndMillis());
    assertEquals(BuddhistChronology.getInstance(), test.getChronology());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:TestMutableInterval_Constructors.java


注:本文中的org.joda.time.chrono.BuddhistChronology.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。