org.opensourcephysics.sip.ch14.traffic
Class Freeway
java.lang.Object
org.opensourcephysics.sip.ch14.traffic.Freeway
- All Implemented Interfaces:
- Drawable
public class Freeway
- extends java.lang.Object
- implements Drawable
Freeway uses the Nagel-Schreckenberg model of single lane traffic
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
v
public int[] v
x
public int[] x
xtemp
public int[] xtemp
spaceTime
public LatticeFrame spaceTime
distribution
public double[] distribution
roadLength
public int roadLength
numberOfCars
public int numberOfCars
maximumVelocity
public int maximumVelocity
p
public double p
flow
public double flow
steps
public int steps
t
public int t
scrollTime
public int scrollTime
Freeway
public Freeway()
initialize
public void initialize(LatticeFrame spaceTime)
- Initializes arrays and starting configuration of cars.
step
public void step()
- Does one time step
computeSpaceTimeDiagram
public void computeSpaceTimeDiagram()
draw
public void draw(DrawingPanel panel,
java.awt.Graphics g)
- Draws freeway.
- Specified by:
draw
in interface Drawable