|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simulare.Clock
Define a clock manager responsible for simulating a time schedule for executing some operations. This clock fires events in a periodic rate defined by the attribute period. To allow a better simulation of parallelism the fireEvent method notifys listeners using a random order.
Constructor Summary | |
Clock()
Creates a clock with a period of 1 second, and maxCounter to positive infinite. |
|
Clock(long period,
long maxCounter)
Creates a clock with a period. |
Method Summary | |
void |
addClockListener(ClockListener l)
Remove a clock listener added. |
protected void |
fireClockChanged(ClockEvent e)
|
protected void |
fireClockPaused(ClockEvent e)
|
protected void |
fireClockResumed(ClockEvent e)
|
protected void |
fireClockStarted(ClockEvent e)
|
protected void |
fireClockStoped(ClockEvent e)
|
long |
getMaxCounter()
Return the max number of clock ticks. |
long |
getPeriod()
The clock period in miliseconds. |
boolean |
isPaused()
Indicate if the clock is in pause. |
void |
pause()
Interrupts the clock counting. |
void |
removeClockListener(ClockListener l)
Add a new clock listener. |
void |
resume()
Resume the clock execution. |
void |
setMaxCounter(long maxCounter)
Set the max counter for the clock. |
void |
setPeriod(long period)
Set the clock period. |
void |
start()
Start the clock. |
void |
stop()
Stop the clock. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Clock()
public Clock(long period, long maxCounter)
period
- The periodic Thread interval execution.maxCounter
- The max number of clock ticks.Method Detail |
public long getPeriod()
public void setPeriod(long period)
period
- The clock period.public boolean isPaused()
public long getMaxCounter()
public void setMaxCounter(long maxCounter)
maxCounter
- The max cicle counter. After this limit has been reached
the clock stops.public void start()
public void pause()
public void resume()
public void stop()
public void removeClockListener(ClockListener l)
l
- The clock listener.public void addClockListener(ClockListener l)
l
- The clock listener.protected void fireClockStarted(ClockEvent e)
protected void fireClockPaused(ClockEvent e)
protected void fireClockResumed(ClockEvent e)
protected void fireClockStoped(ClockEvent e)
protected void fireClockChanged(ClockEvent e)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |