|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Animal | +--MovingAnimal
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 |
public MovingAnimal()
Method Detail |
protected void setSpeed(int s)
int
- s - used to set speedpublic int getSpeed()
protected Direction getDirection()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |