Class AquaFish

java.lang.Object
  |
  +--AquaFish

public class AquaFish
extends java.lang.Object

Aquarium Lab Series: The AquaFish class defines a fish in an aquarium.

Author:
Autumn Spaulding (autumn@max.cs.kzoo.edu) and Alyce Brady (abrady@kzoo.edu)
See Also:
Aquarium

Constructor Summary
AquaFish(Aquarium aqua)
          The AquaFish constructor sets properties of the AquaFish.
 
Method Summary
 boolean atBottom()
          This function decides whether the fish is at (or below) the bottom.
 boolean atLeftWall()
          This function decides whether the fish is at (or beyond) the left wall.
 boolean atRightWall()
          This function decides whether the fish is at (or beyond) the right wall.
 boolean atSurface()
          This function decides whether the fish is at (or above) the surface.
 boolean atWall()
          This function decides whether the fish is at (or beyond) a wall.
 void changeDir()
          This function changes the direction of the fish.
 java.awt.Color color()
          Get the color of the fish.
 boolean facingLeft()
          This function decides whether the fish is facing Left.
 boolean facingRight()
          This function decides whether the fish is facing Right.
 boolean facingWall()
          This function decides whether a fish is facing a wall.
 int fishHeight()
          Get the height of the fish.
 int fishLength()
          Get the length of the fish.
 int id()
          Get the unique identifier for this fish.
 boolean inAquarium()
          This function decides whether the fish is in an aquarium.
 void move()
          This function allows the fish to move horizontally and vertically by random increments.
 java.lang.String toString()
          This function is provided primarily for debugging purposes.
 void undoMove()
          This function allows the fish to return to its last position (can only back up once).
 int xCoord()
          Get the x coordinate of the fish's position in the aquarium.
 int yCoord()
          Get the y coordinate of the fish's position in the aquarium.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AquaFish

public AquaFish(Aquarium aqua)
The AquaFish constructor sets properties of the AquaFish.
Parameters:
aqua - the Aquarium in which to place the fish
Method Detail

fishLength

public int fishLength()
Get the length of the fish.

fishHeight

public int fishHeight()
Get the height of the fish.

id

public int id()
Get the unique identifier for this fish.

color

public java.awt.Color color()
Get the color of the fish.

inAquarium

public boolean inAquarium()
This function decides whether the fish is in an aquarium.

atWall

public boolean atWall()
This function decides whether the fish is at (or beyond) a wall.

atLeftWall

public boolean atLeftWall()
This function decides whether the fish is at (or beyond) the left wall.

atRightWall

public boolean atRightWall()
This function decides whether the fish is at (or beyond) the right wall.

atSurface

public boolean atSurface()
This function decides whether the fish is at (or above) the surface.

atBottom

public boolean atBottom()
This function decides whether the fish is at (or below) the bottom.

facingRight

public boolean facingRight()
This function decides whether the fish is facing Right.

facingLeft

public boolean facingLeft()
This function decides whether the fish is facing Left.

facingWall

public boolean facingWall()
This function decides whether a fish is facing a wall.

xCoord

public int xCoord()
Get the x coordinate of the fish's position in the aquarium.

yCoord

public int yCoord()
Get the y coordinate of the fish's position in the aquarium.

move

public void move()
This function allows the fish to move horizontally and vertically by random increments.

undoMove

public void undoMove()
This function allows the fish to return to its last position (can only back up once).

changeDir

public void changeDir()
This function changes the direction of the fish.
Postcondition:
fish is facing the opposite direction

toString

public java.lang.String toString()
This function is provided primarily for debugging purposes.
Overrides:
toString in class java.lang.Object