Java 类org.joda.time.chrono.LenientChronology 实例源码
项目:Artificial-Intelligent-chat-bot-
文件:IntervalUtils.java
public static int getYearsBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Years.yearsBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getYears();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:Artificial-Intelligent-chat-bot-
文件:IntervalUtils.java
public static int getDaysBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Days.daysBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getDays();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:Artificial-Intelligent-chat-bot-
文件:IntervalUtils.java
public static int getHoursBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Hours.hoursBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getHours();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:Artificial-Intelligent-chat-bot-
文件:IntervalUtils.java
public static int getMonthsBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Months.monthsBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getMonths();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:Daytripper
文件:IntervalUtils.java
public static int getHoursBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Hours.hoursBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getHours();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:Daytripper
文件:IntervalUtils.java
public static int getYearsBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Years.yearsBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getYears();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:Daytripper
文件:IntervalUtils.java
public static int getMonthsBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Months.monthsBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getMonths();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:Daytripper
文件:IntervalUtils.java
public static int getDaysBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Days.daysBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getDays();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:program-ab
文件:IntervalUtils.java
public static int getHoursBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Hours.hoursBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getHours();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:program-ab
文件:IntervalUtils.java
public static int getYearsBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Years.yearsBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getYears();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:program-ab
文件:IntervalUtils.java
public static int getMonthsBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Months.monthsBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getMonths();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:program-ab
文件:IntervalUtils.java
public static int getDaysBetween(final String date1, final String date2, String format){
try {
final DateTimeFormatter fmt =
DateTimeFormat
.forPattern(format)
.withChronology(
LenientChronology.getInstance(
GregorianChronology.getInstance()));
return Days.daysBetween(
fmt.parseDateTime(date1),
fmt.parseDateTime(date2)
).getDays();
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
项目:astor
文件:TestChronology.java
public void testEqualsHashCode_Lenient() {
Chronology chrono1 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono2 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono3 = LenientChronology.getInstance(ISOChronology.getInstance());
assertEquals(true, chrono1.equals(chrono2));
assertEquals(false, chrono1.equals(chrono3));
DateTime dt1 = new DateTime(0L, chrono1);
DateTime dt2 = new DateTime(0L, chrono2);
DateTime dt3 = new DateTime(0L, chrono3);
assertEquals(true, dt1.equals(dt2));
assertEquals(false, dt1.equals(dt3));
assertEquals(true, chrono1.hashCode() == chrono2.hashCode());
assertEquals(false, chrono1.hashCode() == chrono3.hashCode());
}
项目:astor
文件:TestChronology.java
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());
}
项目:astor
文件:TestChronology.java
public void testEqualsHashCode_Lenient() {
Chronology chrono1 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono2 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono3 = LenientChronology.getInstance(ISOChronology.getInstance());
assertEquals(true, chrono1.equals(chrono2));
assertEquals(false, chrono1.equals(chrono3));
DateTime dt1 = new DateTime(0L, chrono1);
DateTime dt2 = new DateTime(0L, chrono2);
DateTime dt3 = new DateTime(0L, chrono3);
assertEquals(true, dt1.equals(dt2));
assertEquals(false, dt1.equals(dt3));
assertEquals(true, chrono1.hashCode() == chrono2.hashCode());
assertEquals(false, chrono1.hashCode() == chrono3.hashCode());
}
项目:astor
文件:TestChronology.java
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());
}
项目:versemem-android
文件:TestChronology.java
public void testEqualsHashCode_Lenient() {
Chronology chrono1 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono2 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono3 = LenientChronology.getInstance(ISOChronology.getInstance());
assertEquals(true, chrono1.equals(chrono2));
assertEquals(false, chrono1.equals(chrono3));
DateTime dt1 = new DateTime(0L, chrono1);
DateTime dt2 = new DateTime(0L, chrono2);
DateTime dt3 = new DateTime(0L, chrono3);
assertEquals(true, dt1.equals(dt2));
assertEquals(false, dt1.equals(dt3));
assertEquals(true, chrono1.hashCode() == chrono2.hashCode());
assertEquals(false, chrono1.hashCode() == chrono3.hashCode());
}
项目:versemem-android
文件:TestChronology.java
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());
}
项目:astor
文件:TestMonthDay_Properties.java
public void testPropertyEqualsHashCodeLenient() {
MonthDay test1 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
MonthDay test2 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestYearMonth_Properties.java
public void testPropertyEqualsHashCodeLenient() {
YearMonth test1 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
YearMonth test2 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
assertEquals(true, test2.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
}
项目:astor
文件:TestDateTime_Properties.java
public void testPropertyEqualsHashCodeLenient() {
DateTime test1 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
DateTime test2 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestLocalDate_Basics.java
public void testEqualsHashCodeLenient() {
LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
项目:astor
文件:TestLocalDate_Properties.java
public void testPropertyEqualsHashCodeLenient() {
LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestDateMidnight_Properties.java
public void testPropertyEqualsHashCodeLenient() {
DateMidnight test1 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
DateMidnight test2 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestInterval_Basics.java
public void testEqualsHashCodeLenient() {
Interval test1 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
Interval test2 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
项目:astor
文件:TestInterval_Basics.java
public void testEqualsHashCodeStrict() {
Interval test1 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
Interval test2 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
项目:astor
文件:TestYearMonthDay_Properties.java
public void testPropertyEqualsHashCodeLenient() {
YearMonthDay test1 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
YearMonthDay test2 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestMonthDay_Properties.java
public void testPropertyEqualsHashCodeLenient() {
MonthDay test1 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
MonthDay test2 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestYearMonth_Properties.java
public void testPropertyEqualsHashCodeLenient() {
YearMonth test1 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
YearMonth test2 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
assertEquals(true, test2.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
}
项目:astor
文件:TestDateTime_Properties.java
public void testPropertyEqualsHashCodeLenient() {
DateTime test1 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
DateTime test2 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestLocalDate_Basics.java
public void testEqualsHashCodeLenient() {
LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
项目:astor
文件:TestLocalDate_Properties.java
public void testPropertyEqualsHashCodeLenient() {
LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestDateMidnight_Properties.java
public void testPropertyEqualsHashCodeLenient() {
DateMidnight test1 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
DateMidnight test2 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:astor
文件:TestInterval_Basics.java
public void testEqualsHashCodeLenient() {
Interval test1 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
Interval test2 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
项目:astor
文件:TestInterval_Basics.java
public void testEqualsHashCodeStrict() {
Interval test1 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
Interval test2 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
项目:astor
文件:TestYearMonthDay_Properties.java
public void testPropertyEqualsHashCodeLenient() {
YearMonthDay test1 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
YearMonthDay test2 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:super-csv-annotation
文件:AbstractJodaProcessorBuilder.java
/**
* 変換規則から、{@link DateTimeFormatter}のインスタンスを作成する。
* <p>アノテーション{@link CsvDateTimeFormat}が付与されていない場合は、各種タイプごとの標準の書式で作成する。</p>
* @param field フィールド情報
* @param config システム設定
* @return {@link DateTimeFormatter}のインスタンス。
*/
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) {
final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class);
if(!formatAnno.isPresent()) {
return DateTimeFormat.forPattern(getDefaultPattern());
}
String pattern = formatAnno.get().pattern();
if(pattern.isEmpty()) {
pattern = getDefaultPattern();
}
final Locale locale = Utils.getLocale(formatAnno.get().locale());
final DateTimeZone zone = formatAnno.get().timezone().isEmpty() ? DateTimeZone.getDefault()
: DateTimeZone.forTimeZone(TimeZone.getTimeZone(formatAnno.get().timezone()));
final DateTimeFormatter formatter = DateTimeFormat.forPattern(pattern)
.withLocale(locale)
.withZone(zone);
final boolean lenient = formatAnno.get().lenient();
if(lenient) {
Chronology chronology = LenientChronology.getInstance(ISOChronology.getInstance());
return formatter.withChronology(chronology);
} else {
return formatter;
}
}
项目:versemem-android
文件:TestMonthDay_Properties.java
public void testPropertyEqualsHashCodeLenient() {
MonthDay test1 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
MonthDay test2 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
项目:versemem-android
文件:TestYearMonth_Properties.java
public void testPropertyEqualsHashCodeLenient() {
YearMonth test1 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
YearMonth test2 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
assertEquals(true, test2.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
}
项目:versemem-android
文件:TestDateTime_Properties.java
public void testPropertyEqualsHashCodeLenient() {
DateTime test1 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
DateTime test2 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}