Package ucb.util

Class Ticker

java.lang.Object
ucb.util.Ticker
All Implemented Interfaces:
Runnable

public abstract class Ticker extends Object implements Runnable
A simple timer class that periodically performs some action.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ticker(long interval)
    A Ticker that, when started, fires every INTERVAL milliseconds, or never, if interval <= 0.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Permanently stop THIS and terminate its thread.
    void
    run()
    Internal method.
    void
    Start ticking, executing tick() at each tick.
    void
    Stop ticking.
    protected abstract void
    Action to perform on each clock tick.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Ticker

      public Ticker(long interval)
      A Ticker that, when started, fires every INTERVAL milliseconds, or never, if interval <= 0.
  • Method Details

    • start

      public void start()
      Start ticking, executing tick() at each tick.
    • stop

      public void stop()
      Stop ticking.
    • close

      public void close()
      Permanently stop THIS and terminate its thread.
    • tick

      protected abstract void tick()
      Action to perform on each clock tick. Must be overrridden.
    • run

      public void run()
      Internal method. Don't call directly.
      Specified by:
      run in interface Runnable