Class PausableSuccessionStream<O>

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

    class PausableSuccessionStream<O>
    extends org.reactfx.EventStreamBase<O>
    implements org.reactfx.AwaitingEventStream<O>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private O event  
      private boolean hasEvent  
      private java.util.function.Function<? super O,​? extends O> initial  
      private org.reactfx.EventStream<O> input  
      private javafx.beans.binding.BooleanBinding pending  
      private java.util.function.BiFunction<? super O,​? super O,​? extends O> reduction  
      private javafx.beans.property.BooleanProperty successionOff  
      private java.util.function.Predicate<O> successionOffCond  
      private org.reactfx.util.Timer timer  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        PausableSuccessionStream​(org.reactfx.EventStream<O> input, java.time.Duration timeout, java.util.function.Predicate<O> condition)  
        PausableSuccessionStream​(org.reactfx.EventStream<O> input, java.time.Duration timeout, javafx.beans.property.BooleanProperty realTime)
      Returns an event stream that, when events are emitted from this stream in close temporal succession, emits only the last event of the succession.
      private PausableSuccessionStream​(org.reactfx.EventStream<O> input, java.time.Duration timeout, javafx.beans.property.BooleanProperty realTime, java.util.function.Predicate<O> condition)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void handleEvent​(O i)  
      private void handleTimeout()  
      private void invalidatePending()  
      boolean isPending()  
      protected org.reactfx.Subscription observeInputs()  
      javafx.beans.value.ObservableBooleanValue pendingProperty()  
      • Methods inherited from class org.reactfx.ObservableBase

        addObserver, enqueueNotifications, equals, forEachObserver, getObserverCount, hashCode, isObservingInputs, newObserver, notifyObservers, notifyObservers, observe, removeObserver, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • 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
    • Field Detail

      • input

        private final org.reactfx.EventStream<O> input
      • initial

        private final java.util.function.Function<? super O,​? extends O> initial
      • reduction

        private final java.util.function.BiFunction<? super O,​? super O,​? extends O> reduction
      • timer

        private final org.reactfx.util.Timer timer
      • hasEvent

        private boolean hasEvent
      • pending

        private javafx.beans.binding.BooleanBinding pending
      • successionOff

        private javafx.beans.property.BooleanProperty successionOff
      • successionOffCond

        private java.util.function.Predicate<O> successionOffCond
      • event

        private O event
    • Constructor Detail

      • PausableSuccessionStream

        public PausableSuccessionStream​(org.reactfx.EventStream<O> input,
                                        java.time.Duration timeout,
                                        javafx.beans.property.BooleanProperty realTime)
        Returns an event stream that, when events are emitted from this stream in close temporal succession, emits only the last event of the succession. What is considered a close temporal succession is defined by timeout: time gap between two successive events must be at most timeout.

        Note: This function can be used only when this stream and the returned stream are used from the JavaFX application thread.

        Parameters:
        timeout - the maximum time difference between two subsequent events in close succession.
        realTime - when true immediately emits the next event and sets realTime back to false.
      • PausableSuccessionStream

        public PausableSuccessionStream​(org.reactfx.EventStream<O> input,
                                        java.time.Duration timeout,
                                        java.util.function.Predicate<O> condition)
        Parameters:
        timeout - the maximum time difference between two subsequent events in close succession.
        condition - when true immediately emits the event, otherwise waits for timeout before emitting the last received event.
      • PausableSuccessionStream

        private PausableSuccessionStream​(org.reactfx.EventStream<O> input,
                                         java.time.Duration timeout,
                                         javafx.beans.property.BooleanProperty realTime,
                                         java.util.function.Predicate<O> condition)
    • Method Detail

      • pendingProperty

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

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

        protected final org.reactfx.Subscription observeInputs()
        Specified by:
        observeInputs in class org.reactfx.ObservableBase<java.util.function.Consumer<? super O>,​O>
      • handleEvent

        private void handleEvent​(O i)
      • handleTimeout

        private void handleTimeout()
      • invalidatePending

        private void invalidatePending()