Class MovingAnimal

java.lang.Object
  |
  +--Animal
        |
        +--MovingAnimal
Direct Known Subclasses:
FastMover, Seahorse

public abstract class MovingAnimal
extends Animal

abstract class which stores a speed field for all moving animals, defines mutator and observer for speed field, defines getDirection() method for us in calculating makeMove() in descendent classes including FastMover and Seahorse; field int speed - stores speed of movement of an animal


Constructor Summary
MovingAnimal()
           
 
Method Summary
protected  Direction getDirection()
          method provided to pick next direction to try to move each direction equally likely; only available to descendent classes
 int getSpeed()
          observer for speed field; accessible to clients
protected  void setSpeed(int s)
          mutator for speed field; only accessible to descendent classes
 
Methods inherited from class Animal
getAge, getmaxAge, getPrintChar, incrAge, makeMove, setmaxAge, timeToDie
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovingAnimal

public MovingAnimal()
Method Detail

setSpeed

protected void setSpeed(int s)
mutator for speed field; only accessible to descendent classes
Parameters:
int - s - used to set speed

getSpeed

public int getSpeed()
observer for speed field; accessible to clients

getDirection

protected Direction getDirection()
method provided to pick next direction to try to move each direction equally likely; only available to descendent classes