aim4.driver
Class Driver

java.lang.Object
  extended by aim4.driver.Driver
All Implemented Interfaces:
DriverSimView
Direct Known Subclasses:
AutoDriver, CrashTestDummy

public abstract class Driver
extends Object
implements DriverSimView

An agent that drives a AutoVehicleDriverView.


Field Summary
protected  Lane currentLane
          The Lane that the driver is currently following.
protected  Set<Lane> currentlyOccupiedLanes
          The set of Lanes that the vehicle is currently occupied
 
Constructor Summary
Driver()
           
 
Method Summary
 void act()
          Take control actions for driving the agent's Vehicle.
 void addCurrentlyOccupiedLane(Lane lane)
          Add a lane that the DriverAgent's vehicle currently occupies.
protected  double distanceFromPrevIntersection()
          Find the distance from the previous intersection in the Lane in which the Vehicle is, from the position at which the Vehicle is.
protected  double distanceToNextIntersection()
          Find the distance to the next intersection in the Lane in which the Vehicle is, from the position at which the Vehicle is.
 Lane getCurrentLane()
          Get the Lane the DriverAgent is currently following.
 Set<Lane> getCurrentlyOccupiedLanes()
          Get the lanes the DriverAgent's vehicle currently occupies.
 Road getDestination()
          Get where this driver is going.
 SpawnPoint getSpawnPoint()
          Get where this DriverAgent is coming from.
abstract  VehicleDriverView getVehicle()
          Get the Vehicle this driver agent is controlling.
protected  IntersectionManager nextIntersectionManager()
          Find the next IntersectionManager that the Vehicle will need to interact with, in this Lane.
 void setCurrentLane(Lane lane)
          Set the Lane the DriverAgent is currently following.
 void setDestination(Road destination)
          Set where this driver agent is going.
 void setSpawnPoint(SpawnPoint spawnPoint)
          Set where this driver agent is coming from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentLane

protected Lane currentLane
The Lane that the driver is currently following.


currentlyOccupiedLanes

protected Set<Lane> currentlyOccupiedLanes
The set of Lanes that the vehicle is currently occupied

Constructor Detail

Driver

public Driver()
Method Detail

act

public void act()
Take control actions for driving the agent's Vehicle. This includes physical manipulation of the Vehicle as well as sending any messages or performing any coordination tasks.

Specified by:
act in interface DriverSimView

getVehicle

public abstract VehicleDriverView getVehicle()
Get the Vehicle this driver agent is controlling.

Specified by:
getVehicle in interface DriverSimView
Returns:
the Vehicle this driver agent is controlling

getSpawnPoint

public SpawnPoint getSpawnPoint()
Get where this DriverAgent is coming from.

Specified by:
getSpawnPoint in interface DriverSimView
Returns:
the Road where this DriverAgent is coming from

setSpawnPoint

public void setSpawnPoint(SpawnPoint spawnPoint)
Set where this driver agent is coming from.

Specified by:
setSpawnPoint in interface DriverSimView
Parameters:
spawnPoint - the spawn point that generated the driver

getDestination

public Road getDestination()
Get where this driver is going.

Specified by:
getDestination in interface DriverSimView
Returns:
the Road where this driver is going

setDestination

public void setDestination(Road destination)
Set where this driver agent is going.

Specified by:
setDestination in interface DriverSimView
Parameters:
destination - the Road where this DriverAgent should go

getCurrentLane

public Lane getCurrentLane()
Get the Lane the DriverAgent is currently following.

Specified by:
getCurrentLane in interface DriverSimView
Returns:
the Lane the DriverAgent is currently following

setCurrentLane

public void setCurrentLane(Lane lane)
Set the Lane the DriverAgent is currently following.

Specified by:
setCurrentLane in interface DriverSimView
Parameters:
lane - the Lane the DriverAgent should follow

getCurrentlyOccupiedLanes

public Set<Lane> getCurrentlyOccupiedLanes()
Get the lanes the DriverAgent's vehicle currently occupies.

Specified by:
getCurrentlyOccupiedLanes in interface DriverSimView
Returns:
the lanes the DriverAgent's vehicle currently occupies

addCurrentlyOccupiedLane

public void addCurrentlyOccupiedLane(Lane lane)
Add a lane that the DriverAgent's vehicle currently occupies.

Parameters:
lane - a lane that the DriverAgent's vehicle currently occupies

nextIntersectionManager

protected IntersectionManager nextIntersectionManager()
Find the next IntersectionManager that the Vehicle will need to interact with, in this Lane.

Returns:
the nextIntersectionManager that the Vehicle will need to interact with, in this Lane

distanceToNextIntersection

protected double distanceToNextIntersection()
Find the distance to the next intersection in the Lane in which the Vehicle is, from the position at which the Vehicle is.

Returns:
the distance to the next intersection given the current Lane and position of the Vehicle.

distanceFromPrevIntersection

protected double distanceFromPrevIntersection()
Find the distance from the previous intersection in the Lane in which the Vehicle is, from the position at which the Vehicle is. This subtracts the length of the Vehicle from the distance from the front of the Vehicle.

Returns:
the distance from the previous intersection given the current Lane and position of the Vehicle.


Copyright © 2011. All Rights Reserved.