AP® Computer Science Marine Biology Simulation
A B C D E F G H I L M N O P R S T U W

A

act() - Method in class Fish
Acts for one step in the simulation.
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.
add(Locatable) - Method in class UnboundedEnv
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.
allObjects() - Method in class UnboundedEnv
Returns all the objects in this environment.

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.
breed() - Method in class Fish
Attempts to breed into neighboring locations.

C

changeDirection(Direction) - Method in class Fish
Modifies this fish's direction.
changeLocation(Location) - Method in class Fish
Modifies this fish's location and notifies the environment.
col() - Method in class Location
Returns the column coordinate of this location.
color() - Method in class Fish
Returns this fish's color.
compareTo(Object) - Method in class Location
Compares this location to other for ordering.

D

DarterFish - class DarterFish.
AP® Computer Science Marine Biology Simulation:
The DarterFish class represents a fish in the Marine Biology Simulation that darts forward two spaces if it can, moves forward one space if it can't move two, and reverses direction (without moving) if it cannot move forward.
DarterFish(Environment, Location) - Constructor for class DarterFish
Constructs a darter fish at the specified location in a given environment.
DarterFish(Environment, Location, Direction) - Constructor for class DarterFish
Constructs a darter fish at the specified location and direction in a given environment.
DarterFish(Environment, Location, Direction, Color) - Constructor for class DarterFish
Constructs a darter fish of the specified color at the specified location and direction.
Debug - class Debug.
AP® Computer Science Marine Biology Simulation:
The Debug class supports conditional printing of debugging messages.
Debug() - Constructor for class Debug
 
die() - Method in class Fish
Removes this fish from the environment.
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() - Method in class Fish
Returns this fish's direction.
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.

E

EAST - Static variable in class Direction
 
emptyNeighbors() - Method in class Fish
Finds empty locations adjacent to this fish.
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 Fish
Returns this fish's environment.
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

Fish - class Fish.
AP® Computer Science Marine Biology Simulation:
A Fish object represents a fish in the Marine Biology Simulation.
Fish(Environment, Location) - Constructor for class Fish
Constructs a fish at the specified location in a given environment.
Fish(Environment, Location, Direction) - Constructor for class Fish
Constructs a fish at the specified location and direction in a given environment.
Fish(Environment, Location, Direction, Color) - Constructor for class Fish
Constructs a fish of the specified color at the specified location and direction.
FULL_CIRCLE - Static variable in class Direction
Number of degrees in compass (will not be tested on the Advanced Placement exam).

G

generateChild(Location) - Method in class DarterFish
Creates a new darter fish.
generateChild(Location) - Method in class Fish
Creates a new fish with the color of its parent.
generateChild(Location) - Method in class SlowFish
Creates a new slow fish.
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.
getInstance() - Static method in class RandNumGenerator
Returns a random number generator.
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 Direction
Generates a hash code for this direction (will not be tested on the Advanced Placement exam).
hashCode() - Method in class Location
Generates a hash code for this location (will not be tested on the Advanced Placement exam).

I

id() - Method in class Fish
Returns this fish's ID.
inDegrees() - Method in class Direction
Returns this direction value in degrees.
indexOf(Location) - Method in class UnboundedEnv
Get the index of the object at the specified location.
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.
isEmpty(Location) - Method in class UnboundedEnv
Determines whether a specific location in this environment is empty.
isInEnv() - Method in class Fish
Checks whether this fish is in an environment.
isOff() - Static method in class Debug
Checks whether debugging is off.
isOn() - Static method in class Debug
Checks whether debugging is on.
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.
isValid(Location) - Method in class UnboundedEnv
Verifies whether a location is valid in this environment.

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 Fish
Returns this fish'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 MBSGUI
Start the Marine Biology Simulation program.
main(String[]) - Static method in class SimpleMBSDemo1
Start the Marine Biology Simulation program.
main(String[]) - Static method in class SimpleMBSDemo2
Start the Marine Biology Simulation program.
MBSGUI - class MBSGUI.
AP® Computer Science Marine Biology Simulation:
The MBSGUI class provides a main method for a version of the AP Computer Science Marine Biology Simulation with a graphical user interface.
MBSGUI() - Constructor for class MBSGUI
 
