本文整理匯總了Java中org.joda.time.Instant.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Instant.equals方法的具體用法?Java Instant.equals怎麽用?Java Instant.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.Instant
的用法示例。
在下文中一共展示了Instant.equals方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prune
import org.joda.time.Instant; //導入方法依賴的package包/類
/**
* Calculate averages for any windows which can now be retired. Also prune entries
* which can no longer contribute to any future window.
*/
private void prune(Instant newWindowStart) {
while (!newWindowStart.equals(windowStart)) {
averages(windowStart.plus(Duration.standardSeconds(configuration.windowSizeSec)));
windowStart = windowStart.plus(Duration.standardSeconds(configuration.windowPeriodSec));
Iterator<TimestampedValue<CategoryPrice>> itr = winningPricesByCategory.iterator();
while (itr.hasNext()) {
if (itr.next().getTimestamp().isBefore(windowStart)) {
itr.remove();
}
}
if (winningPricesByCategory.isEmpty()) {
windowStart = newWindowStart;
}
}
}
示例2: run
import org.joda.time.Instant; //導入方法依賴的package包/類
@Override
protected void run() {
TimestampedValue<Event> timestampedEvent = nextInput();
if (timestampedEvent == null) {
// Capture all remaining bids in results.
retireWindow(lastTimestamp);
allDone();
return;
}
Event event = timestampedEvent.getValue();
if (event.bid == null) {
// Ignore non-bid events.
return;
}
lastTimestamp = timestampedEvent.getTimestamp();
Instant newWindowStart = windowStart(Duration.standardSeconds(configuration.windowSizeSec),
Duration.standardSeconds(configuration.windowSizeSec), lastTimestamp);
if (!newWindowStart.equals(windowStart)) {
// Capture highest priced bids in current window and retire it.
retireWindow(lastTimestamp);
windowStart = newWindowStart;
}
// Keep only the highest bids.
captureBid(event.bid);
}
示例3: retireWindows
import org.joda.time.Instant; //導入方法依賴的package包/類
/**
* Retire active windows until we've reached {@code newWindowStart}.
*/
private void retireWindows(Instant newWindowStart) {
while (!newWindowStart.equals(windowStart)) {
NexmarkUtils.info("retiring window %s, aiming for %s", windowStart, newWindowStart);
// Count bids in the window (windowStart, windowStart + size].
countBids(windowStart.plus(Duration.standardSeconds(configuration.windowSizeSec)));
// Advance the window.
windowStart = windowStart.plus(Duration.standardSeconds(configuration.windowPeriodSec));
// Retire bids which will never contribute to a future window.
if (!retireBids(windowStart)) {
// Can fast forward to latest window since no more outstanding bids.
windowStart = newWindowStart;
}
}
}
示例4: formatTimestamp
import org.joda.time.Instant; //導入方法依賴的package包/類
/**
* Formats a {@link Instant} timestamp with additional Beam-specific metadata, such as indicating
* whether the timestamp is the end of the global window or one of the distinguished values {@link
* #TIMESTAMP_MIN_VALUE} or {@link #TIMESTAMP_MIN_VALUE}.
*/
public static String formatTimestamp(Instant timestamp) {
if (timestamp.equals(TIMESTAMP_MIN_VALUE)) {
return timestamp.toString() + " (TIMESTAMP_MIN_VALUE)";
} else if (timestamp.equals(TIMESTAMP_MAX_VALUE)) {
return timestamp.toString() + " (TIMESTAMP_MAX_VALUE)";
} else if (timestamp.equals(GlobalWindow.INSTANCE.maxTimestamp())) {
return timestamp.toString() + " (end of global window)";
} else {
return timestamp.toString();
}
}
示例5: isForWindow
import org.joda.time.Instant; //導入方法依賴的package包/類
@Override
public boolean isForWindow(
String timerId,
BoundedWindow window,
Instant timestamp,
TimeDomain timeDomain) {
boolean isEventTimer = timeDomain.equals(TimeDomain.EVENT_TIME);
Instant gcTime = LateDataUtils.garbageCollectionTime(window, windowingStrategy);
gcTime = gcTime.plus(GC_DELAY_MS);
return isEventTimer && GC_TIMER_ID.equals(timerId) && gcTime.equals(timestamp);
}
示例6: deleteTimer
import org.joda.time.Instant; //導入方法依賴的package包/類
@Override
public void deleteTimer(Instant timestamp, TimeDomain timeDomain) {
if (timeDomain == TimeDomain.EVENT_TIME
&& timestamp.equals(window.maxTimestamp())) {
// Don't allow triggers to unset the at-max-timestamp timer. This is necessary for on-time
// state transitions.
return;
}
timers.deleteTimer(timestamp, timeDomain);
}
示例7: run
import org.joda.time.Instant; //導入方法依賴的package包/類
@Override
public void run() {
TimestampedValue<Event> timestampedEvent = nextInput();
if (timestampedEvent == null) {
allDone();
return;
}
Event event = timestampedEvent.getValue();
if (event.bid != null) {
// Ignore bid events.
// Keep looking for next events.
return;
}
Instant timestamp = timestampedEvent.getTimestamp();
Instant newWindowStart = windowStart(Duration.standardSeconds(configuration.windowSizeSec),
Duration.standardSeconds(configuration.windowSizeSec), timestamp);
if (!newWindowStart.equals(windowStart)) {
// Retire this window.
retirePersons();
retireAuctions();
windowStart = newWindowStart;
}
if (event.newAuction != null) {
// Join new auction with existing person, if any.
Person person = newPersons.get(event.newAuction.seller);
if (person != null) {
addResult(event.newAuction, person, timestamp);
} else {
// Remember auction for future new people.
newAuctions.put(event.newAuction.seller, event.newAuction);
}
} else { // event is not an auction, nor a bid, so it is a person
// Join new person with existing auctions.
for (Auction auction : newAuctions.get(event.newPerson.id)) {
addResult(auction, event.newPerson, timestamp);
}
// We'll never need these auctions again.
newAuctions.removeAll(event.newPerson.id);
// Remember person for future auctions.
newPersons.put(event.newPerson.id, event.newPerson);
}
}
示例8: shouldFire
import org.joda.time.Instant; //導入方法依賴的package包/類
public boolean shouldFire(Instant currentWatermark) {
return currentWatermark.isAfter(fireAfter)
|| currentWatermark.equals(BoundedWindow.TIMESTAMP_MAX_VALUE);
}