Class ClearScreenTimer
java.lang.Object
pt.unl.fct.di.novasys.babel.generic.ProtoTimer
pt.unl.fct.di.tardis.babel.iot.demos.events.ClearScreenTimer
- All Implemented Interfaces:
Cloneable
public class ClearScreenTimer
extends pt.unl.fct.di.novasys.babel.generic.ProtoTimer
A one-shot "wipe the display" timer used by demos that want to clear an output
device a little while after they last drew to it (for example, clearing the
LED matrix once a reactive gesture has been shown for long enough).
Like DemoTimer, this is purely a typed Babel event: you schedule it
with setupTimer and Babel delivers it back to the handler registered
for TIMER_ID. Distinct from DemoTimer only by its id, so a
single demo can run both a periodic "tick" timer and a separate "clear"
timer without their handlers colliding.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortBabel timer id for the clear-screen timer (kept distinct fromDemoTimer.TIMER_ID). -
Constructor Summary
ConstructorsConstructorDescriptionCreates a clear-screen timer stamped with the current wall-clock time.ClearScreenTimer(long ts) Creates a clear-screen timer carrying a caller-supplied timestamp. -
Method Summary
Modifier and TypeMethodDescriptionpt.unl.fct.di.novasys.babel.generic.ProtoTimerclone()Stateless timer, so cloning has nothing to copy: returningthisis the Babel convention for an immutableProtoTimerand avoids an allocation each time the timer re-fires.longMethods inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoTimer
getId
-
Field Details
-
TIMER_ID
public static final short TIMER_IDBabel timer id for the clear-screen timer (kept distinct fromDemoTimer.TIMER_ID).- See Also:
-
-
Constructor Details
-
ClearScreenTimer
public ClearScreenTimer()Creates a clear-screen timer stamped with the current wall-clock time. -
ClearScreenTimer
public ClearScreenTimer(long ts) Creates a clear-screen timer carrying a caller-supplied timestamp.
-
-
Method Details
-
clone
public pt.unl.fct.di.novasys.babel.generic.ProtoTimer clone()Stateless timer, so cloning has nothing to copy: returningthisis the Babel convention for an immutableProtoTimerand avoids an allocation each time the timer re-fires.- Specified by:
clonein classpt.unl.fct.di.novasys.babel.generic.ProtoTimer
-
getTimestamp
public long getTimestamp()- Returns:
- the timestamp this timer was created with.
-