move() - Method in class DarterFish
Moves this fish in its environment.
move() - Method in class Fish
Moves this fish in its environment.

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.
nextLocation() - Method in class DarterFish
Finds this fish's next location.
nextLocation() - Method in class Fish
Finds this fish's next location.
nextLocation() - Method in class SlowFish
Finds this fish's next location.
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.
numCols() - Method in class UnboundedEnv
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.
numObjects() - Method in class UnboundedEnv
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.
numRows() - Method in class UnboundedEnv
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.
objectAt(Location) - Method in class UnboundedEnv
Returns the object at a specific location in this environment.

P

print(String) - Static method in class Debug
Prints debugging message without appending a newline character at the end.
println(String) - Static method in class Debug
Prints debugging message, appending a newline character at the end.

R

RandNumGenerator - class RandNumGenerator.
AP® Computer Science Marine Biology Simulation:
The RandNumGenerator class provides a singleton java.util.Random object for random number generation.
RandNumGenerator() - Constructor for class RandNumGenerator
 
randomColor() - Method in class Fish
Generates a random color.
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.
recordMove(Locatable, Location) - Method in class UnboundedEnv
Updates this environment to reflect the fact that an object moved.
remove(Locatable) - Method in class BoundedEnv
Removes the object from this environment.
remove(Locatable) - Method in interface Environment
Removes the object from this environment.
remove(Locatable) - Method in class UnboundedEnv
Removes the object from this environment.
restoreState() - Static method in class Debug
Restores the previous debugging state.
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.

S

showEnv() - Method in interface EnvDisplay
Shows the current state of the environment.
SimpleMBSDemo1 - class SimpleMBSDemo1.
AP® Computer Science Marine Biology Simulation:
The SimpleMBSDemo1 class provides a main method that creates a simulation of a number of fish swimming in a bounded environment.
SimpleMBSDemo1() - Constructor for class SimpleMBSDemo1
 
SimpleMBSDemo2 - class SimpleMBSDemo2.
AP® Computer Science Marine Biology Simulation:
The SimpleMBSDemo2 class provides a main method that creates a simulation of a number of fish swimming in a bounded environment.
SimpleMBSDemo2() - Constructor for class SimpleMBSDemo2
 
Simulation - class Simulation.
AP® Computer Science Marine Biology Simulation:
A Simulation object controls a simulation of fish movement in an Environment.
Simulation(Environment, EnvDisplay) - Constructor for class Simulation
Constructs a Simulation object for a particular environment.
SlowFish - class SlowFish.
AP® Computer Science Marine Biology Simulation:
The SlowFish class represents a fish in the Marine Biology Simulation that moves very slowly.
SlowFish(Environment, Location) - Constructor for class SlowFish
Constructs a slow fish at the specified location in a given environment.
SlowFish(Environment, Location, Direction) - Constructor for class SlowFish
Constructs a slow fish at the specified location and direction in a given environment.
SlowFish(Environment, Location, Direction, Color) - Constructor for class SlowFish
Constructs a slow fish of the specified color at the specified location and direction.
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 Simulation
Runs through a single step of this simulation.

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 Fish
Returns a string representing key information about this fish.
toString() - Method in class Location
Represents this location as a string.
toString() - Method in class UnboundedEnv
Creates a single string representing all the objects in this environment (not necessarily in any particular order).
turnOff() - Static method in class Debug
Turns debugging off.
turnOn() - Static method in class Debug
Turns debugging on.

U

UnboundedEnv - class UnboundedEnv.
AP® Computer Science Marine Biology Simulation:
The UnboundedEnv class models an unbounded, two-dimensional, grid-like environment containing locatable objects.
UnboundedEnv() - Constructor for class UnboundedEnv
Constructs an empty UnboundedEnv object.

W

WEST - Static variable in class Direction
 

A B C D E F G H I L M N O P R S T U W
AP® Computer Science Marine Biology Simulation

Copyright© 2002 College Entrance Examination Board