|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.simulations.Organism
edu.colorado.simulations.Plant
public class Plant
A Plant is an Organism with extra methods that
allow it to be eaten.
Organism| Constructor Summary | |
|---|---|
Plant(double initSize,
double initRate)
Construct a Plant with a specified size and growth rate. |
|
| Method Summary | |
|---|---|
void |
nibbledOn(double amount)
Have this Plant lose some of its size by being eaten. |
| Methods inherited from class edu.colorado.simulations.Organism |
|---|
alterSize, expire, getRate, getSize, isAlive, setRate, simulateWeek |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Plant(double initSize,
double initRate)
Plant with a specified size and growth rate.
initSize - the initial size of this Plant, in ouncesinitRate - the initial growth rate of this Plant, in ounces
initSize >= 0. Also, if initSize is zero, then
initRate must also be zero.
Plant has been initialized. The value returned from
getSize() is now initSize, and the value
returned from getRate() is now initRate.
java.lang.IllegalArgumentException - Indicates that initSize or initRate violates
the precondition.| Method Detail |
|---|
public void nibbledOn(double amount)
Plant lose some of its size by being eaten.
amount - The amount of this Plant that is eaten (in ounces).
0 <= amount <= getSize().
Plant has been decreased by
amount. If this reduces the size to zero, then
expire is activated.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||