|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--RoadNetwork
The RoadNetwork
class creates and stores all the road network
infrastructure classes such as roads and junctions and how they
inter-relate.
Field Summary | |
protected CarGenerator |
carGenerator
|
protected int |
currentIndex
|
protected JunctionModel[] |
junctions
|
protected LaneModel[] |
lanes
|
static int |
MAPEDGE
|
protected RoadDesigner |
roadDesigner
|
protected int |
totalJunctionNumber
|
protected int |
totalLaneNumber
|
Constructor Summary | |
RoadNetwork(RoadDesigner roadDesigner,
int speed)
The RoadNetwork constructor pulls information from the Road-Editor and converts into a form the simulation can use. |
Method Summary | |
void |
addTimerToElements(TimeManager theTicker)
Adds timed elements to the global clock. |
void |
drawNetworkComponents(java.awt.Graphics2D g2d)
Draws all the cars known to the road network. |
void |
generateAdaptivePath()
Tries to discover the longest path of junctions back to back. |
java.awt.Shape |
getAdaptivePath()
Tries to syncronize the junctions on a junction path found earlier. |
int |
getAverageSpeed()
Gets the speed of all the cars in the roadnetwork and calculates an average value to display on screen. |
Car |
getCar(java.awt.geom.Point2D p)
Gets the car under the mouse click. |
int |
getInputQ(int x,
int y)
|
JunctionModel |
getJunction(int iD)
|
java.lang.String |
getJunctionVars(java.awt.geom.Point2D p)
Gives information to the user about whatever they clicked on. |
LaneModel |
getLane(int i)
|
int |
getNumberInputs()
|
int |
getTotalRoadLength()
|
void |
kill()
Removes all the cars from the network. |
void |
randomizeAdaptivePath()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAPEDGE
protected LaneModel[] lanes
protected JunctionModel[] junctions
protected int currentIndex
protected int totalLaneNumber
protected int totalJunctionNumber
protected RoadDesigner roadDesigner
protected CarGenerator carGenerator
Constructor Detail |
public RoadNetwork(RoadDesigner roadDesigner, int speed)
roadDesigner
- The road editorspeed
- The speed of the cars in the simulationMethod Detail |
public int getNumberInputs()
public LaneModel getLane(int i)
i
- A lane indexpublic JunctionModel getJunction(int iD)
iD
- A junction IDJunctionModel
public void drawNetworkComponents(java.awt.Graphics2D g2d)
g2d
- a Graphics2D
valuepublic void kill()
public void addTimerToElements(TimeManager theTicker)
theTicker
- a TimeManager
public int getTotalRoadLength()
public void generateAdaptivePath()
public java.awt.Shape getAdaptivePath()
Shape
representing the path of junctions trying to
synronizepublic void randomizeAdaptivePath()
public int getInputQ(int x, int y)
x
- an int
valuey
- an int
valueint
representing cars queueing at the input near
where the user clicked.public java.lang.String getJunctionVars(java.awt.geom.Point2D p)
p
- a Point2D
valueString
valuepublic int getAverageSpeed()
int
valuepublic Car getCar(java.awt.geom.Point2D p)
p
- a Point2D
valueCar
value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |