dog.util
Class Timer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--dog.util.Timer
All Implemented Interfaces:
java.lang.Runnable

public final class Timer
extends java.lang.Thread

A timer class that wakes up listeners after a specified number of milliseconds.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Timer(TimerListener listener)
          Constructs a timer.
Timer(TimerListener listener, long interval)
          Constructs a timer with the specified interval, and starts it.
Timer(TimerListener listener, long interval, boolean start)
          Constructs a timer with the specified interval, indicating whether or not to start it.
 
Method Summary
 long getInterval()
          Returns this timer's interval.
 void run()
          Runs this timer.
 void setInterval(long interval)
          Sets this timer's interval.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Timer

public Timer(TimerListener listener)
Constructs a timer.

Timer

public Timer(TimerListener listener,
             long interval)
Constructs a timer with the specified interval, and starts it.

Timer

public Timer(TimerListener listener,
             long interval,
             boolean start)
Constructs a timer with the specified interval, indicating whether or not to start it.
Method Detail

getInterval

public long getInterval()
Returns this timer's interval.

setInterval

public void setInterval(long interval)
Sets this timer's interval.

run

public void run()
Runs this timer.
Overrides:
run in class java.lang.Thread