org.jboss.seam.render.util
Class Timer

java.lang.Object
  extended by org.jboss.seam.render.util.Timer

public class Timer
extends Object

A simple stopwatch-like timer.

Author:
Lincoln Baxter, III

Method Summary
 long getElapsedMilliseconds()
          Get the number of milliseconds elapsed between now and when the timer was started.
 long getLapMilliseconds()
          Get the number of milliseconds elapsed between now and when the timer lap-point was set.
static Timer getTimer()
          Get an instance of a new Timer object.
 Timer lap()
          Set a lap-point.
 Timer reset()
          Stop and reset the current timer to its initialized state.
 Timer start()
          Start timer, or continue a stopped timer.
 Timer stop()
          Stop this timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTimer

public static Timer getTimer()
Get an instance of a new Timer object.


start

public Timer start()
            throws IllegalStateException
Start timer, or continue a stopped timer.

Throws:
IllegalStateException - if timer is not currently in a stopped state.

stop

public Timer stop()
Stop this timer.

Throws:
IllegalStateException - if timer is already stopped.

lap

public Timer lap()
Set a lap-point. Does not stop the timer, but records one point in time. Calling this method multiple times will move the lap point to the current time.

Throws:
IllegalStateException - if the timer is not in a running state.

reset

public Timer reset()
Stop and reset the current timer to its initialized state. Always succeeds.


getElapsedMilliseconds

public long getElapsedMilliseconds()
Get the number of milliseconds elapsed between now and when the timer was started. If the timer has not been started, return 0.


getLapMilliseconds

public long getLapMilliseconds()
Get the number of milliseconds elapsed between now and when the timer lap-point was set. If the timer has not been started or no lap-time has been set, return 0.



Copyright © 2011 Seam Framework. All Rights Reserved.