本文整理汇总了Java中org.joda.time.chrono.JulianChronology类的典型用法代码示例。如果您正苦于以下问题:Java JulianChronology类的具体用法?Java JulianChronology怎么用?Java JulianChronology使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JulianChronology类属于org.joda.time.chrono包,在下文中一共展示了JulianChronology类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getChronology
import org.joda.time.chrono.JulianChronology; //导入依赖的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: testToString
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
public void testToString() {
DateTimeZone paris = DateTimeZone.forID("Europe/Paris");
ISOChronology isoParis = ISOChronology.getInstance(paris);
assertEquals("ISOChronology[Europe/Paris]", isoParis.toString());
assertEquals("GJChronology[Europe/Paris]", GJChronology.getInstance(paris).toString());
assertEquals("GregorianChronology[Europe/Paris]", GregorianChronology.getInstance(paris).toString());
assertEquals("JulianChronology[Europe/Paris]", JulianChronology.getInstance(paris).toString());
assertEquals("BuddhistChronology[Europe/Paris]", BuddhistChronology.getInstance(paris).toString());
assertEquals("CopticChronology[Europe/Paris]", CopticChronology.getInstance(paris).toString());
assertEquals("EthiopicChronology[Europe/Paris]", EthiopicChronology.getInstance(paris).toString());
assertEquals("IslamicChronology[Europe/Paris]", IslamicChronology.getInstance(paris).toString());
assertEquals("LenientChronology[ISOChronology[Europe/Paris]]", LenientChronology.getInstance(isoParis).toString());
assertEquals("StrictChronology[ISOChronology[Europe/Paris]]", StrictChronology.getInstance(isoParis).toString());
assertEquals("LimitChronology[ISOChronology[Europe/Paris], NoLimit, NoLimit]", LimitChronology.getInstance(isoParis, null, null).toString());
assertEquals("ZonedChronology[ISOChronology[UTC], Europe/Paris]", ZonedChronology.getInstance(isoParis, paris).toString());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:19,代码来源:TestChronology.java
示例3: testJulianYearZero
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
public void testJulianYearZero() {
DateTime dt = new DateTime(JulianChronology.getInstanceUTC());
try {
dt.year().setCopy(0);
fail();
} catch (IllegalFieldValueException e) {
assertEquals(DateTimeFieldType.year(), e.getDateTimeFieldType());
assertEquals(null, e.getDurationFieldType());
assertEquals("year", e.getFieldName());
assertEquals(new Integer(0), e.getIllegalNumberValue());
assertEquals(null, e.getIllegalStringValue());
assertEquals("0", e.getIllegalValueAsString());
assertEquals(null, e.getLowerBound());
assertEquals(null, e.getUpperBound());
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:17,代码来源:TestIllegalFieldValueException.java
示例4: getChronologyForString
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
private static Chronology getChronologyForString(String chronologyString) {
if (chronologyString == null || "gregorian".equalsIgnoreCase(chronologyString)
|| "standard".equalsIgnoreCase(chronologyString)) {
return ISOChronology.getInstanceUTC();
} else if ("proleptic_gregorian".equalsIgnoreCase(chronologyString)) {
return GregorianChronology.getInstanceUTC();
} else if ("julian".equalsIgnoreCase(chronologyString)) {
return JulianChronology.getInstanceUTC();
} else if ("noleap".equalsIgnoreCase(chronologyString)
|| "365_day".equalsIgnoreCase(chronologyString)) {
return NoLeapChronology.getInstanceUTC();
} else if ("all_leap".equalsIgnoreCase(chronologyString)
|| "366_day".equalsIgnoreCase(chronologyString)) {
return AllLeapChronology.getInstanceUTC();
} else if ("360_day".equalsIgnoreCase(chronologyString)) {
return ThreeSixtyDayChronology.getInstanceUTC();
}
return null;
}
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:20,代码来源:CdmUtils.java
示例5: testGetChronology_Object_Zone
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
public void testGetChronology_Object_Zone() throws Exception {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
assertEquals(GJChronology.getInstance(MOSCOW), CalendarConverter.INSTANCE.getChronology(cal, MOSCOW));
cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Moscow"));
assertEquals(GJChronology.getInstance(), CalendarConverter.INSTANCE.getChronology(cal, (DateTimeZone) null));
cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Moscow"));
cal.setGregorianChange(new Date(0L));
assertEquals(GJChronology.getInstance(MOSCOW, 0L, 4), CalendarConverter.INSTANCE.getChronology(cal, MOSCOW));
cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Moscow"));
cal.setGregorianChange(new Date(Long.MAX_VALUE));
assertEquals(JulianChronology.getInstance(PARIS), CalendarConverter.INSTANCE.getChronology(cal, PARIS));
cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Moscow"));
cal.setGregorianChange(new Date(Long.MIN_VALUE));
assertEquals(GregorianChronology.getInstance(PARIS), CalendarConverter.INSTANCE.getChronology(cal, PARIS));
Calendar uc = new MockUnknownCalendar(TimeZone.getTimeZone("Europe/Moscow"));
assertEquals(ISOChronology.getInstance(PARIS), CalendarConverter.INSTANCE.getChronology(uc, PARIS));
try {
Calendar bc = (Calendar) Class.forName("sun.util.BuddhistCalendar").newInstance();
bc.setTimeZone(TimeZone.getTimeZone("Europe/Moscow"));
assertEquals(BuddhistChronology.getInstance(PARIS), CalendarConverter.INSTANCE.getChronology(bc, PARIS));
} catch (ClassNotFoundException ex) {
// ignore
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:31,代码来源:TestCalendarConverter.java
示例6: testGetChronology_Object_nullChronology
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
public void testGetChronology_Object_nullChronology() throws Exception {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
assertEquals(GJChronology.getInstance(PARIS), CalendarConverter.INSTANCE.getChronology(cal, (Chronology) null));
cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Moscow"));
cal.setGregorianChange(new Date(0L));
assertEquals(GJChronology.getInstance(MOSCOW, 0L, 4), CalendarConverter.INSTANCE.getChronology(cal, (Chronology) null));
cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Moscow"));
cal.setGregorianChange(new Date(Long.MAX_VALUE));
assertEquals(JulianChronology.getInstance(MOSCOW), CalendarConverter.INSTANCE.getChronology(cal, (Chronology) null));
cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Moscow"));
cal.setGregorianChange(new Date(Long.MIN_VALUE));
assertEquals(GregorianChronology.getInstance(MOSCOW), CalendarConverter.INSTANCE.getChronology(cal, (Chronology) null));
cal = new GregorianCalendar(new MockUnknownTimeZone());
assertEquals(GJChronology.getInstance(), CalendarConverter.INSTANCE.getChronology(cal, (Chronology) null));
Calendar uc = new MockUnknownCalendar(TimeZone.getTimeZone("Europe/Moscow"));
assertEquals(ISOChronology.getInstance(MOSCOW), CalendarConverter.INSTANCE.getChronology(uc, (Chronology) null));
try {
Calendar bc = (Calendar) Class.forName("sun.util.BuddhistCalendar").newInstance();
bc.setTimeZone(TimeZone.getTimeZone("Europe/Moscow"));
assertEquals(BuddhistChronology.getInstance(MOSCOW), CalendarConverter.INSTANCE.getChronology(bc, (Chronology) null));
} catch (ClassNotFoundException ex) {
// ignore
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:31,代码来源:TestCalendarConverter.java
示例7: setUp
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
JULIAN = JulianChronology.getInstance();
ISO = ISOChronology.getInstance();
zone = DateTimeZone.getDefault();
DateTimeZone.setDefault(PARIS);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:TestReadableDurationConverter.java
示例8: setUp
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
protected void setUp() throws Exception {
DateTimeUtils.setCurrentMillisFixed(TEST_TIME_NOW);
originalDateTimeZone = DateTimeZone.getDefault();
originalTimeZone = TimeZone.getDefault();
originalLocale = Locale.getDefault();
DateTimeZone.setDefault(DateTimeZone.forID("Europe/London"));
TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
Locale.setDefault(Locale.UK);
ISO = ISOChronology.getInstance();
JULIAN = JulianChronology.getInstance();
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:TestNullConverter.java
示例9: setUp
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
protected void setUp() throws Exception {
zone = DateTimeZone.getDefault();
locale = Locale.getDefault();
DateTimeZone.setDefault(LONDON);
Locale.setDefault(Locale.UK);
JULIAN = JulianChronology.getInstance();
ISO = ISOChronology.getInstance();
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestStringConverter.java
示例10: testGetDateTime5
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
public void testGetDateTime5() throws Exception {
DateTime test = new DateTime("2004-06-09T12:24:48.501+02:00", JulianChronology.getInstance(PARIS));
assertEquals(2004, test.getYear());
assertEquals(6, test.getMonthOfYear());
assertEquals(9, test.getDayOfMonth());
assertEquals(12, test.getHourOfDay());
assertEquals(24, test.getMinuteOfHour());
assertEquals(48, test.getSecondOfMinute());
assertEquals(501, test.getMillisOfSecond());
assertEquals(PARIS, test.getZone());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestStringConverter.java
示例11: testGetDateTime6
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
public void testGetDateTime6() throws Exception {
DateTime test = new DateTime("2004-06-09T12:24:48.501", JulianChronology.getInstance(PARIS));
assertEquals(2004, test.getYear());
assertEquals(6, test.getMonthOfYear());
assertEquals(9, test.getDayOfMonth());
assertEquals(12, test.getHourOfDay());
assertEquals(24, test.getMinuteOfHour());
assertEquals(48, test.getSecondOfMinute());
assertEquals(501, test.getMillisOfSecond());
assertEquals(PARIS, test.getZone());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestStringConverter.java
示例12: testFactoryMillisOfDay_long1_Chronology
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
/**
* Test factory (long, Chronology)
*/
public void testFactoryMillisOfDay_long1_Chronology() throws Throwable {
TimeOfDay test = TimeOfDay.fromMillisOfDay(TEST_TIME1, JulianChronology.getInstance());
assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
assertEquals(1, test.getHourOfDay());
assertEquals(2, test.getMinuteOfHour());
assertEquals(3, test.getSecondOfMinute());
assertEquals(4, test.getMillisOfSecond());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java
示例13: testConstructor_Chronology
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
/**
* Test constructor (Chronology)
*/
public void testConstructor_Chronology() throws Throwable {
TimeOfDay test = new TimeOfDay(JulianChronology.getInstance());
assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
assertEquals(10 + OFFSET, test.getHourOfDay());
assertEquals(20, test.getMinuteOfHour());
assertEquals(30, test.getSecondOfMinute());
assertEquals(40, test.getMillisOfSecond());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java
示例14: testConstructor_long1_Chronology
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
/**
* Test constructor (long, Chronology)
*/
public void testConstructor_long1_Chronology() throws Throwable {
TimeOfDay test = new TimeOfDay(TEST_TIME1, JulianChronology.getInstance());
assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
assertEquals(1 + OFFSET, test.getHourOfDay());
assertEquals(2, test.getMinuteOfHour());
assertEquals(3, test.getSecondOfMinute());
assertEquals(4, test.getMillisOfSecond());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java
示例15: testConstructor_long2_Chronology
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
/**
* Test constructor (long, Chronology)
*/
public void testConstructor_long2_Chronology() throws Throwable {
TimeOfDay test = new TimeOfDay(TEST_TIME2, JulianChronology.getInstance());
assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
assertEquals(5 + OFFSET, test.getHourOfDay());
assertEquals(6, test.getMinuteOfHour());
assertEquals(7, test.getSecondOfMinute());
assertEquals(8, test.getMillisOfSecond());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java
示例16: testConstructor_Object_Chronology
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
/**
* Test constructor (Object, Chronology)
*/
public void testConstructor_Object_Chronology() throws Throwable {
Date date = new Date(TEST_TIME1);
TimeOfDay test = new TimeOfDay(date, JulianChronology.getInstance());
assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
assertEquals(1 + OFFSET, test.getHourOfDay());
assertEquals(2, test.getMinuteOfHour());
assertEquals(3, test.getSecondOfMinute());
assertEquals(4, test.getMillisOfSecond());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:TestTimeOfDay_Constructors.java
示例17: testConstructor_nullObject_Chronology
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
/**
* Test constructor (Object=null, Chronology)
*/
public void testConstructor_nullObject_Chronology() throws Throwable {
TimeOfDay test = new TimeOfDay((Object) null, JulianChronology.getInstance());
assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
assertEquals(10 + OFFSET, test.getHourOfDay());
assertEquals(20, test.getMinuteOfHour());
assertEquals(30, test.getSecondOfMinute());
assertEquals(40, test.getMillisOfSecond());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java
示例18: MainTest
import org.joda.time.chrono.JulianChronology; //导入依赖的package包/类
/**
* @param iterations number of test iterations to perform
* @param mode GREGORIAN_MODE or JULIAN_MODE,0=Gregorian, 1=Julian
* @param seed seed for random number generator
*/
public MainTest(int iterations, int mode, long seed) {
super("testChronology");
iIterations = iterations;
iMode = mode;
iSeed = seed;
if (mode == GREGORIAN_MODE) {
iTest = new TestGregorianChronology();
iActual = GregorianChronology.getInstanceUTC();
} else {
iTest = new TestJulianChronology();
iActual = JulianChronology.getInstanceUTC();
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:19,代码来源:MainTest.java
注:本文中的org.joda.time.chrono.JulianChronology类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论