Package org.apache.uima.internal.util
Class Timer
- java.lang.Object
-
- org.apache.uima.internal.util.Timer
-
public final class Timer extends Object
Simple timer class.
-
-
Constructor Summary
Constructors Constructor Description Timer()
Create a new timer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Constructor Detail
-
Timer
public Timer()
Create a new timer. The new timer will NOT be started automatically. You need to invokestart()
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.
-
-