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 after a given delay.
|
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, setNetworkInterfacepublic DiscreteEventSimulator()
public DiscreteEventSimulator(float speed)
speed - speed up with respect to real time.public long currentTimeMillis()
PlatformcurrentTimeMillis in interface TimestampProvidercurrentTimeMillis in class Platformpublic long nanoTime()
PlatformnanoTime in interface TimestampProvidernanoTime in class Platformpublic 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)
Platformpublic void idle()
Platformpublic void start()
Platformpublic void shutdown()
Platformpublic void run()
run in interface java.lang.RunnableRunnable.run()