A B C D E F G H M N O P Q R S T V

A

alreadyTaken(int, int) - Method in class Vehicle
Returns true if the given location in the destinations array already contains a destination.
array - Variable in class ArrayDisplay
 
ArrayDisplay - class ArrayDisplay.
ArrayDisplay provides a simple GUI for displaying an array of Objects (such as Strings), and for displaying messages as appropriate.
ArrayDisplay.MyPanel - class ArrayDisplay.MyPanel.
An inner class to implement the actual drawing.
ArrayDisplay.MyPanel() - Constructor for class ArrayDisplay.MyPanel
 
ArrayDisplay(Object[][]) - Constructor for class ArrayDisplay
Creates a Frame for displaying the contents of the given array.
ArrayDisplay(Object[][], Object[][]) - Constructor for class ArrayDisplay
Creates a Frame for displaying the contents of the two given arrays.

B

backgroundArray - Variable in class ArrayDisplay
 
bigFont - Variable in class ArrayDisplay
 

C

canPlace(int, int) - Method in class Truck
 
Car - class Car.
A Car is a kind of Vehicle that occupies a single location on the traffic grid.
Car(Vehicle[][], String[][], int, int) - Constructor for class Car
Constructs a Car.
COLUMN_SPACING - Variable in class ArrayDisplay
 
columns - Variable in class ArrayDisplay
 
columns - Variable in class TrafficJam
 
controlPanel - Variable in class ArrayDisplay
 
currentColumn - Variable in class Vehicle
The current column location of this Vehicle.
currentRow - Variable in class Vehicle
The current row location of this Vehicle.

D

destinations - Variable in class TrafficJam
 
destinations - Variable in class Vehicle
An array of destinations.
disappear() - Method in class Truck
Removes this Vehicle from the traffic grid.
disappear() - Method in class Vehicle
Removes this Vehicle from the traffic grid.
displayMessage(String) - Method in class ArrayDisplay
Displays the given message in the TextField.

E

extraColumn - Variable in class Truck
 
extraRow - Variable in class Truck
 

F

FONT_SIZE - Variable in class ArrayDisplay
 

G

goalColumn - Variable in class Vehicle
The destination column for this Vehicle.
goalRow - Variable in class Vehicle
The destination row for this Vehicle.

H

hasRoomForTruck(int, int) - Method in class TrafficJam
Returns true if the given location is null AND an adjacent location is also null (because trucks require two spaces).

M

main(String[]) - Static method in class ArrayDisplay
No parameters necessary.
main(String[]) - Static method in class TrafficJam
Parameters: Number of rows, number of columns, number of cars, number of trucks.
mainPanel - Variable in class ArrayDisplay
 
manhattanDistance(int, int) - Method in class Vehicle
Computes the Manhattan distance between this Vehicle and the given point.
manhattanDistance(int, int, int, int) - Static method in class Vehicle
Computes the Manhattan distance between two points.
MAX_COLUMNS - Variable in class TrafficJam
 
MAX_ROWS - Variable in class TrafficJam
 
MAX_VEHICLES - Variable in class TrafficJam
 
messageField - Variable in class ArrayDisplay
 
minimumDistance - Variable in class Vehicle
 
move() - Method in class Vehicle
Attempts to move the vehicle closer to its destination; returns true if the attempt is successful.

N

name - Variable in class Vehicle
 
nextChar - Static variable in class Vehicle
 
numberOfVehicles - Variable in class TrafficJam
 

O

onDestination() - Method in class Car
Tests if this Car is at its destination.
onDestination() - Method in class Truck
Tests if this Truck is at its destination.
onDestination() - Method in class Vehicle
Returns true if this Vehicle is at its destination.

P

paint(Graphics) - Method in class ArrayDisplay.MyPanel
Clears this Panel, draws the backgroundArray in light gray then draws the main array on top of it, in black.
paintArray(Graphics, Object[][]) - Method in class ArrayDisplay.MyPanel
Draws the given array in this panel, in the current color.
plainFont - Variable in class ArrayDisplay
 

Q

quitButton - Variable in class ArrayDisplay
 

R

random - Static variable in class TrafficJam
 
random - Static variable in class Truck
 
random - Static variable in class Vehicle
 
repaint() - Method in class ArrayDisplay
Pauses for one second, then repaints the array.
ROW_SPACING - Variable in class ArrayDisplay
 
rows - Variable in class ArrayDisplay
 
rows - Variable in class TrafficJam
 
runSimulation() - Method in class TrafficJam
Simulates traffic flow.

S

sign(int) - Static method in class Vehicle
Returns the sign function of the given integer.

T

toString() - Method in class Vehicle
Returns the one-letter name of this vehicle.
town - Variable in class TrafficJam
 
town - Variable in class Vehicle
The "traffic grid" containing Vehicles.
TrafficJam - class TrafficJam.
This is a very crude simulation of traffic.
TrafficJam(int, int, int, int) - Constructor for class TrafficJam
 
Truck - class Truck.
A Truck is a kind of Vehicle that occupies two adjacent (horizontal or vertical) traffic grid locations.
Truck(Vehicle[][], String[][], int, int) - Constructor for class Truck
Constructs a Truck.
tryMove(int, int) - Method in class Car
Tries to move this Car one step closer to its destination, and returns true if successful.
tryMove(int, int) - Method in class Truck
Tries to move this Truck one step closer to its destination, and returns true if successful.
tryMove(int, int) - Method in class Vehicle
Tries to move this Vehicle one step closer to its destination, and returns true if successful.

V

Vehicle - class Vehicle.
A Vehicle is an abstract entity that occupies one or more locations on the traffic grid, and has another location defined as its destination.
Vehicle(Vehicle[][], String[][], int, int) - Constructor for class Vehicle
Creates a Vehicle in a spot not containing another vehicle, and gives it a destination different from all other vehicle destinations.
vehicles - Variable in class TrafficJam
 

A B C D E F G H M N O P Q R S T V