org.joda.time.DateTime.isEqual()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.joda.time.DateTime.isEqual()方法的一些代码示例,展示了DateTime.isEqual()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.isEqual()方法的具体详情如下:
包路径:org.joda.time.DateTime
类名称:DateTime
方法名:isEqual

DateTime.isEqual介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-druid

@Override
public boolean equals(Object o)
{
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 Result result = (Result) o;
 if (timestamp != null ? !(timestamp.isEqual(result.timestamp) && timestamp.getZone().getOffset(timestamp) == result.timestamp.getZone().getOffset(result.timestamp)) : result.timestamp != null) {
  return false;
 }
 if (value != null ? !value.equals(result.value) : result.value != null) {
  return false;
 }
 return true;
}

代码示例来源:origin: killbill/killbill

public void assertDateWithin(final DateTime in, final DateTime lower, final DateTime upper) {
  assertTrue(in.isEqual(lower) || in.isAfter(lower), "in=" + in + ", lower=" + lower);
  assertTrue(in.isEqual(upper) || in.isBefore(upper), "in=" + in + ", upper=" + upper);
}

代码示例来源:origin: Graylog2/graylog2-server

@Override
public boolean evaluateBool(EvaluationContext context) {
  final Object left = this.left.evaluateUnsafe(context);
  final Object right = this.right.evaluateUnsafe(context);
  if (left == null) {
    log.warn("left expression evaluated to null, returning false: {}", this.left);
    return false;
  }
  final boolean equals;
  // sigh: DateTime::equals takes the chronology into account, so identical instants expressed in different timezones are not equal
  if (left instanceof DateTime && right instanceof DateTime) {
    equals = ((DateTime) left).isEqual((DateTime) right);
  } else {
    equals = left.equals(right);
  }
  if (log.isTraceEnabled()) {
    traceEquality(left, right, equals, checkEquality);
  }
  if (checkEquality) {
    return equals;
  }
  return !equals;
}

代码示例来源:origin: linkedin/camus

protected boolean shouldProcessHour(DateTime folderHour, String topic) {
  DateTime currentHour = dUtils.getCurrentHour();
  DateTime maxHoursAgo =
    currentHour.minusHours(Integer.parseInt(props.getProperty(CAMUS_SINGLE_FOLDER_SWEEPER_MAX_HOURS_AGO,
      DEFAULT_CAMUS_SINGLE_FOLDER_SWEEPER_MAX_HOURS_AGO)));
  DateTime minHoursAgo =
    currentHour.minusHours(Integer.parseInt(props.getProperty(CAMUS_SINGLE_FOLDER_SWEEPER_MIN_HOURS_AGO,
      DEFAULT_CAMUS_SINGLE_FOLDER_SWEEPER_MIN_HOURS_AGO)));
  return (folderHour.isAfter(maxHoursAgo) || folderHour.isEqual(maxHoursAgo))
    && (folderHour.isBefore(minHoursAgo) || folderHour.isEqual(minHoursAgo));
 }
}

代码示例来源:origin: klout/brickhouse

DateTime endDt = dateFormatter.parseDateTime(end);
int i = 0;
for (DateTime dt = startDt; dt.isBefore(endDt) || dt.isEqual(endDt); dt = dt.withFieldAdded(
    durationType, incr), i++) {
  this.forwardListObj[0] = dateFormatter.print(dt);

代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-sql

@Override
 public Boolean compare(DateTime leftValue, DateTime rightValue) {
  return !leftValue.isEqual(rightValue);
 }
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-sql

@Override
 public Boolean compare(DateTime leftValue, DateTime rightValue) {
  return leftValue.isEqual(rightValue);
 }
}

代码示例来源:origin: org.smartdeveloperhub.curator/sdh-curator-connector

@Override
protected boolean compare(DateTime d1, DateTime d2) {
  return d1.isEqual(d2);
}

代码示例来源:origin: com.qmetric/hal-feed-consumer

@Override
  public int compare(Item a, Item b) {
    return a.updated.isAfter(b.updated) ? 1 : a.updated.isEqual(b.updated) ? 0 : -1;
  }
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-sql

@Override
 public Boolean compare(DateTime leftValue, DateTime rightValue) {
  return leftValue.isBefore(rightValue) || leftValue.isEqual(rightValue);
 }
}

代码示例来源:origin: net.serenity-bdd/serenity-model

public boolean matchesSafely(DateTime provided) {
  return (provided.isEqual(startDate) || provided.isAfter(startDate))
      && (provided.isEqual(endDate) || provided.isBefore(endDate));
}

