当前位置: 首页>>代码示例>>Java>>正文


Java FxTimer.create方法代码示例

本文整理汇总了Java中org.reactfx.util.FxTimer.create方法的典型用法代码示例。如果您正苦于以下问题:Java FxTimer.create方法的具体用法?Java FxTimer.create怎么用?Java FxTimer.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.reactfx.util.FxTimer的用法示例。


在下文中一共展示了FxTimer.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runLater

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
@Override
public Timer runLater(Duration delay, Runnable runnable) {
    if (timer == null) {
        timer = FxTimer.create(delay, runnable);
        timer.restart();
    } else {
        log.warn("runLater called on an already running timer.");
    }
    return this;
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:11,代码来源:UITimer.java

示例2: thenAccumulateFor

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
/**
 * Returns an event stream that emits the first event emitted from this
 * stream and then, if the next event arrives within the given duration
 * since the last emitted event, it is converted to an accumulator value
 * using {@code initialTransformation}. Any further events that still
 * arrive within {@code duration} are accumulated to the accumulator value
 * using the given reduction function. After {@code duration} has passed
 * since the last emitted event, the accumulator value is deconstructed
 * into a series of events using the given {@code deconstruction} function
 * and these events are emitted, the accumulator value is cleared and any
 * events that arrive within {@code duration} are accumulated, and so on.
 */
default <A> AwaitingEventStream<T> thenAccumulateFor(
        Duration duration,
        Function<? super T, ? extends A> initialTransformation,
        BiFunction<? super A, ? super T, ? extends A> reduction,
        Function<? super A, List<T>> deconstruction) {
    return new ThenAccumulateForStream<>(
            this,
            initialTransformation,
            reduction,
            deconstruction,
            action -> FxTimer.create(duration, action));
}
 
开发者ID:TomasMikula,项目名称:ReactFX,代码行数:25,代码来源:EventStream.java

示例3: reduceSuccessions

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
/**
 * A more general version of
 * {@link #reduceSuccessions(BinaryOperator, Duration)}
 * that allows the accumulated event to be of different type.
 *
 * <p><b>Note:</b> This function can be used only when this stream and
 * the returned stream are used from the JavaFX application thread. If
 * you are using the event streams on a different thread, use
 * {@link #reduceSuccessions(Function, BiFunction, Duration, ScheduledExecutorService, Executor)}
 * instead.</p>
 *
 * @param initialTransformation function to transform a single event
 * from this stream to an event that can be emitted from the returned
 * stream.
 * @param reduction function to add an event to the accumulated value.
 * @param timeout the maximum time difference between two subsequent
 * events that can still be accumulated.
 * @param <U> type of events emitted from the returned stream.
 */
default <U> AwaitingEventStream<U> reduceSuccessions(
        Function<? super T, ? extends U> initialTransformation,
        BiFunction<? super U, ? super T, ? extends U> reduction,
        Duration timeout) {

    Function<Runnable, Timer> timerFactory =
            action -> FxTimer.create(timeout, action);
    return new SuccessionReducingStream<T, U>(
            this, initialTransformation, reduction, timerFactory);
}
 
开发者ID:TomasMikula,项目名称:ReactFX,代码行数:30,代码来源:EventStream.java


注:本文中的org.reactfx.util.FxTimer.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。