public final class DiscreteEventSimulator extends Platform implements java.lang.Runnable
Typical use of this platform is shown below:
import org.arl.fjage.*; Platform platform = new DiscreteEventSimulator(); Container container = new Container(platform); container.add("myAgent", new myAgent()); // add appropriate agents platform.start();
containers, running
Constructor and Description |
---|
DiscreteEventSimulator()
Creates a DiscreteEventSimulator that runs as fast as possible.
|
DiscreteEventSimulator(float speed)
Creates a DiscreteEventSimulator that runs approximately at speed x realtime,
ignoring processing time.
|
Modifier and Type | Method and Description |
---|---|
long |
currentTimeMillis()
Gets the current platform time in milliseconds.
|
void |
delay(long millis)
Delays execution by a specified number of milliseconds of platform time.
|
void |
idle()
Internal method called by a container when all agents are idle.
|
long |
nanoTime()
Gets the current platform time in nanoseconds.
|
void |
run()
Thread implementation.
|
void |
schedule(java.util.TimerTask task,
long millis)
Schedules a task to be executed at a given platform time.
|
void |
shutdown()
Terminates all containers on the platform.
|
void |
start()
Starts all containers on the platform.
|
addContainer, getBuildVersion, getContainers, getHostname, getNetworkInterface, isIdle, isRunning, setHostname, setNetworkInterface, setNetworkInterface
public DiscreteEventSimulator()
public DiscreteEventSimulator(float speed)
speed
- speed up with respect to real time.public long currentTimeMillis()
Platform
currentTimeMillis
in interface TimestampProvider
currentTimeMillis
in class Platform
public long nanoTime()
Platform
nanoTime
in interface TimestampProvider
nanoTime
in class Platform
public void delay(long millis)
Platform
This method should not be called by an agent directly, as it may deadlock.
An agent should use Agent.delay(long)
instead.
public void schedule(java.util.TimerTask task, long millis)
Platform
public void idle()
Platform
public void start()
Platform
public void shutdown()
Platform
public void run()
run
in interface java.lang.Runnable
Runnable.run()