|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectfishPond.Plant
public class Plant
The state of a plant includes it's position (row and column) and it's size.
A Plant grows over time. Plants are eaten by fish that pass over them.
| Field Summary | |
|---|---|
static int |
MAX_PLANT_SIZE
Maximum size for a plant |
static int |
PLANT_BITE_SIZE
Portion of plant that is eaten by a fish passing over it |
static int |
PLANT_STARTING_SIZE
Initial size of plants in beginning of simulation |
| Constructor Summary | |
|---|---|
Plant(int rowIn,
int colIn,
int size)
Standard constructor that merely initializes the fields from the parameters |
|
Plant(Plant other)
Standard copy constructor that merely copies the fields |
|
| Method Summary | |
|---|---|
int |
getCol()
returns column |
int |
getRow()
returns row |
int |
getSize()
returns size |
void |
grow()
increments size by one unit |
boolean |
isAlive()
returns true if size is bigger than zero, false otherwise. |
void |
removeBite(int biteSize)
decreases size by biteSize units |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PLANT_STARTING_SIZE
public static final int MAX_PLANT_SIZE
public static final int PLANT_BITE_SIZE
| Constructor Detail |
|---|
public Plant(int rowIn,
int colIn,
int size)
public Plant(Plant other)
| Method Detail |
|---|
public boolean isAlive()
public int getRow()
public int getCol()
public int getSize()
public void grow()
public void removeBite(int biteSize)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||