Class VetoableEventStream<I>

  • All Implemented Interfaces:
    org.reactfx.AwaitingEventStream<I>, org.reactfx.EventStream<I>, org.reactfx.Observable<Consumer<? super I>>, org.reactfx.ProperEventStream<I>, org.reactfx.ProperObservable<Consumer<? super I>,​I>

    public final class VetoableEventStream<I>
    extends org.reactfx.EventStreamBase<I>
    implements org.reactfx.AwaitingEventStream<I>
    An event stream whose events can be vetoed during a certain period, after which they are emitted.
    Author:
    Clément Fournier
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isPending()  
      protected org.reactfx.Subscription observeInputs()  
      javafx.beans.value.ObservableBooleanValue pendingProperty()  
      static <I> org.reactfx.AwaitingEventStream<I> vetoableFrom​(org.reactfx.EventStream<I> input, Predicate<I> isVetoable, BiPredicate<I,​I> isVeto, BiFunction<I,​I,​I> vetoableReduction, Duration vetoPeriod)  
      static <I> org.reactfx.AwaitingEventStream<I> vetoableFrom​(org.reactfx.EventStream<I> input, Predicate<I> isVetoable, BiPredicate<I,​I> isVeto, BiFunction<I,​I,​I> vetoableReduction, Function<Runnable,​org.reactfx.util.Timer> timerFactory)
      Low-level method to create a vetoable event stream.
      static <T> org.reactfx.AwaitingEventStream<T> vetoableNull​(org.reactfx.EventStream<T> input, Duration vetoPeriod)  
      static org.reactfx.AwaitingEventStream<Boolean> vetoableYes​(org.reactfx.EventStream<Boolean> input, Duration vetoPeriod)  
      • Methods inherited from class org.reactfx.ObservableBase

        addObserver, enqueueNotifications, equals, forEachObserver, getObserverCount, hashCode, isObservingInputs, newObserver, notifyObservers, notifyObservers, observe, removeObserver, toString
      • Methods inherited from interface org.reactfx.EventStream

        accumulate, accumulate, accumulate, accumulateBetween, accumulateBetween, accumulateUntilLater, accumulateUntilLater, accumulateUntilLater, accumulateUntilLater, accumulateWhen, accumulateWhen, accumulative, accumulative, cast, conditionOn, conditionOnShowing, distinct, emitBothOnEach, emitOn, emitOnEach, feedTo, feedTo, filter, filter, filterMap, filterMap, flatMap, forgetful, fork, guardedBy, hook, latestN, map, mapToCompletionStage, mapToTask, onRecurseAccumulate, onRecurseAccumulate, onRecurseQueue, onRecurseReduce, onRecurseRetainLatest, or, pausable, pauseWhen, pin, queueBetween, queueUntilLater, queueUntilLater, reduceBetween, reduceSuccessions, reduceSuccessions, reduceSuccessions, reduceSuccessions, reduceSuccessions, reduceSuccessions, reduceUntilLater, reduceUntilLater, reduceWhen, reducible, repeatOn, retainLatestBetween, retainLatestUntilLater, retainLatestUntilLater, retainLatestWhen, splitBy, subscribe, subscribeFor, subscribeForOne, successionEnds, successionEnds, supply, supply, supplyCompletionStage, supplyTask, suppressible, suppressWhen, suspenderOf, thenAccumulateFor, thenAccumulateFor, thenAccumulateFor, thenAccumulateFor, thenIgnoreFor, thenIgnoreFor, thenReduceFor, thenReduceFor, thenRetainLatestFor, thenRetainLatestFor, threadBridge, threadBridgeFromFx, threadBridgeToFx, toBinding, withDefaultEvent
      • Methods inherited from interface org.reactfx.Observable

        addObserver, observe, removeObserver
      • Methods inherited from interface org.reactfx.ProperEventStream

        defaultNotificationAccumulator, emit
      • Methods inherited from interface org.reactfx.ProperObservable

        defaultEquals, defaultHashCode, defaultToString, notifyObservers
    • Method Detail

      • pendingProperty

        public javafx.beans.value.ObservableBooleanValue pendingProperty()
        Specified by:
        pendingProperty in interface org.reactfx.AwaitingEventStream<I>
      • isPending

        public boolean isPending()
        Specified by:
        isPending in interface org.reactfx.AwaitingEventStream<I>
      • observeInputs

        protected org.reactfx.Subscription observeInputs()
        Specified by:
        observeInputs in class org.reactfx.ObservableBase<Consumer<? super I>,​I>
      • vetoableFrom

        public static <I> org.reactfx.AwaitingEventStream<I> vetoableFrom​(org.reactfx.EventStream<I> input,
                                                                          Predicate<I> isVetoable,
                                                                          BiPredicate<I,​I> isVeto,
                                                                          BiFunction<I,​I,​I> vetoableReduction,
                                                                          Function<Runnable,​org.reactfx.util.Timer> timerFactory)
        Low-level method to create a vetoable event stream.
        Parameters:
        input - Input event stream
        isVetoable - Predicate that accepts events that should wait for the veto period before it's emitted.
        isVeto - Predicate that accepts events that cancel a pending vetoable event. The pending vetoable is passed as first param, the event that may be a veto is the second param.
        vetoableReduction - Reduces two vetoable events, if a new vetoable event is recorded while another one was already pending. The pending event is passed as the first parameter. If the result of the reduction is vetoable, then it's enqueued and treated as pending. Otherwise it's emitted as a normal event.
        timerFactory - Factory that produces a timer for the veto period of a vetoable
      • vetoableFrom

        public static <I> org.reactfx.AwaitingEventStream<I> vetoableFrom​(org.reactfx.EventStream<I> input,
                                                                          Predicate<I> isVetoable,
                                                                          BiPredicate<I,​I> isVeto,
                                                                          BiFunction<I,​I,​I> vetoableReduction,
                                                                          Duration vetoPeriod)
      • vetoableNull

        public static <T> org.reactfx.AwaitingEventStream<T> vetoableNull​(org.reactfx.EventStream<T> input,
                                                                          Duration vetoPeriod)