A B C D E F G H I L M N O R S T W

A

add(Locatable) - Method in class BoundedEnv
Adds a new object to this environment at the location it specifies.
add(Locatable) - Method in interface Environment
Adds a new object to this environment at the location it specifies.
allObjects() - Method in class BoundedEnv
Returns all the objects in this environment.
allObjects() - Method in interface Environment
Returns all the objects in this environment.
associate(String, LocatableDisplay) - Static method in class DisplayMap
Associates a display object with an environment object class.

B

BoundedEnv - class BoundedEnv.
AP® Computer Science Marine Biology Simulation:
The BoundedEnv class models a bounded, two-dimensional, grid-like environment containing locatable objects.
BoundedEnv(int, int) - Constructor for class BoundedEnv
Constructs an empty BoundedEnv object with the given dimensions.

C

col() - Method in class Location
Returns the column coordinate of this location.
ColMajorEnvIterator - class ColMajorEnvIterator.
Environment-Based Applications:
A ColMajorEnvIterator object provides an iterator that steps through the locations of a BoundedEnv object in column-major order.
ColMajorEnvIterator(BoundedEnv) - Constructor for class ColMajorEnvIterator
Constructs an iterator object that steps through an environment.
color() - Method in class ColorBlock
Gets color value for color block.
ColorBlock - class ColorBlock.
Environment-Based Applications:
A ColorBlock object encapsulates a color for a colored cell in an environment.
ColorBlock(Color, Environment, Location) - Constructor for class ColorBlock
Constructs a color block with the specified color.
ColorBlockDisplay - class ColorBlockDisplay.
Environment-Based Applications:
A ColorBlockDisplay object displays a ColorBlock object in an environment.
ColorBlockDisplay() - Constructor for class ColorBlockDisplay
 
compareTo(Object) - Method in class Location
Compares this location to other for ordering.

D

Direction - class Direction.
AP® Computer Science Marine Biology Simulation:
The Direction class encapsulates the notion of a compass direction such as North, East, South, West.
Direction() - Constructor for class Direction
Constructs a default Direction object facing North.
Direction(int) - Constructor for class Direction
Constructs a Direction object.
Direction(String) - Constructor for class Direction
Constructs a Direction object.
DisplayMap - class DisplayMap.
AP® Computer Science Marine Biology Simulation:
DisplayMap is a collection that maps environment object classes to objects that know how to display them.
DisplayMap() - Constructor for class DisplayMap
 
draw(Locatable, Component, Graphics2D) - Method in class ColorBlockDisplay
Draw the given object (color block).

E

EAST - Static variable in class Direction
 
EnvDisplay - interface EnvDisplay.
AP® Computer Science Marine Biology Simulation:
The EnvDisplay interface describes the methods needed by all EnvDisplay objects.
Environment - interface Environment.
AP® Computer Science Marine Biology Simulation:
Environment provides an interface for a two-dimensional, grid-like environment containing locatable objects.
environment() - Method in class EnvIterator
Returns environment through which this iterator iterates.
EnvIterator - class EnvIterator.
Environment-Based Applications:
An EnvIterator object provides an iterator that that steps through the locations of a BoundedEnv object in a particular order.
EnvIterator(BoundedEnv) - Constructor for class EnvIterator
Constructs an iterator object that steps through an environment starting at location (0, 0).
EnvIterator(BoundedEnv, Location) - Constructor for class EnvIterator
Constructs an iterator object that steps through an environment, starting at a given location.
equals(Object) - Method in class Direction
Indicates whether some other Direction object is "equal to" this one.
equals(Object) - Method in class Location
Indicates whether some other Location object is "equal to" this one.

F

findDisplayFor(Locatable) - Static method in class DisplayMap
Finds a display class that knows how to display the given object.
findNextLocation() - Method in class ColMajorEnvIterator
Helper Method: Finds next location for iterator.
findNextLocation() - Method in class EnvIterator
Helper Method: Finds next location for iterator.
findNextLocation() - Method in class RowMajorEnvIterator
Helper Method: Finds next location for iterator.
FULL_CIRCLE - Static variable in class Direction
Number of degrees in compass (will not be tested on the Advanced Placement exam).

G

getDirection(Location, Location) - Method in interface Environment
Returns the direction from one location to another.
getDirection(Location, Location) - Method in class SquareEnvironment
Returns the direction from one location to another.
getIterator(String, BoundedEnv) - Static method in class TraversalGUI
Construct the iterator with the specified name.
getNeighbor(Location, Direction) - Method in interface Environment
Returns the adjacent neighbor (whether valid or invalid) of a location in the specified direction.
getNeighbor(Location, Direction) - Method in class SquareEnvironment
Returns the adjacent neighbor (whether valid or invalid) of a location in the specified direction.

H

hashCode() - Method in class Location
Generates a hash code for this location (will not be tested on the Advanced Placement exam).
hasNext() - Method in class EnvIterator
Returns true if the environment has more locations.

I

inDegrees() - Method in class Direction
Returns this direction value in degrees.
isEmpty(Location) - Method in class BoundedEnv
Determines whether a specific location in this environment is empty.
isEmpty(Location) - Method in interface Environment
Determines whether a specific location in this environment is empty.
isValid(Location) - Method in class BoundedEnv
Verifies whether a location is valid in this environment.
isValid(Location) - Method in interface Environment
Verifies whether a location is valid in this environment.
IteratorLab - class IteratorLab.
Environment-Based Applications:
The IteratorLab class provides a main method that creates an animation of 2-D structure traversals using iterators.
IteratorLab() - Constructor for class IteratorLab
 

L

