|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Animal | +--MovingAnimal | +--FastMover
abstract class which sets the maximum age of all fast moving animals, defines makeMove() and laysEggs() for all fast moving animals currently Crab, Shrimp, Starfish
Method Summary | |
abstract FastMover |
getNewFastMover()
abstract method forces all actual animal descendent classes of FastMover to define a method that returns a new animal of their kind; allows laysEggs() to be inherited by all these classes |
Set |
laysEggs()
method uses random number generator to select how many offspring of fast moving animal survive; current settings are 60% 0 survivors, 30% 1 survivor, 10$ 2 survivors. |
Location |
makeMove(Location myLoc,
World myWorld)
method implements movement for all fast moving animals first a direction is picked and then multiplied by the scale factor (speed field) of this animal; this Location is checked to see if it is free. |
Methods inherited from class MovingAnimal |
getDirection,
getSpeed,
setSpeed |
Methods inherited from class Animal |
getAge,
getmaxAge,
getPrintChar,
incrAge,
setmaxAge,
timeToDie |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public abstract FastMover getNewFastMover()
public Location makeMove(Location myLoc, World myWorld)
public Set laysEggs()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |