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

x33g5p2x  于2022-01-20 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(137)

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

Instant.isAfter介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

/**
 * Checks if the provided range r is within the current range.
 * Note that equal ranges also returns true.
 *
 * @param r range
 * @return true if range r is contained in r
 */
public boolean contains(Range r) {
 if ((this.beginTime().getJodaTimeInstant().isBefore(r.beginTime().getJodaTimeInstant())
         || this.beginTime().getJodaTimeInstant().isEqual(r.beginTime().getJodaTimeInstant()))
     && (this.endTime().getJodaTimeInstant().isAfter(r.endTime().getJodaTimeInstant())
         || this.endTime().getJodaTimeInstant().isEqual(r.endTime().getJodaTimeInstant()))) {
  return true;
 }
 return false;
}

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

private void updateLastWatermark(Instant newWatermark, Instant now) {
  if (newWatermark.isAfter(lastWatermark)) {
   lastWatermark = newWatermark;
   lastUpdate = now;
  }
 }
}

代码示例来源:origin: org.apache.beam/beam-runners-direct-java

/**
  * Returns the {@link WatermarkUpdate} based on the former and current {@link Instant
  * timestamps}.
  */
 public static WatermarkUpdate fromTimestamps(Instant oldTime, Instant currentTime) {
  if (currentTime.isAfter(oldTime)) {
   return ADVANCED;
  }
  return NO_CHANGE;
 }
}

代码示例来源:origin: GoogleCloudPlatform/DataflowTemplates

@Override
public Instant getTimestampForRecord(PartitionContext ctx, KafkaRecord<K, V> record) {
 Instant ts = timestampFunction.apply(record);
 if (ts.isAfter(maxEventTimestamp)) {
  maxEventTimestamp = ts;
 }
 return ts;
}

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

@Override
public Instant getWatermarkThatGuaranteesFiring(BoundedWindow window) {
 // This trigger will fire after the earliest of its sub-triggers.
 Instant deadline = BoundedWindow.TIMESTAMP_MAX_VALUE;
 for (Trigger subTrigger : subTriggers) {
  Instant subDeadline = subTrigger.getWatermarkThatGuaranteesFiring(window);
  if (deadline.isAfter(subDeadline)) {
   deadline = subDeadline;
  }
 }
 return deadline;
}

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

@Override
public Instant getTimestampForRecord(PartitionContext ctx, KafkaRecord<K, V> record) {
 Instant ts = timestampFunction.apply(record);
 if (ts.isAfter(maxEventTimestamp)) {
  maxEventTimestamp = ts;
 }
 return ts;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private int year(int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private int year(DateTime dt, int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

代码示例来源:origin: org.jruby/jruby-complete

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private static int year(DateTime dt, int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

代码示例来源:origin: org.jruby/jruby-complete

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private int year(int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

代码示例来源:origin: org.jruby/jruby-core

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private int year(int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

代码示例来源:origin: org.jruby/jruby-core

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private static int year(DateTime dt, int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private int year(DateTime dt, int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

代码示例来源:origin: org.apache.beam/beam-runners-core-java

public GaugeData combine(GaugeData other) {
 if (this.timestamp().isAfter(other.timestamp())) {
  return this;
 } else {
  return other;
 }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Ruby always follows Astronomical year numbering,
 * that is BC x is -x+1 and there is a year 0 (BC 1)
 * but Joda-time returns -x for year x BC in Julian chronology (no year 0) */
private int year(int year) {
  Chronology c;
  if (year < 0 && (
      (c = dt.getChronology()) instanceof JulianChronology ||
      (c instanceof GJChronology && ((GJChronology) c).getGregorianCutover().isAfter(dt))))
    return year + 1;
  return year;
}

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

@Override
 public Instant getWatermark(PartitionContext context) {
  if (context.getMessageBacklog() == 0) {
   // The reader is caught up. May need to advance the watermark.
   Instant idleWatermark = context.getBacklogCheckTime().minus(IDLE_WATERMARK_DELTA);
   if (idleWatermark.isAfter(currentWatermark)) {
    currentWatermark = idleWatermark;
   }
  } // else, there is backlog (or is unknown). Do not advance the watermark.
  return currentWatermark;
 }
}

代码示例来源:origin: org.apache.beam/beam-runners-core-java

private boolean windowIsExpired(BoundedWindow w) {
  return timerInternals
    .currentInputWatermarkTime()
    .isAfter(w.maxTimestamp().plus(windowingStrategy.getAllowedLateness()));
 }
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-amazon-web-services

void delete(final Collection<Message> messages) {
 for (Message message : messages) {
  if (messagesToDelete.contains(message)) {
   source.getSqs().deleteMessage(source.getRead().queueUrl(), message.getReceiptHandle());
   Instant currentMessageTimestamp = getTimestamp(message);
   if (currentMessageTimestamp.isAfter(oldestPendingTimestamp)) {
    oldestPendingTimestamp = currentMessageTimestamp;
   }
  }
 }
}

代码示例来源:origin: org.apache.beam/beam-runners-core-java

@Override
public boolean shouldFire(TriggerStateMachine.TriggerContext context) throws Exception {
 Instant delayedUntil = context.state().access(DELAYED_UNTIL_TAG).read();
 return delayedUntil != null
   && getCurrentTime(context) != null
   && getCurrentTime(context).isAfter(delayedUntil);
}

代码示例来源:origin: org.apache.beam/beam-runners-core-java

@Nullable
 private TimerData removeNextTimer(Instant currentTime, TimeDomain domain) {
  NavigableSet<TimerData> timers = timersForDomain(domain);

  if (!timers.isEmpty() && currentTime.isAfter(timers.first().getTimestamp())) {
   TimerData timer = timers.pollFirst();
   existingTimers.remove(timer.getNamespace(), timer.getTimerId());
   return timer;
  } else {
   return null;
  }
 }
}

相关文章