|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.util.SystemClock
public class SystemClock
How to use in practice:
| Field Summary | |
|---|---|
private int |
clockState
|
private Thread |
clockThread
|
private long |
currentTimeBaseTime
|
private static int |
DELAY1
|
private static int |
DELAY2
|
private static int |
DELAY3
|
private static int |
DELAY4
|
private int |
framerateCounter
|
private Frame |
frameRatecounterFrame
|
private String |
framerateCounterText
|
private static int |
INIT
|
private ArrayList<ClockListener> |
listeners
|
private boolean |
listenersModified
|
private long |
mediaTime
|
private static double |
MICROSPERSECOND
|
private static double |
MILLISPERSECOND
|
private static double |
NANOSPERSECOND
|
private static long |
NANOSPERSMILLISECOND
|
private long |
nanoTickSize
|
private ArrayList<ClockListener> |
newListeners
|
private static int |
PAUSED
|
private long |
prevFramerateTime
|
private double |
rate
|
private double |
refreshDelay
|
static double |
REFRESHDELAY
|
private static int |
RUNNING
|
private Semaphore |
runSem
|
private static int |
TERMINATED
|
private static int |
TESTTICKSIZE
|
| Constructor Summary | |
|---|---|
SystemClock()
|
|
SystemClock(long tickSize)
Creates a new SystemClock, not yet "ticking", and in the STOPPED state, with mediaTime set to 0. |
|
| Method Summary | |
|---|---|
void |
addClockListener(ClockListener listener)
adds "listener" to the list of ClockListeners that receive time(currentTime) callbacks. |
long |
getMediaNanoseconds()
Gets this Clock's current media time in nanoseconds. |
double |
getMediaSeconds()
Gets this Clock's current media time in seconds. |
double |
getRate()
Gets the current temporal scale factor. |
void |
init()
Initializes the media time, broadcasts this media time to all clock listeners and puts the clock in the paused state, ready to start |
private void |
initTime()
|
static void |
main(String[] arg)
|
void |
pause()
Put the clock in the paused state. |
private void |
resetFrameRate()
|
void |
setFramerateCounterFrame(Frame frame)
Associate a Frame ( which migh be a JFrame), that will be used to show a framerate counter in the title bar. |
void |
setFramerateCounterPrefixText(String prefixText)
sets the framerate counter text, in front of the actual frame rate number. |
void |
setMediaSeconds(double mt)
Sets the Clock's media time, specified in second. |
void |
setRate(double rate)
Sets the temporal scale factor. |
private void |
showFrameRate()
|
void |
start()
Start ticking, with the current media time set to the specified time. |
private void |
startClockThread()
Creates and starts a Thread that delivers clock ticks, by calling tick() on a regular base. |
void |
terminate()
Will stop the clock and will terminate the clock Thread. |
private void |
time()
|
private void |
updateListeners()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double REFRESHDELAY
private Thread clockThread
private long nanoTickSize
private long currentTimeBaseTime
private volatile long mediaTime
private volatile double rate
private long prevFramerateTime
private int framerateCounter
private double refreshDelay
private String framerateCounterText
private Frame frameRatecounterFrame
private volatile boolean listenersModified
private ArrayList<ClockListener> listeners
private ArrayList<ClockListener> newListeners
private static final int INIT
private static final int RUNNING
private static final int PAUSED
private static final int TERMINATED
private volatile int clockState
private Semaphore runSem
private static final long NANOSPERSMILLISECOND
private static final double NANOSPERSECOND
private static final double MICROSPERSECOND
private static final double MILLISPERSECOND
private static final int TESTTICKSIZE
private static final int DELAY1
private static final int DELAY2
private static final int DELAY3
private static final int DELAY4
| Constructor Detail |
|---|
public SystemClock()
public SystemClock(long tickSize)
| Method Detail |
|---|
public void addClockListener(ClockListener listener)
public double getMediaSeconds()
public void setMediaSeconds(double mt)
public long getMediaNanoseconds()
public void start()
public void pause()
public void terminate()
public void init()
public void setRate(double rate)
public double getRate()
private void updateListeners()
private void initTime()
private void time()
private void startClockThread()
public void setFramerateCounterFrame(Frame frame)
public void setFramerateCounterPrefixText(String prefixText)
private void showFrameRate()
private void resetFrameRate()
public static void main(String[] arg)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||