代码示例来源:origin: net.serenity-bdd/serenity-model

public boolean matchesSafely(Date date) {
  DateTime provided = new DateTime(date);
  return (provided.isEqual(startDate) || provided.isAfter(startDate))
      && (provided.isEqual(endDate) || provided.isBefore(endDate));
}

代码示例来源:origin: net.thucydides/thucydides-core

public boolean matchesSafely(Date date) {
  DateTime provided = new DateTime(date);
  return (provided.isEqual(startDate) || provided.isAfter(startDate))
      && (provided.isEqual(endDate) || provided.isBefore(endDate));
}

代码示例来源:origin: metatron-app/metatron-discovery

private List<DateTime> getYearLabels(DateTime min, DateTime max, int unitSize) {
 List<DateTime> labels = new ArrayList<>();
 DateTime dt = new DateTime(min.getYear(), 1, 1, 0, 0);
 while (dt.isBefore(max) || dt.isEqual(max)) {
  labels.add(dt);
  dt = dt.plusYears(unitSize);
 }
 labels.add(dt);
 return labels;
}

代码示例来源:origin: stackoverflow.com

import org.joda.time.DateTime;

public static boolean dayIsYesterday(DateTime day) {
  DateTime yesterday = new DateTime().withTimeAtStartOfDay().minusDays(1);
  DateTime inputDay = day.withTimeAtStartOfDay();

  return inputDay.isEqual(yesterday);
}

代码示例来源:origin: metatron-app/metatron-discovery

private List<DateTime> getHourLabels(DateTime min, DateTime max, int unitSize) {
 List<DateTime> labels = new ArrayList<>();
 DateTime dt = new DateTime(min.getYear(), min.getMonthOfYear(), min.getDayOfMonth(),
               min.getHourOfDay() / unitSize * unitSize, 0);
 while (dt.isBefore(max) || dt.isEqual(max)) {
  labels.add(dt);
  dt = dt.plusHours(unitSize);
 }
 labels.add(dt);
 return labels;
}

代码示例来源:origin: metatron-app/metatron-discovery

private List<DateTime> getMinuteLabels(DateTime min, DateTime max, int unitSize) {
 List<DateTime> labels = new ArrayList<>();
 DateTime dt = new DateTime(min.getYear(), min.getMonthOfYear(), min.getDayOfMonth(),
               min.getHourOfDay(), min.getMinuteOfHour() / unitSize * unitSize);
 while (dt.isBefore(max) || dt.isEqual(max)) {
  labels.add(dt);
  dt = dt.plusMinutes(unitSize);
 }
 labels.add(dt);
 return labels;
}

代码示例来源:origin: metatron-app/metatron-discovery

private List<DateTime> getSecondLabels(DateTime min, DateTime max, int unitSize) {
 List<DateTime> labels = new ArrayList<>();
 DateTime dt = new DateTime(min.getYear(), min.getMonthOfYear(), min.getDayOfMonth(),
     min.getHourOfDay(), min.getMinuteOfHour(), min.getSecondOfMinute() / unitSize * unitSize);
 while (dt.isBefore(max) || dt.isEqual(max)) {
  labels.add(dt);
  dt = dt.plusSeconds(unitSize);
 }
 labels.add(dt);
 return labels;
}

代码示例来源:origin: metatron-app/metatron-discovery

private List<DateTime> getMillisLabels(DateTime min, DateTime max, int unitSize) {
 List<DateTime> labels = new ArrayList<>();
 DateTime dt = new DateTime(min.getYear(), min.getMonthOfYear(), min.getDayOfMonth(),
     min.getHourOfDay(), min.getMinuteOfHour(), min.getSecondOfMinute(), min.getMillisOfSecond() / unitSize * unitSize);
 while (dt.isBefore(max) || dt.isEqual(max)) {
  labels.add(dt);
  dt = dt.plusMillis(unitSize);
 }
 labels.add(dt);
 return labels;
}

代码示例来源:origin: FenixEdu/fenixedu-academic

public boolean getCanValidateContacts() {
  final DateTime now = new DateTime();
  final DateTime requestDate = getLastValidationRequestDate();
  if (requestDate == null || getNumberOfValidationRequests() == null) {
    return true;
  }
  final DateTime plus30 = requestDate.plusDays(30);
  if (now.isAfter(plus30) || now.isEqual(plus30)) {
    setNumberOfValidationRequests(0);
  }
  return getNumberOfValidationRequests() <= MAX_VALIDATION_REQUESTS;
}

相关文章

DateTime类方法