|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.util.TimeSource
public class TimeSource
Defines a time-source for use by classes that take an application time as a reference point.
The time-source initial state is stopped. Once started, stopping the time-source will cause its recorded time to be reset. Pausing the time-source will cause the next call to start to begin the timesource's count from where it was when it was paused.
Animator
Field Summary | ||
---|---|---|
static int |
STATE_PAUSED
Represents the state when the time-source is paused. |
|
static int |
STATE_STARTED
Represents the state when the time-source is playing. |
|
static int |
STATE_STOPPED
Represents the state when the time-source is stopped. |
Constructor Summary | ||
---|---|---|
TimeSource()
Constucts a new TimeSource instance. |
Method Summary | ||
---|---|---|
void |
addListener(TimeSourceListener listener)
Adds a listener on the TimeSource . |
|
float |
getSpeed()
Get the current speed factor of the time-source. |
|
int |
getState()
Gets the time-source's current state: one of STATE_STARTED, STATE_PAUSED, or STATE_STOPPED. |
|
long |
getTime()
Get the amount of time the time-source has been running for. |
|
void |
pause()
Pause the time-source from STATE_STARTED. |
|
void |
removeListener(TimeSourceListener listener)
Removes a listener from the TimeSource . |
|
void |
setSpeed(float speed)
Set the time-source's speed factor. |
|
void |
start()
Start the time-source from STATE_STOPPED or STATE_PAUSED. |
|
void |
stop()
Stops the time-source. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STATE_STOPPED
TimeSource.getState()
,
TimeSource.stop()
,
Constant Field Valuespublic static final int STATE_STARTED
TimeSource.getState()
,
TimeSource.start()
,
Constant Field Valuespublic static final int STATE_PAUSED
TimeSource.getState()
,
TimeSource.pause()
,
Constant Field ValuesConstructor Detail |
---|
public TimeSource()
Method Detail |
---|
public long getTime()
public void start()
public void pause()
public void stop()
public void setSpeed(float speed)
This value will be multiplied by time intervals before they are added to the running time.
speed
- The speed factor.public float getSpeed()
public int getState()
public void addListener(TimeSourceListener listener)
TimeSource
.
listener
- TimeSourceListener
to listen on the TimeSource
.
IllegalArgumentException
- if listener
is null
.public void removeListener(TimeSourceListener listener)
TimeSource
.
Removes the first occurrence of listener
from the set of TimeSourceListener
's
on the TimeSource
.
listener
- TimeSourceListener
to remove from the TimeSource
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal