Package org.fxmisc.flowless
Class PausableSuccessionStream<O>
- java.lang.Object
-
- org.reactfx.ObservableBase<java.util.function.Consumer<? super T>,T>
-
- org.reactfx.EventStreamBase<O>
-
- org.fxmisc.flowless.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
-
-
-
-
Field Detail
-
input
private final org.reactfx.EventStream<O> input
-
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 bytimeout
: time gap between two successive events must be at mosttimeout
.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.
-
-
Method Detail
-
pendingProperty
public javafx.beans.value.ObservableBooleanValue pendingProperty()
- Specified by:
pendingProperty
in interfaceorg.reactfx.AwaitingEventStream<O>
-
isPending
public boolean isPending()
- Specified by:
isPending
in interfaceorg.reactfx.AwaitingEventStream<O>
-
observeInputs
protected final org.reactfx.Subscription observeInputs()
-
handleEvent
private void handleEvent(O i)
-
handleTimeout
private void handleTimeout()
-
invalidatePending
private void invalidatePending()
-
-