ucb.util
Class Ticker

java.lang.Object
  extended by 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
Ticker(long interval)
          A Ticker that, when started, fires every INTERVAL milliseconds, or never, if interval <= 0.
 
Method Summary
 void close()
          Permanently stop THIS and terminate its thread.
 void run()
          Internal method.
 void start()
          Start ticking, executing tick () at each tick.
 void stop()
          Stop ticking.
protected abstract  void tick()
          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 Detail

Ticker

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

Method Detail

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