protected abstract static class AbstractListener.ContinuousEvent<E>
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
ContinuousEvent(com.google.common.base.Stopwatch watch,
long pause,
long window,
java.util.concurrent.TimeUnit unit) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
accept(java.util.LinkedList<E> sequence,
E event)
Determines whether specified event is suitable for further processing.
|
protected abstract boolean |
continuous(java.util.LinkedList<E> sequence,
E event)
Determines whether specified event is continuous to the event sequence.
|
abstract void |
flush() |
long |
pause()
Returns maximal between continuous event pause.
|
protected abstract void |
process(java.util.LinkedList<E> sequence)
Processes continuous event sequence.
|
abstract void |
push(E event) |
java.util.LinkedList<E> |
sequence() |
java.lang.String |
toString() |
protected com.google.common.base.MoreObjects.ToStringHelper |
toStringHelper() |
protected long |
total()
Returns total elapsed window time.
|
java.util.concurrent.TimeUnit |
unit()
Returns common time unit for both pause and window.
|
protected void |
watchNotRunning()
Invoked when watch not running and about to start.
|
protected void |
watchRunningButEventsNotContinouous()
Invoked when watch running but events not continuous so about to be processed.
|
protected void |
watchTimeElapsedAndAboutToProcess(long delta)
Invoked when watch time elapsed and continuous events about to be processed.
|
protected void |
watchTimeNotElapsed(long delta)
Invoked when watch time not elapsed and about to wait for next event push.
|
long |
window()
Returns maximal continuous event time window.
|
protected ContinuousEvent(com.google.common.base.Stopwatch watch, long pause, long window, java.util.concurrent.TimeUnit unit)
public abstract void push(E event)
public abstract void flush()
public final java.util.LinkedList<E> sequence()
public final long pause()
public final long window()
public final java.util.concurrent.TimeUnit unit()
protected abstract boolean accept(java.util.LinkedList<E> sequence, E event)
sequence
- possibly empty continuous event sequenceevent
- potential event to further processprotected abstract boolean continuous(java.util.LinkedList<E> sequence, E event)
sequence
- non-empty continuous event sequenceevent
- potential event sequence candidateprotected abstract void process(java.util.LinkedList<E> sequence)
sequence
- non-empty continuous event sequenceprotected final long total()
java.lang.IllegalStateException
- if watch not runningprotected void watchRunningButEventsNotContinouous()
protected void watchNotRunning()
protected void watchTimeNotElapsed(long delta)
delta
- elapsed time delta lesser than pauseprotected void watchTimeElapsedAndAboutToProcess(long delta)
delta
- elapsed time delta greater or equal to pausepublic java.lang.String toString()
toString
in class java.lang.Object
protected com.google.common.base.MoreObjects.ToStringHelper toStringHelper()