WatorWorld
Class Fish

java.lang.Object
  extended by WatorWorld.Actor
      extended by WatorWorld.Fish

public class Fish
extends Actor

A class to model a Fish in the Wator simulation.


Constructor Summary
Fish()
          Create a new Fish.
 
Method Summary
 void act()
          Act to move if possible and then breed if time.
static int getBreedTime()
           
 char getChar()
          Return the character for Fish.
static int getNumFish()
          Return the total number of fish that exist.
static Color getStandardFishColor()
          Get the standard Fish Color.
 boolean isEdible()
          Return if edible, which for fish is true.
 void removeSelfFromGrid()
          Remove my self from the grid and decrement the total number of fish.
static void resetNumFish()
          Reset number of fish to zero.
static void setBreedTime(int newBreedTime)
          Change the number of turns before a fish can breed.
 
Methods inherited from class WatorWorld.Actor
getColor, getDirection, getGrid, getLocation, moveTo, putSelfInGrid, setColor, setDirection, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Fish

public Fish()
Create a new Fish. Increment the total number of fish.

Method Detail

setBreedTime

public static void setBreedTime(int newBreedTime)
Change the number of turns before a fish can breed.

Parameters:
newBreedTime - parmater must be greater than 0.

getNumFish

public static int getNumFish()
Return the total number of fish that exist.

Returns:
The total number of fish that exist.

resetNumFish

public static void resetNumFish()
Reset number of fish to zero.


getStandardFishColor

public static Color getStandardFishColor()
Get the standard Fish Color.

Returns:
The standard Color for Fish.

getBreedTime

public static int getBreedTime()

act

public void act()
Act to move if possible and then breed if time. Fish act by first checking to see if they can move. If they can they move to a random location. Then they check to see if it is time to breed. If so then they create an offspring in the location they just left.

Overrides:
act in class Actor

getChar

public char getChar()
Return the character for Fish.

Overrides:
getChar in class Actor
Returns:
the character representation of this SeaCreature

removeSelfFromGrid

public void removeSelfFromGrid()
Remove my self from the grid and decrement the total number of fish.

Overrides:
removeSelfFromGrid in class Actor

isEdible

public boolean isEdible()
Return if edible, which for fish is true.

Overrides:
isEdible in class Actor
Returns:
false. Expected to be overriden by child classes