de.unidu.is.util
Class StopWatch

java.lang.Object
  extended byde.unidu.is.util.StopWatch

public class StopWatch
extends java.lang.Object

A simple stop watch.

Since:
2003-10-15
Version:
$Revision: 1.7 $, $Date: 2005/03/02 09:20:51 $
Author:
Henrik Nottelmann

Constructor Summary
StopWatch()
          Creates a new stop watch.
StopWatch(java.lang.String name)
          Creates a new stop watch.
 
Method Summary
 java.lang.String asComplete()
          Deprecated. Use toString() instead
 java.lang.String asMillis()
          Returns a string representation of the time difference (in millis).
 java.lang.String asMins()
          Returns a string representation of the time difference (in minutes).
 java.lang.String asSecs()
          Returns a string representation of the time difference (in seconds).
 long getAverageMillis()
          Returns the average time difference in millis.
 long getTotalMillis()
          Returns the total (accumulated) time difference in millis.
 void reset()
          Resets the watch.
 void start()
          Starts the watch.
 void stop()
          Stops the watch.
 java.lang.String toString()
          Returns a string representation of the time difference (in minutes).
 
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 stop watch.


StopWatch

public StopWatch(java.lang.String name)
Creates a new stop watch.

Parameters:
name - name of the stop watch
Method Detail

start

public void start()
Starts the watch.


stop

public void stop()
Stops the watch.


reset

public void reset()
Resets the watch. The time difference, the start time and the number of start events are set to zero.


getTotalMillis

public long getTotalMillis()
Returns the total (accumulated) time difference in millis.

Returns:
total time difference in millis

getAverageMillis

public long getAverageMillis()
Returns the average time difference in millis.

Returns:
average time difference in millis

toString

public java.lang.String toString()
Returns a string representation of the time difference (in minutes).

Returns:
string representation of the time difference (in minutes)

asComplete

public java.lang.String asComplete()
Deprecated. Use toString() instead

Returns a string representation of the time difference.

Returns:
string representation of the time difference

asMins

public java.lang.String asMins()
Returns a string representation of the time difference (in minutes).

Returns:
string representation of the time difference (in minutes)

asSecs

public java.lang.String asSecs()
Returns a string representation of the time difference (in seconds).

Returns:
string representation of the time difference (in seconds)

asMillis

public java.lang.String asMillis()
Returns a string representation of the time difference (in millis).

Returns:
string representation of the time difference (in millis)