public abstract class AbstractSimulationScript extends Object implements EventListenerInterface
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier | Constructor and Description |
---|---|
protected |
AbstractSimulationScript(String name,
String description,
String[] properties)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAnimationToggles(AbstractWrappableAnimation animation)
Sets the animation toggles.
|
protected void |
addTabs(SimpleSimulatorInterface sim)
Adds taps to the animation.
|
protected void |
animateNetwork(OTSNetwork net)
Creates animations for nodes, links and lanes.
|
boolean |
getBooleanProperty(String propertyName)
Returns the boolean value of given property.
|
double |
getDoubleProperty(String propertyName)
Returns the double value of given property.
|
Duration |
getDurationProperty(String propertyName)
Returns the Duration value of given property.
|
GTUColorer |
getGtuColorer()
Returns the GTU colorer.
|
int |
getIntegerProperty(String propertyName)
Returns the int value of given property.
|
OTSNetwork |
getNetwork()
Returns the network.
|
String |
getProperty(String propertyName)
Returns the String value of given property.
|
DEVSSimulatorInterface.TimeDoubleUnit |
getSimulator()
Returns the simulator.
|
Time |
getTimeProperty(String propertyName)
Returns the Time value of given property.
|
void |
notify(EventInterface event) |
protected void |
onSimulationEnd()
Method that is called when the simulation has ended.
|
protected void |
setDefaultProperties()
Sets the default properties.
|
void |
setGtuColorer(GTUColorer colorer)
Set GTU colorer.
|
void |
setProperty(String propertyName,
Object propertyValue)
Sets a property.
|
protected void |
setupDemo(AbstractWrappableAnimation animation,
OTSNetwork net)
Method that is called when the animation has been created, to add components for a demo.
|
protected abstract OTSNetwork |
setupSimulation(DEVSSimulatorInterface.TimeDoubleUnit sim)
Sets up the simulation based on provided properties.
|
void |
start()
Starts the simulation.
|
public final void setProperty(String propertyName, Object propertyValue)
propertyName
- String; property namepropertyValue
- Object; property valuepublic final String getProperty(String propertyName)
propertyName
- String; property namepublic final double getDoubleProperty(String propertyName)
propertyName
- String; property namepublic final boolean getBooleanProperty(String propertyName)
propertyName
- String; property namepublic final int getIntegerProperty(String propertyName)
propertyName
- String; property namepublic final Duration getDurationProperty(String propertyName)
propertyName
- String; property namepublic final Time getTimeProperty(String propertyName)
propertyName
- String; property namepublic final void setGtuColorer(GTUColorer colorer)
colorer
- GTUColorer; GTU colorerpublic final GTUColorer getGtuColorer()
public final void start()
public final void notify(EventInterface event) throws RemoteException
notify
in interface EventListenerInterface
RemoteException
public final DEVSSimulatorInterface.TimeDoubleUnit getSimulator()
public final OTSNetwork getNetwork()
protected void animateNetwork(OTSNetwork net)
net
- OTSNetwork; networkprotected void addAnimationToggles(AbstractWrappableAnimation animation)
animation
- AbstractWrappableAnimation; animation to set the toggle onprotected void addTabs(SimpleSimulatorInterface sim)
sim
- SimpleSimulatorInterface; simulatorprotected void setDefaultProperties()
setProperty()
. Default implementation does nothing.protected void onSimulationEnd()
protected void setupDemo(AbstractWrappableAnimation animation, OTSNetwork net)
animation
- AbstractWrappableAnimation; animationnet
- OTSNetwork; networkprotected abstract OTSNetwork setupSimulation(DEVSSimulatorInterface.TimeDoubleUnit sim) throws Exception
getProperty()
. Setting up a
simulation should at least create a network and some demand. Additionally this may setup traffic control, sampling, etc.sim
- DEVSSimulatorInterface.TimeDoubleUnit; simulatorException
- on any exceptionCopyright © 2014–2018 Delft University of Technology. All rights reserved.