org.jscience.util
Class IntervalTimer

java.lang.Object
  extended by org.jscience.util.IntervalTimer

public final class IntervalTimer
extends java.lang.Object

Utility class used to calculate the time passed between two events


Constructor Summary
IntervalTimer()
           
 
Method Summary
 double getElapsedTime()
          Calculates elapsed time.
 boolean isStopped()
          Indicates whether timer is currently inactive.
 boolean isTiming()
          Indicates whether timer is currently active.
 void reset()
          Resets the timer.
 void start()
          Starts the timer.
 double stop()
          Stops the timer (if it is running).
 java.lang.String toString()
          Creates a String representation of timer status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntervalTimer

public IntervalTimer()
Method Detail

start

public void start()
Starts the timer.


getElapsedTime

public double getElapsedTime()
Calculates elapsed time.

Returns:
current elapsed time in seconds, as a real number

stop

public double stop()
Stops the timer (if it is running).

Returns:
total elapsed time in seconds, as a real number

reset

public void reset()
Resets the timer.


isTiming

public boolean isTiming()
Indicates whether timer is currently active.

Returns:
true if the timer is active, false otherwise

isStopped

public boolean isStopped()
Indicates whether timer is currently inactive.

Returns:
true if the timer is inactive, false otherwise

toString

public java.lang.String toString()
Creates a String representation of timer status.

Overrides:
toString in class java.lang.Object
Returns:
timer status, as a String