edu.toronto.cs.util
Class StopWatch

java.lang.Object
  extended by edu.toronto.cs.util.StopWatch

public class StopWatch
extends java.lang.Object

This class implements a stop watch.


Constructor Summary
StopWatch()
          Creates a new StopWatch which starts ticking immediately.
 
Method Summary
 long getTimeElapsed()
          Gets the time elapsed in milliseconds.
 void pause()
          Stops the time counter recording the elapsed time.
 void reset()
          Resets the time counter and restarts the StopWatch.
 void resume()
          Resumes the time counting if the watch was stopped.
 void stop()
           
 java.lang.String toString()
          Gets the time elapsed in hh:mm:ss.sss format as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StopWatch

public StopWatch()
Creates a new StopWatch which starts ticking immediately.

Method Detail

reset

public void reset()
Resets the time counter and restarts the StopWatch.


pause

public void pause()
Stops the time counter recording the elapsed time. The counting can be resumed.


stop

public void stop()

resume

public void resume()
Resumes the time counting if the watch was stopped. Does nothing otherwise.


getTimeElapsed

public long getTimeElapsed()
Gets the time elapsed in milliseconds.


toString

public java.lang.String toString()
Gets the time elapsed in hh:mm:ss.sss format as a String.

Overrides:
toString in class java.lang.Object