本文整理了Java中org.joda.time.Instant.isBefore()
方法的一些代码示例,展示了Instant.isBefore()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.isBefore()
方法的具体详情如下:
包路径:org.joda.time.Instant
类名称:Instant
方法名:isBefore
暂无
代码示例来源: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: com.dispalt.vitess/client
public Context withDeadline(Instant deadline) {
if (this.deadline != null && this.deadline.isBefore(deadline)) {
// You can't make a derived context with a later deadline than the parent.
return this;
}
return new Context(deadline, callerId);
}
代码示例来源:origin: io.vitess/vitess-client
public Context withDeadline(Instant deadline) {
if (this.deadline != null && this.deadline.isBefore(deadline)) {
// You can't make a derived context with a later deadline than the parent.
return this;
}
return new Context(deadline, callerId);
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-sql
@Override
public Instant addInput(Instant accumulator, Instant input) {
return accumulator.isBefore(input) ? input : accumulator;
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
@Override
public Instant getWatermarkThatGuaranteesFiring(BoundedWindow window) {
// This trigger fires once either the trigger or the until trigger fires.
Instant actualDeadline = subTriggers.get(ACTUAL).getWatermarkThatGuaranteesFiring(window);
Instant untilDeadline = subTriggers.get(UNTIL).getWatermarkThatGuaranteesFiring(window);
return actualDeadline.isBefore(untilDeadline) ? actualDeadline : untilDeadline;
}
代码示例来源:origin: org.apache.beam/beam-runners-spark
/** Advances the watermark in the next batch. */
public CreateStream<T> advanceWatermarkForNextBatch(Instant newWatermark) {
checkArgument(
!newWatermark.isBefore(lowWatermark), "The watermark is not allowed to decrease!");
checkArgument(
newWatermark.isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE),
"The Watermark cannot progress beyond the maximum. Got: %s. Maximum: %s",
newWatermark,
BoundedWindow.TIMESTAMP_MAX_VALUE);
return advance(newWatermark);
}
代码示例来源:origin: org.apache.beam/beam-runners-core-java
/** Is {@code window} expired w.r.t. the garbage collection watermark? */
private boolean canDropDueToExpiredWindow(BoundedWindow window) {
Instant inputWM = timerInternals.currentInputWatermarkTime();
return LateDataUtils.garbageCollectionTime(window, windowingStrategy).isBefore(inputWM);
}
}
代码示例来源:origin: takidau/streamingbook
private Instant minTimestamp(Iterable<Visit> goals, Visit goalToSkip) {
Instant min = null;
for (Visit goal : goals) {
if (goal != goalToSkip && (min == null || goal.timestamp().isBefore(min))) {
min = goal.timestamp();
}
}
return min;
}
代码示例来源:origin: org.apache.beam/beam-runners-direct-java
private static Instant minTimestamp(Iterable<? extends WindowedValue<?>> elements) {
Instant minTs = BoundedWindow.TIMESTAMP_MAX_VALUE;
for (WindowedValue<?> element : elements) {
if (element.getTimestamp().isBefore(minTs)) {
minTs = element.getTimestamp();
}
}
return minTs;
}
}
代码示例来源:origin: org.apache.beam/beam-runners-direct-java
private static Instant minTimestamp(Iterable<? extends WindowedValue<?>> elements) {
Instant minTs = BoundedWindow.TIMESTAMP_MAX_VALUE;
for (WindowedValue<?> element : elements) {
if (element.getTimestamp().isBefore(minTs)) {
minTs = element.getTimestamp();
}
}
return minTs;
}
}
代码示例来源:origin: org.apache.beam/beam-runners-direct-java
/** Returns true if the step will not produce additional output. */
public boolean isDone(PTransformNode transform) {
// the PTransform is done only if watermark is at the max value
Instant stepWatermark = watermarkManager.getWatermarks(transform).getOutputWatermark();
return !stepWatermark.isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE);
}
代码示例来源:origin: org.apache.beam/beam-runners-direct-java
/** Returns true if the step will not produce additional output. */
public boolean isDone(AppliedPTransform<?, ?, ?> transform) {
// the PTransform is done only if watermark is at the max value
Instant stepWatermark = watermarkManager.getWatermarks(transform).getOutputWatermark();
return !stepWatermark.isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE);
}
代码示例来源:origin: org.apache.beam/beam-runners-core-java
private boolean isLate(BoundedWindow window) {
Instant gcTime = LateDataUtils.garbageCollectionTime(window, windowingStrategy);
Instant inputWM = cleanupTimer.currentInputWatermarkTime();
return gcTime.isBefore(inputWM);
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
@Internal
@Override
public Instant getWatermarkThatGuaranteesFiring(BoundedWindow window) {
// This trigger will fire after the latest of its sub-triggers.
Instant deadline = BoundedWindow.TIMESTAMP_MIN_VALUE;
for (Trigger subTrigger : subTriggers) {
Instant subDeadline = subTrigger.getWatermarkThatGuaranteesFiring(window);
if (deadline.isBefore(subDeadline)) {
deadline = subDeadline;
}
}
return deadline;
}
代码示例来源:origin: timolson/cointrader
private static Instant getEventsStart(boolean orderByRemoteTime) {
String timeField = timeFieldForOrdering(orderByRemoteTime);
Instant bookStart = EM.queryOne(Instant.class, "select min(" + timeField + ") from Book");
Instant tradeStart = EM.queryOne(Instant.class, "select min(" + timeField + ") from Trade");
if (bookStart == null && tradeStart == null)
return null;
if (bookStart == null)
return tradeStart;
if (tradeStart == null)
return bookStart;
return tradeStart.isBefore(bookStart) ? tradeStart : bookStart;
}
代码示例来源:origin: org.apache.beam/beam-runners-direct-java
public void set(Instant newNow) {
checkArgument(
!newNow.isBefore(now),
"Cannot move MockClock backwards in time from %s to %s",
now,
newNow);
this.now = newNow;
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-sql
@Override
public Instant mergeAccumulators(Iterable<Instant> accumulators) {
Instant v = new Instant(0L);
for (Instant accumulator : accumulators) {
v = accumulator.isBefore(v) ? v : accumulator;
}
return v;
}
代码示例来源:origin: org.apache.beam/beam-runners-direct-java
public void set(Instant newNow) {
checkArgument(
!newNow.isBefore(now),
"Cannot move MockClock backwards in time from %s to %s",
now,
newNow);
this.now = newNow;
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
@Override
public TimestampedValue<T> addInput(
TimestampedValue<T> accumulator, TimestampedValue<T> input) {
checkNotNull(accumulator, "accumulator must be non-null");
checkNotNull(input, "input must be non-null");
if (input.getTimestamp().isBefore(accumulator.getTimestamp())) {
return accumulator;
} else {
return input;
}
}
代码示例来源:origin: dataArtisans/flink-dataflow
protected void checkTimestamp(WindowedValue<IN> ref, Instant timestamp) {
if (timestamp.isBefore(ref.getTimestamp().minus(doFn.getAllowedTimestampSkew()))) {
throw new IllegalArgumentException(String.format(
"Cannot output with timestamp %s. Output timestamps must be no earlier than the "
+ "timestamp of the current input (%s) minus the allowed skew (%s). See the "
+ "DoFn#getAllowedTimestmapSkew() Javadoc for details on changing the allowed skew.",
timestamp, ref.getTimestamp(),
PeriodFormat.getDefault().print(doFn.getAllowedTimestampSkew().toPeriod())));
}
}
内容来源于网络,如有侵权,请联系作者删除!