|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectplanty.Sprouling
public class Sprouling
Defines the plant being.
| Field Summary | |
|---|---|
static int |
BAD
Plant health constant. |
static int |
DEAD
Plant health constant. |
static int |
DYING
Plant health constant. |
private static java.lang.String |
foo
The class placeholder for not-defined string data. |
static int |
GOOD
Plant health constant. |
static int |
GREAT
Plant health constant. |
private static java.lang.String[] |
HEALTH
The health-status names. |
private int |
intAge
The plant\'s age, in days. |
private int |
intFruitTime
The amount of time the fruit need to bear a fruit. |
private int |
intHealth
The plant\'s health. |
private int |
intMaxAge
The maximum age for the plant. |
private int |
intMaxFruit
The maximum of fruits the plant can bare. |
private int |
intMinFruit
The minimum of fruits the plant can bare. |
private int |
intWater
The number of waterings the plant has. |
static int |
MAX_HEALTH
Maximum health. |
static int |
NEUTRAL
Plant health constant. |
static int |
PERFECT
Plant health constant. |
private java.lang.String |
strDesc
The plant\'s description -as the creator defines-. |
private java.lang.String |
strName
The plant\'s name. |
private java.lang.String |
strSp
The plant\'s species. |
static int |
WORST
Plant health constant. |
| Constructor Summary | |
|---|---|
Sprouling(java.lang.String name,
java.lang.String species,
java.lang.String description,
int maxFruit,
int fruitTime,
int maxAge)
Constructor method. |
|
Sprouling(java.lang.String name,
java.lang.String species,
java.lang.String description,
int minFruit,
int maxFruit,
int fruitTime,
int maxAge)
Constructor method. |
|
Sprouling(java.lang.String name,
java.lang.String species,
java.lang.String description,
int age,
int health,
int minFruit,
int maxFruit,
int fruitTime,
int maxAge)
Constructor method. |
|
| Method Summary | |
|---|---|
void |
age()
Adds one day to the plant. |
boolean |
canAge()
Checks if the plant can still age up. |
boolean |
canHeal()
Checks if the heal() method can be run. |
int |
getAge()
Does what you'd expect it to do. |
java.lang.String |
getDescription()
Does what you'd expect it to do. |
int |
getFruitTime()
Does what you'd expect it to do. |
int |
getHealth()
Does what you'd expect it to do. |
java.lang.String |
getHealth(int health)
Returns the health name. |
int |
getMaxAge()
Does what you'd expect it to do. |
int |
getMaxFruit()
Does what you'd expect it to do. |
int |
getMinFruit()
Does what you'd expect it to do. |
java.lang.String |
getName()
Does what you'd expect it to do. |
java.lang.String |
getSp()
Does what you'd expect it to do. |
int |
getWaterings()
Does what you'd expect it to do. |
void |
harm()
Damages the plant\'s health by one. |
int |
harvest()
Gets the number of fruits it'll bear and resets its watering state. |
boolean |
hasDescription()
Checks if the plant has a description. |
boolean |
hasName()
Checks if the plant has a name. |
boolean |
hasSp()
Checks if the plant has a species. |
void |
heal()
Heals the plant\'s health by one. |
boolean |
isAlive()
Checks if the plant is alive. |
boolean |
isFruitTime()
Checks whether it is day for the fruits to be ripe or not. |
boolean |
isLastDay()
Checks whether it is the plant's last day of life. |
void |
kill()
Set\'s the plants health to zero, hence killing it. |
void |
renew()
Returns the plant's state to a neutral (alive, zero-age and so on) state. |
void |
setAge(int age)
Does what you'd expect it to do. |
void |
setDescription(java.lang.String desc)
Does what you'd expect it to do. |
private void |
setFruitTime(int fruitTime)
|
void |
setHealth(int health)
Does what you'd expect it to do. |
boolean |
setHealthBy(int modifier)
Deprecated. Not working correctly, for now, handle modifiers to health by using setHealth( getHealth() + modifier ). |
private void |
setMaxAge(int maxAge)
Does what you'd expect it to do. |
private void |
setMaxFruit(int maxFruit)
Does what you'd expect it to do. |
private void |
setMinFruit(int minFruit)
Does what you'd expect it to do. |
void |
setName(java.lang.String name)
Does what you'd expect it to do. |
void |
setSp(java.lang.String species)
Does what you'd expect it to do. |
void |
setWaterings(int waterings)
Does what you'd expect it to do. |
boolean |
wasWatered()
Checks if the plant was watered at least once. |
void |
water()
Water once (adds one to watering count). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String foo
private static final java.lang.String[] HEALTH
public static final int DEAD
public static final int DYING
public static final int WORST
public static final int BAD
public static final int NEUTRAL
public static final int GOOD
public static final int GREAT
public static final int PERFECT
public static final int MAX_HEALTH
private java.lang.String strName
private java.lang.String strSp
private java.lang.String strDesc
private int intAge
private int intHealth
private int intMinFruit
private int intMaxFruit
private int intMaxAge
private int intFruitTime
private int intWater
| Constructor Detail |
|---|
public Sprouling(java.lang.String name,
java.lang.String species,
java.lang.String description,
int maxFruit,
int fruitTime,
int maxAge)
name - guess what?species - guess what?description - guess what?maxFruit - the maximum of fruits this plant will be able to bear, given the minimun as zero.fruitTime - the number of days between one frutification and the next.maxAge - the maximum age, given it's starting at age zero (days).
public Sprouling(java.lang.String name,
java.lang.String species,
java.lang.String description,
int minFruit,
int maxFruit,
int fruitTime,
int maxAge)
name - guess what?species - guess what?description - guess what?minFruit - the minimum of fruits this plant will be able to bear.maxFruit - the maximum of fruits this plant will be able to bear.fruitTime - the number of days between one frutification and the next.maxAge - the maximum age for this plant, given it's starting at age zero (days).
public Sprouling(java.lang.String name,
java.lang.String species,
java.lang.String description,
int age,
int health,
int minFruit,
int maxFruit,
int fruitTime,
int maxAge)
name - guess what?species - guess what?description - guess what?age - the starting age.health - the starting health.minFruit - the minimum of fruits this plant will be able to bear.maxFruit - the maximum of fruits this plant will be able to bear.fruitTime - the number of days between one frutification and the next.maxAge - the maximum age.| Method Detail |
|---|
public java.lang.String getName()
public java.lang.String getSp()
public java.lang.String getDescription()
public int getAge()
public int getHealth()
public java.lang.String getHealth(int health)
health - the health number.
public int getMinFruit()
public int getMaxFruit()
public int getFruitTime()
public int getMaxAge()
public int getWaterings()
public int harvest()
-1 if it the fruits are not ripe. *LoL*public boolean hasName()
true if it has one, false otherwise.public boolean hasSp()
true if it has one, false otherwise.public boolean hasDescription()
true if it has one, false otherwise.public boolean isAlive()
true if it is, false otherwise.public boolean isFruitTime()
true if it is day, false otherwise.public boolean canAge()
true if it can, false otherwise.public boolean canHeal()
true if the health is beneath the maximum, false false otherwise.public boolean wasWatered()
true if it was, false otherwise.public boolean isLastDay()
true if it is, false otherwise.public void setName(java.lang.String name)
name - the new name.public void setSp(java.lang.String species)
species - the new species.public void setDescription(java.lang.String desc)
desc - the new description.public void setAge(int age)
age - the new age.public void age()
public void setHealth(int health)
health - the new health.public boolean setHealthBy(int modifier)
setHealth( getHealth() + modifier ).
modifier - any integer number.
true if the sum was possible and made, false otherwise.public void heal()
public void harm()
public void kill()
private void setMinFruit(int minFruit)
minFruit - new minimum of fruits.private void setMaxFruit(int maxFruit)
maxFruit - new maximum of fruits.private void setFruitTime(int fruitTime)
private void setMaxAge(int maxAge)
maxAge - new maximum age.public void setWaterings(int waterings)
waterings - new number of waterings.public void water()
public void renew()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||