|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.util.Timer
public class Timer
A timer for recording time intervals. All time units are measured in milliseconds. This simple timer class is used for measuring a duration of time; i.e. measure how much time an action takes to execute. For example, an application which executes long operation such as downloading a video from a remote site may use a timer to record how long the download takes and update a status display with the timer duration at regular intervals.
Alarm
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
RB_KEY
|
static java.lang.Long |
Zero
A Long integer with the value 0. used in event notification; |
Fields inherited from interface com.sas.util.TimeIntervals |
---|
ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK |
Constructor Summary | |
---|---|
Timer()
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object object)
Test object equality. |
boolean |
equals(Timer t)
Test object equality. |
long |
getDuration()
Return the number of milliseconds this timer has been running. |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
|
long |
getStartTime()
Return this timer's start time. |
long |
getStopTime()
Return this timer's stop time. |
int |
hashCode()
Compute a hash code. |
boolean |
isRunning()
Test if a timer is running. |
void |
setRunning(boolean running)
Set the state of the boolean running property. |
void |
start()
Start this timer. |
void |
stop()
Stop this timer. |
java.lang.String |
toString()
Generate a string representation of this timer. |
Field Detail |
---|
public static final java.lang.String RB_KEY
public static java.lang.Long Zero
Constructor Detail |
---|
public Timer()
Method Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- another object
true
if the other object is a Timer
and it has the same startTime
, stopTime
,
and running
status.public boolean equals(Timer t)
t
- another Timer
object
true
if t has the same startTime, stopTime,
and running status.public int hashCode()
hashCode
in class java.lang.Object
public void start()
start
in interface TimerInterface
public void stop()
stop
in interface TimerInterface
public boolean isRunning()
isRunning
in interface TimerInterface
true
if stop()
has not been called since start()
was last called;
false
otherwise.public long getStartTime()
getStartTime
in interface TimerInterface
public long getStopTime()
getStopTime
in interface TimerInterface
public long getDuration()
getDuration
in interface TimerInterface
public final void setRunning(boolean running)
setRunning
in interface TimerInterface
running
- the new running state. If this is
the same as the current state, nothing happens.
Otherwise, if true
, then call start()
, else call stop()
.
This method is an alias for calling start
and stop
,
and is therefore final
.
If you override a Timer
, you shuld override those
methods to change behavior.public java.lang.String toString()
toString
in class java.lang.Object
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |