A C D G H I M R T

A

action() - Method in class Director
Direct the action on stage and create new Cars as appropriate.
addTo(GWindow) - Method in class Car
Add the elements of this display object to the graphics window.
addTo(GWindow) - Method in class City
Add the elements of this display object to the graphics window.
addTo(GWindow) - Method in class Road
Add the elements of this display object to the graphics window.
addTo(GWindow) - Method in class TrafficLight
Add the elements of this display object to the graphics window.

C

Car - class Car.
This class models a car in our scene.
Car(City, Road, char, int, int, int, Color) - Constructor for class Car
Construct all the components of the Car given the Road it is on and the direction of travel.
changeNumberOfCarsBy(int) - Method in class Road
Change the number of Cars traveling on this Road by the given number
City - class City.
This class models all of the stationary objects in our scene.
City(Director, int, int, int, int) - Constructor for class City
Create a new City object with the specified number of East-West and North-South Roads, keeping in mind the space limitations of the provided GWindow dimensions.

D

Director - class Director.
This class creates a graphics window, adds Props to the scene, and controls their actions.
Director() - Constructor for class Director
Create a new Director and all the required accessories.

G

getBody() - Method in class Car
Return the Shape that is the Car's body
getCarWithNumber(int) - Method in class Director
Retrieve the Car object from the specified position in the roster or null if no such position exists.
getCurrentDirection() - Method in class Car
Return the direction of travel of the Car
getCurrentRoad() - Method in class Car
Return the Road that the Car is currently traveling along.
getEastColor() - Method in class TrafficLight
Return the color of the east-facing lamp.
getEWRoad() - Method in class TrafficLight
Return the East-West road running under this light.
getEWRoad(int) - Method in class City
Retrieve the Road in the specified position in the East-West roadList.
getHeight() - Method in class Car
Return the height of the Car's body
getHeight() - Method in class Road
Return the y-span of the Road.
getNorthColor() - Method in class TrafficLight
Return the color of the north-facing lamp.
getNSRoad() - Method in class TrafficLight
Return the North-South road running under this light.
getNSRoad(int) - Method in class City
Retrieve the Road in the specified position in the North-South roadList.
getNumberOfCars() - Method in class Road
Return the number of Cars traveling on this Road
getNumberOfEWRoads() - Method in class City
Return the number of East-West roads.
getNumberOfNSRoads() - Method in class City
Return the number of North-South roads.
getRoadAboutToIntersect(Car) - Method in class City
Scan all of the Roads lying perpendicular to the given Car's path to see if the Car will be at or inside any of those intersections at the end of its next movement.
getSouthColor() - Method in class TrafficLight
Return the color of the south-facing lamp.
getSpeed() - Method in class Car
Return the speed of the Car in pixels per clock tick
getSpeedLimit() - Method in class Road
Return the speed limit in pixels per tick for Cars on this Road
getSurface() - Method in class Road
Return the Shape avatar of the Road.
getTrafficLightAtIntersectionOf(Road, Road) - Method in class City
Return the TrafficLight object that exists at this intersection, or null if no light at that intersection can be found (perhaps because the intersection does not exist).
getWestColor() - Method in class TrafficLight
Return the color of the west-facing lamp.
getWidth() - Method in class Car
Return the width of the Car's body
getWidth() - Method in class Road
Return the x-span of the Road.
getX() - Method in class Car
Return the upper-left x-coordinate of the Car's body
getX() - Method in class Road
Return the x-coordinate of the upper left corner of the Road.
getY() - Method in class Car
Return the upper-left y-coordinate of the Car's body
getY() - Method in class Road
Return the y-coordinate of the upper left corner of the Road.

H

hasCrashedInto(Car) - Method in class Car
Determine whether the Car's avatar has crashed into another Car.

I

isOnRoad(Road) - Method in class Car
Determine whether the Car's avatar is on the Road in question.
isTotaled() - Method in class Car
Check whether this Car has been totaled.

M

main(String[]) - Static method in class Director
The main() method instantiates a new Director object, creates the Props, starts the action, and displays a notice when the Action is complete.

R

removeFromWindow() - Method in class Car
Remove the elements of this display object from the graphics window.
removeFromWindow() - Method in class City
Remove the elements of this display object from the graphics window.
removeFromWindow() - Method in class Road
Remove the elements of this display object from the graphics window.
removeFromWindow() - Method in class TrafficLight
Remove the elements of this display object from the graphics window.
Road - class Road.
This class models a roadway in our scene.
Road(int, int, int, int, boolean, int) - Constructor for class Road
Construct the surface and the centerline of the road given the parameters.
roadIsEastWest() - Method in class Road
Return a boolean regarding orientation of the Road

T

tick() - Method in class Car
Perform all Car actions necessary per clock tick, assuming the Car hasn't been totaled.
tick() - Method in class City
Tell each TrafficLight in the City to count one clock tick.
tick() - Method in class TrafficLight
Count off a clock tick for this TrafficLight.
totalCar(Car) - Method in class Car
Total the car after an accident with another Car! Turn the body red, send it spinning out of control according to the direction and speed of the other Car, and set totaled to true.
TrafficLight - class TrafficLight.
 
TrafficLight(Director, Road, Road, int) - Constructor for class TrafficLight
Create a new TrafficLight object with 4 lamps, one facing each cardinal direction, surrounding the center of an intersection.

A C D G H I M R T