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

    Fields
    Modifier and Type
    Field
    Description
    static final short
    Babel timer id for the clear-screen timer (kept distinct from DemoTimer.TIMER_ID).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a clear-screen timer stamped with the current wall-clock time.
    Creates a clear-screen timer carrying a caller-supplied timestamp.
  • Method Summary

    Modifier and Type
    Method
    Description
    pt.unl.fct.di.novasys.babel.generic.ProtoTimer
    Stateless timer, so cloning has nothing to copy: returning this is the Babel convention for an immutable ProtoTimer and avoids an allocation each time the timer re-fires.
    long
     

    Methods inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoTimer

    getId

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TIMER_ID

      public static final short TIMER_ID
      Babel timer id for the clear-screen timer (kept distinct from DemoTimer.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: returning this is the Babel convention for an immutable ProtoTimer and avoids an allocation each time the timer re-fires.
      Specified by:
      clone in class pt.unl.fct.di.novasys.babel.generic.ProtoTimer
    • getTimestamp

      public long getTimestamp()
      Returns:
      the timestamp this timer was created with.