public class LaneIM extends Object
Constructor and Description |
---|
LaneIM(Lane lane)
Create a lane and intersection manager relationship object.
|
Modifier and Type | Method and Description |
---|---|
double |
distanceFromPrevIntersection(Point2D p)
Find the distance from a point, projected onto the Lane, to the previous
intersection that a vehicle at that position on the Lane would have
encountered.
|
double |
distanceToFirstIntersection()
Get the distance from the start of this Lane to the first
IntersectionManager that this Lane, or any Lane it leads into intersects.
|
double |
distanceToNextIntersection(Point2D p)
Find the distance to the next IntersectionManager a vehicle at the given
position will encounter.
|
double |
distanceToNextIntersectionManager(IntersectionManager im)
Get the distance from the given IntersectionManager to the next
one that that this Lane, or any Lane it leads into enters.
|
IntersectionManager |
firstIntersectionManager()
Get the first IntersectionManager that this Lane, or any Lane it leads
into enters.
|
Lane |
laneToFirstIntersection()
Find the next Lane, including this one, that enters an intersection at
any point.
|
Lane |
laneToNextIntersection(Point2D p)
Find the next Lane, including this one, that will enter an intersection,
starting at the point in this Lane nearest the provided point.
|
IntersectionManager |
lastIntersectionManager()
Get the last IntersectionManager that this Lane, or any Lane that leads
into it enters.
|
IntersectionManager |
nextIntersectionManager(IntersectionManager im)
Get the IntersectionManager that this Lane, or any Lane it leads into
enters, after the given IntersectionManager.
|
IntersectionManager |
nextIntersectionManager(Point2D p)
Find the next IntersectionManager a vehicle at the given position will
encounter.
|
void |
registerIntersectionManager(IntersectionManager im)
Register an
IntersectionManager with this Lane. |
double |
remainingDistanceFromLastIntersection()
Get the distance from the end of this Lane to the last
IntersectionManager that this Lane, or any Lane that leads into it
entered.
|
double |
timeToNextIntersectionManager(IntersectionManager im,
double maxVelocity)
Get the approximate time from the given IntersectionManager to the next
one that that this Lane, or any Lane it leads into enters, based on
distances and speed limits.
|
public LaneIM(Lane lane)
lane
- the lane.public void registerIntersectionManager(IntersectionManager im)
IntersectionManager
with this Lane. If the Lane does
not intersect the area controlled by the IntersectionManager, it has no
effect. Otherwise, the IntersectionManager is stored and returned under
certain circumstances by the nextIntersectionManager
method.im
- the IntersectionManager to registerpublic IntersectionManager firstIntersectionManager()
public double distanceToFirstIntersection()
Double.MAX_VALUE
if no such IntersectionManager exists.Double.MAX_VALUE
if no such
IntersectionManager existspublic Lane laneToFirstIntersection()
public IntersectionManager lastIntersectionManager()
public double remainingDistanceFromLastIntersection()
Double.MAX_VALUE
if no such IntersectionManager exists.Double.MAX_VALUE
if no such
IntersectionManager existspublic IntersectionManager nextIntersectionManager(Point2D p)
p
- the location of the hypothetical vehiclenull
if nonepublic double distanceToNextIntersection(Point2D p)
p
- the current location of the vehiclepublic Lane laneToNextIntersection(Point2D p)
p
- the current location of the vehiclepublic double distanceFromPrevIntersection(Point2D p)
p
- the current location of the vehiclepublic IntersectionManager nextIntersectionManager(IntersectionManager im)
im
- the IntersectionManager to which we would like the successorpublic double distanceToNextIntersectionManager(IntersectionManager im)
im
- the IntersectionManager at which to startpublic double timeToNextIntersectionManager(IntersectionManager im, double maxVelocity)
im
- the IntersectionManager at which to startmaxVelocity
- the maximum velocity of the vehicleCopyright © 2013. All rights reserved.