Locatable - interface Locatable.
AP® Computer Science Marine Biology Simulation:
Locatable is an interface that guarantees that an object knows its location and returns it when the location method is called.
Location - class Location.
AP® Computer Science Marine Biology Simulation:
A Location object represents the row and column of a location in a two-dimensional grid.
location() - Method in class ColorBlock
Gets color block's location.
location() - Method in interface Locatable
Returns the location of this object.
Location(int, int) - Constructor for class Location
Constructs a Location object.

M

main(String[]) - Static method in class IteratorLab
Start the 2-D Traversal Algorithms program.

N

neighborsOf(Location) - Method in interface Environment
Returns the adjacent neighbors of a specified location.
neighborsOf(Location) - Method in class SquareEnvironment
Returns the adjacent neighbors of a specified location.
newWindow() - Method in class TraversalGUI
Constructs a new window in which to run another instance of the traversal algorithm animation program.
next() - Method in class EnvIterator
Returns the next location in the environment.
nextLocation() - Method in class EnvIterator
Returns next location (pure accessor -- does not advance iterator).
NORTH - Static variable in class Direction
 
NORTHEAST - Static variable in class Direction
 
NORTHWEST - Static variable in class Direction
 
numAdjacentNeighbors() - Method in interface Environment
Returns the number of adjacent neighbors around each cell.
numAdjacentNeighbors() - Method in class SquareEnvironment
Returns the number of adjacent neighbors around each cell.
numCellSides() - Method in interface Environment
Returns the number of sides around each cell.
numCellSides() - Method in class SquareEnvironment
Returns the number of sides around each cell.
numCols() - Method in class BoundedEnv
Returns number of columns in the environment.
numCols() - Method in interface Environment
Returns number of columns in this environment.
numObjects() - Method in class BoundedEnv
Returns the number of objects in this environment.
numObjects() - Method in interface Environment
Returns the number of objects in this environment.
numRows() - Method in class BoundedEnv
Returns number of rows in the environment.
numRows() - Method in interface Environment
Returns number of rows in this environment.

O

objectAt(Location) - Method in class BoundedEnv
Returns the object at a specific location in this environment.
objectAt(Location) - Method in interface Environment
Returns the object at a specific location in this environment.

R

randomDirection() - Static method in class Direction
Returns a random direction.
randomDirection() - Method in interface Environment
Generates a random direction.
randomDirection() - Method in class SquareEnvironment
Generates a random direction.
recordMove(Locatable, Location) - Method in class BoundedEnv
Updates this environment to reflect the fact that an object moved.
recordMove(Locatable, Location) - Method in interface Environment
Updates this environment to reflect the fact that an object moved.
register(String, Class) - Static method in class TraversalGUI
 
remove() - Method in class EnvIterator
Removes from the underlying collection the last element returned by the iterator (not supported).
remove(Locatable) - Method in class BoundedEnv
Removes the object from this environment.
remove(Locatable) - Method in interface Environment
Removes the object from this environment.
resetEnv() - Method in class TraversalGUI
Resets the environment to be empty.
reverse() - Method in class Direction
Returns the direction that is the reverse of this Direction object.
roundedDir(int, Direction) - Method in class Direction
Rounds this direction to the nearest "cardinal" direction (will not be tested on the Advanced Placement exam).
The choice of possible cardinal directions depends on the number of cardinal directions and the starting direction.
row() - Method in class Location
Returns the row coordinate of this location.
RowMajorEnvIterator - class RowMajorEnvIterator.
Environment-Based Applications:
A RowMajorEnvIterator object provides an iterator that steps through the locations of a BoundedEnv object in row-major order.
RowMajorEnvIterator(BoundedEnv) - Constructor for class RowMajorEnvIterator
Constructs an iterator object that steps through an environment.
runTraversal(String) - Method in class TraversalGUI
Animates a traversal algorithm.

S

showEnv() - Method in interface EnvDisplay
Shows the current state of the environment.
SOUTH - Static variable in class Direction
 
SOUTHEAST - Static variable in class Direction
 
SOUTHWEST - Static variable in class Direction
 
SquareEnvironment - class SquareEnvironment.
AP® Computer Science Marine Biology Simulation:
SquareEnvironment is an abstract class that implements only the navigational methods in the Environment interface.
SquareEnvironment() - Constructor for class SquareEnvironment
Constructs a SquareEnvironment object in which cells have four adjacent neighbors -- those with which they share sides.
SquareEnvironment(boolean) - Constructor for class SquareEnvironment
Constructs a SquareEnvironment object in which cells have four or eight adjacent neighbors, depending on the value of the includeDiagonalNeighbors parameter.
step() - Method in class TraversalGUI
Executes one step in a traversal.
stopAlg() - Method in class TraversalGUI
Interrupts a running traversal algorithm.

T

toLeft() - Method in class Direction
Returns the direction that is a quarter turn to the left of this Direction object.
toLeft(int) - Method in class Direction
Returns the direction that is deg degrees to the left of this Direction object.
toRight() - Method in class Direction
Returns the direction that is a quarter turn to the right of this Direction object.
toRight(int) - Method in class Direction
Returns the direction that is deg degrees to the right of this Direction object.
toString() - Method in class BoundedEnv
Creates a single string representing all the objects in this environment (not necessarily in any particular order).
toString() - Method in class Direction
Represents this direction as a string.
toString() - Method in class Location
Represents this location as a string.
TraversalGUI - class TraversalGUI.
Environment-Based Applications:
The TraversalGUI class provides a graphical user interface to a program that creates an animation of 2-D structure traversals.

W

WEST - Static variable in class Direction
 

A B C D E F G H I L M N O R S T W