org.apache.uima.internal.util
Class Timer

java.lang.Object
  extended by org.apache.uima.internal.util.Timer

public final class Timer
extends java.lang.Object

Simple timer class.


Constructor Summary
Timer()
          Create a new timer.
 
Method Summary
 long getTime()
          Get the currently accumulated time.
 TimeSpan getTimeSpan()
          Get the accumulated time as a time span object.
 boolean reset()
          Reset the timer to 0.
 boolean start()
          (Re)start the timer.
 boolean stop()
          Stop the timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timer

public Timer()
Create a new timer. The new timer will NOT be started automatically. You need to invoke start() explicitly.

Method Detail

start

public boolean start()
(Re)start the timer. If the timer has already been started, does nothing.

Returns:
false iff the timer is already running.

stop

public boolean stop()
Stop the timer.

Returns:
false iff the timer is not running.

reset

public boolean reset()
Reset the timer to 0. The timer must be stopped before it can be reset.

Returns:
false iff the timer is currently running.

getTime

public long getTime()
Get the currently accumulated time. This method may be called while the timer is running, or after it has been stopped.

Returns:
The duration in milliseconds.

getTimeSpan

public TimeSpan getTimeSpan()
Get the accumulated time as a time span object.

Returns:
A time span object for the current value of the timer.
See Also:
getTime()


Copyright © 2013. All Rights Reserved.