public abstract class AbstractSimulationScript extends Object implements EventListenerInterface
Copyright (c) 2013-2019 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 |
addTabs(OTSSimulatorInterface sim,
OTSSimulationApplication<?> animation)
Adds tabs 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.
|
long |
getLongProperty(String propertyName)
Returns the long value of given property.
|
OTSRoadNetwork |
getNetwork()
Returns the network.
|
String |
getProperty(String propertyName)
Returns the String value of given property.
|
OTSSimulatorInterface |
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 |
setAnimationToggles(OTSAnimationPanel animation)
Sets the animation toggles.
|
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(OTSAnimationPanel animationPanel,
OTSRoadNetwork net)
Method that is called when the animation has been created, to add components for a demo.
|
protected abstract OTSRoadNetwork |
setupSimulation(OTSSimulatorInterface 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 long getLongProperty(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() throws Exception
Exception
- on any exceptionpublic final void notify(EventInterface event) throws RemoteException
notify
in interface EventListenerInterface
RemoteException
public final OTSSimulatorInterface getSimulator()
public final OTSRoadNetwork getNetwork()
protected void animateNetwork(OTSNetwork net)
net
- OTSNetwork; networkprotected void addTabs(OTSSimulatorInterface sim, OTSSimulationApplication<?> animation)
sim
- OTSSimulatorInterface; simulatoranimation
- OTSSimulationApplication<?>; animation to add tabs toprotected void setDefaultProperties()
setProperty()
. Default implementation does nothing.protected void onSimulationEnd()
protected void setupDemo(OTSAnimationPanel animationPanel, OTSRoadNetwork net)
animationPanel
- OTSAnimationPanel; animation panelnet
- OTSNetwork; networkprotected void setAnimationToggles(OTSAnimationPanel animation)
animation
- OTSAnimationPanel; animation to set the toggle onprotected abstract OTSRoadNetwork setupSimulation(OTSSimulatorInterface 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
- OTSSimulatorInterface; simulatorException
- on any exceptionCopyright © 2014–2019 Delft University of Technology. All rights reserved.