public class IntersectionManager extends Object
Modifier and Type | Field and Description |
---|---|
protected double |
currentTime
the current time of the intersection manager
|
protected int |
id
The ID number of this intersection manager.
|
Constructor and Description |
---|
IntersectionManager(Intersection intersection,
TrackModel trackModel,
double currentTime,
Registry<IntersectionManager> imRegistry)
Create an intersection manager.
|
Modifier and Type | Method and Description |
---|---|
void |
act(double timeStep)
Take any actions for a certain period of time.
|
void |
checkCurrentTime(double currentTime)
Check whether this intersection manager's time is current.
|
boolean |
contains(VehicleSimView vehicle)
Determine whether the given Vehicle is currently entirely contained
within the Area governed by this IntersectionManager.
|
double |
getCurrentTime()
Get the current time.
|
List<? extends Shape> |
getDebugShapes()
Get any shapes to display for debugging purposes.
|
int |
getId()
Get the unique ID number of this IntersectionManager.
|
Intersection |
getIntersection()
Get the intersection managed by this intersection manager.
|
List<Lane> |
getSortedDepartureLanes(Lane arrivalLane,
Road departure)
Given an arrival Lane and a departure Road, get an ordered List of Lanes
that represents the Lanes from highest to lowest priority based on
distance from the arrival Lane.
|
TrackModel |
getTrackModel()
Get the track model.
|
boolean |
intersects(Rectangle2D rectangle)
Determine whether the given Rectangle intersects the Area governed
by this IntersectionManager.
|
boolean |
manages(Lane l)
Whether or not this IntersectionManager manages the given Lane.
|
boolean |
manages(Road r)
Whether or not this IntersectionManager manages the given Road.
|
void |
printData(String outFileName)
Print the collected data to a file
|
double |
traversalDistance(int arrivalID,
int departureID)
Get the distance from the entry of the Lane with the first given ID, to
the departure of the Lane with the other given ID, if traveling along
segments through their point of intersection.
|
double |
traversalDistance(Lane arrival,
Lane departure)
Get the distance from the entry of the given Lane, to the departure of
the other given Lane, if traveling along segments through their point
of intersection.
|
double |
traversalDistance(Road arrival,
Road departure)
Get the distance from the entry of the given Road, to the departure of
the other given Road.
|
protected int id
protected double currentTime
public IntersectionManager(Intersection intersection, TrackModel trackModel, double currentTime, Registry<IntersectionManager> imRegistry)
intersection
- an intersectiontrackModel
- a path model of the intersectioncurrentTime
- the current timeimRegistry
- an intersection manager registrypublic void act(double timeStep)
timeStep
- the size of the time step to simulate, in secondspublic int getId()
public double getCurrentTime()
public Intersection getIntersection()
public TrackModel getTrackModel()
public boolean manages(Road r)
r
- the Roadpublic boolean manages(Lane l)
l
- the Lanepublic boolean contains(VehicleSimView vehicle)
vehicle
- the Vehiclepublic boolean intersects(Rectangle2D rectangle)
rectangle
- the Rectanglepublic List<Lane> getSortedDepartureLanes(Lane arrivalLane, Road departure)
arrivalLane
- the Lane in which the vehicle is arrivingdeparture
- the Road by which the vehicle is departingpublic double traversalDistance(Road arrival, Road departure)
arrival
- the arrival Roaddeparture
- the departure Roadpublic double traversalDistance(Lane arrival, Lane departure)
arrival
- the arrival Lanedeparture
- the departure Lanepublic double traversalDistance(int arrivalID, int departureID)
arrivalID
- the ID number of the arrival LanedepartureID
- the ID number of the departure Lanepublic void printData(String outFileName)
outFileName
- the name of the file to which the data are outputted.public void checkCurrentTime(double currentTime)
currentTime
- the current timeCopyright © 2013. All rights reserved.