ch.aplu.util
Class Timer

java.lang.Object
  |
  +--ch.aplu.util.BaseTimer
        |
        +--ch.aplu.util.Timer

public class Timer
extends BaseTimer

Class to define a timer with low resolution (based on Date.getTime()) (Resolution normally less than 10 milliseconds.) (All methods (except constructors) call yield() of the current thread unless disabled by special constructor.)


Constructor Summary
Timer()
          Construct a LoResTimer object and set its time to zero.
Timer(boolean autostart)
          Same as LoResTimer(), but the timer starts immediately if autostart is true.
Timer(boolean autostart, boolean yield)
          Same as LoResTimer(autostart), but most methods calls Thread.yield() automatically, if yield is true.
 
Methods inherited from class ch.aplu.util.BaseTimer
getTime, isRunning, reset, resume, start, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timer

public Timer()
Construct a LoResTimer object and set its time to zero. The timer must be started by calling start().


Timer

public Timer(boolean autostart)
Same as LoResTimer(), but the timer starts immediately if autostart is true.


Timer

public Timer(boolean autostart,
             boolean yield)
Same as LoResTimer(autostart), but most methods calls Thread.yield() automatically, if yield is true. This may give a much better time response when using loops with an empty body like

while ( watch.isRunning() ) {}.