本文整理了Java中org.joda.time.DateTime.compareTo()
方法的一些代码示例,展示了DateTime.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.compareTo()
方法的具体详情如下:
包路径:org.joda.time.DateTime
类名称:DateTime
方法名:compareTo
暂无
代码示例来源:origin: apache/incubator-druid
@Override
public int compareTo(Result<T> tResult)
{
return timestamp.compareTo(tResult.timestamp);
}
代码示例来源:origin: apache/incubator-druid
public static DateTime min(DateTime dt1, DateTime dt2)
{
return dt1.compareTo(dt2) < 0 ? dt1 : dt2;
}
代码示例来源:origin: apache/incubator-druid
public static DateTime max(DateTime dt1, DateTime dt2)
{
return dt1.compareTo(dt2) >= 0 ? dt1 : dt2;
}
代码示例来源:origin: apache/incubator-druid
@Override
public int compareTo(Row o)
{
return timestamp.compareTo(o.getTimestamp());
}
代码示例来源:origin: apache/incubator-druid
@Override
public int compareTo(Row o)
{
return timestamp.compareTo(o.getTimestamp());
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public int compareTo(Row o)
{
return getTimestamp().compareTo(o.getTimestamp());
}
};
代码示例来源:origin: apache/incubator-druid
@Override
public int compare(TaskStuff a, TaskStuff b)
{
return a.getCreatedDate().compareTo(b.getCreatedDate());
}
}.reverse();
代码示例来源:origin: apache/incubator-druid
@Override
public int compare(ScalingEvent s1, ScalingEvent s2)
{
return s2.getTimestamp().compareTo(s1.getTimestamp());
}
}.nullsLast();
代码示例来源:origin: killbill/killbill
@Override
public int compare(final ExistingEvent arg0, final ExistingEvent arg1) {
return arg0.getEffectiveDate().compareTo(arg1.getEffectiveDate());
}
});
代码示例来源:origin: apache/incubator-druid
private static Iterable<Interval> splitInterval(Interval interval, Period period)
{
if (interval.getEndMillis() == interval.getStartMillis()) {
return Collections.singletonList(interval);
}
List<Interval> intervals = new ArrayList<>();
Iterator<Interval> timestamps = new PeriodGranularity(period, null, null).getIterable(interval).iterator();
DateTime start = DateTimes.max(timestamps.next().getStart(), interval.getStart());
while (timestamps.hasNext()) {
DateTime end = timestamps.next().getStart();
intervals.add(new Interval(start, end));
start = end;
}
if (start.compareTo(interval.getEnd()) < 0) {
intervals.add(new Interval(start, interval.getEnd()));
}
return intervals;
}
代码示例来源:origin: apache/incubator-druid
@Override
public int compare(Result<Object> r1, Result<Object> r2)
{
return r1.getTimestamp().compareTo(r2.getTimestamp());
}
},
代码示例来源:origin: killbill/killbill
@Override
public Void inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception {
final SubscriptionEventSqlDao transactional = entitySqlDaoWrapperFactory.become(SubscriptionEventSqlDao.class);
createAndRefresh(transactional, new SubscriptionEventModelDao(bcdEvent), context);
// Notify the Bus
notifyBusOfRequestedChange(entitySqlDaoWrapperFactory, subscription, bcdEvent, SubscriptionBaseTransitionType.BCD_CHANGE, context);
final boolean isBusEvent = bcdEvent.getEffectiveDate().compareTo(context.getCreatedDate()) <= 0;
recordBusOrFutureNotificationFromTransaction(subscription, bcdEvent, entitySqlDaoWrapperFactory, isBusEvent, 0, catalog, context);
return null;
}
});
代码示例来源:origin: killbill/killbill
@Override
public int compare(final SubscriptionBase o1, final SubscriptionBase o2) {
if (o1.getCategory() == ProductCategory.BASE) {
return -1;
} else if (o2.getCategory() == ProductCategory.BASE) {
return 1;
} else {
return ((DefaultSubscriptionBase) o1).getAlignStartDate().compareTo(((DefaultSubscriptionBase) o2).getAlignStartDate());
}
}
};
代码示例来源:origin: killbill/killbill
@Test(groups = "fast")
public void testComputeUTCDateTimeFromLocalDateC() {
final DateTime effectiveDateTime = DATE_TIME_FORMATTER.parseDateTime(effectiveDateTimeC);
final DateTimeZone timeZone = DateTimeZone.forOffsetHours(8);
refreshCallContext(effectiveDateTime, timeZone);
final LocalDate endDate = new LocalDate(2013, 01, 20);
final DateTime endDateTimeInUTC = internalCallContext.toUTCDateTime(endDate);
assertTrue(endDateTimeInUTC.compareTo(effectiveDateTime.plusYears(1)) == 0);
}
代码示例来源:origin: killbill/killbill
@Test(groups = "fast")
public void testComputeUTCDateTimeFromLocalDate3() {
final DateTime effectiveDateTime = DATE_TIME_FORMATTER.parseDateTime(effectiveDateTime3);
final DateTimeZone timeZone = DateTimeZone.forOffsetHours(-8);
refreshCallContext(effectiveDateTime, timeZone);
final LocalDate endDate = new LocalDate(2013, 01, 20);
final DateTime endDateTimeInUTC = internalCallContext.toUTCDateTime(endDate);
assertTrue(endDateTimeInUTC.compareTo(effectiveDateTime.plusYears(1)) == 0);
}
代码示例来源:origin: killbill/killbill
@Test(groups = "fast")
public void testComputeUTCDateTimeFromLocalDateB() {
final DateTime effectiveDateTime = DATE_TIME_FORMATTER.parseDateTime(effectiveDateTimeB);
final DateTimeZone timeZone = DateTimeZone.forOffsetHours(8);
refreshCallContext(effectiveDateTime, timeZone);
final LocalDate endDate = new LocalDate(2013, 01, 21);
final DateTime endDateTimeInUTC = internalCallContext.toUTCDateTime(endDate);
assertTrue(endDateTimeInUTC.compareTo(effectiveDateTime.plusYears(1)) == 0);
}
代码示例来源:origin: apache/incubator-druid
@Override
public int compare(DataSegment lhs, DataSegment rhs)
{
int retVal;
DateTime lhsMonth = Granularities.MONTH.bucketStart(lhs.getInterval().getStart());
DateTime rhsMonth = Granularities.MONTH.bucketStart(rhs.getInterval().getStart());
retVal = lhsMonth.compareTo(rhsMonth);
if (retVal != 0) {
return retVal;
}
return lhs.compareTo(rhs);
}
};
代码示例来源:origin: killbill/killbill
private void insertOverdueCheckAndVerifyQueueContent(final Account account, final int nbDaysInFuture, final int expectedNbDaysInFuture) throws IOException {
final DateTime futureNotificationTime = testReferenceTime.plusDays(nbDaysInFuture);
final OverdueCheckNotificationKey notificationKey = new OverdueCheckNotificationKey(account.getId());
checkPoster.insertOverdueNotification(account.getId(), futureNotificationTime, OverdueCheckNotifier.OVERDUE_CHECK_NOTIFIER_QUEUE, notificationKey, internalCallContext);
final List<NotificationEventWithMetadata<OverdueCheckNotificationKey>> notificationsForKey = getNotificationsForOverdueable(account);
Assert.assertEquals(notificationsForKey.size(), 1);
final NotificationEventWithMetadata nm = notificationsForKey.get(0);
Assert.assertEquals(nm.getEvent(), notificationKey);
Assert.assertEquals(nm.getEffectiveDate().compareTo(testReferenceTime.plusDays(expectedNbDaysInFuture)), 0);
}
代码示例来源:origin: killbill/killbill
@Test(groups = "slow", enabled = false)
public void testWithGMTPlus8() throws SQLException {
final LocalDate date1_1 = new LocalDate(2014, 10, 1, GregorianChronology.getInstance(DATE_TZ_PLUS_8_GMT));
// We chose a time such that it moves to next day
final DateTime date2_1 = new DateTime(2014, 10, 1, 22, 48, 56, DATE_TZ_PLUS_8_GMT);
insertData(date1_1, date2_1, date2_1);
final FullOfDates result = readData();
assertEquals(result.getDate1().compareTo(date1_1), 0);
assertEquals(result.getDate2().compareTo(date2_1), 0);
assertEquals(result.getDate2().getZone().toString(), "UTC");
}
代码示例来源:origin: killbill/killbill
@Test(groups = "slow", enabled = false)
public void testWithGMTMinus20() throws SQLException {
final LocalDate date1_1 = new LocalDate(2014, 10, 1, GregorianChronology.getInstance(DATE_TZ_MINUS_20_GMT));
// We chose a time such that it moves to next day
final DateTime date2_1 = new DateTime(2014, 10, 1, 16, 48, 56, DATE_TZ_MINUS_20_GMT);
insertData(date1_1, date2_1, date2_1);
final FullOfDates result = readData();
assertEquals(result.getDate1().compareTo(date1_1), 0);
assertEquals(result.getDate2().compareTo(date2_1), 0);
assertEquals(result.getDate2().getZone().toString(), "UTC");
}
内容来源于网络,如有侵权,请联系作者删除!