org.mars_sim.msp.core.person
Class PhysicalCondition

java.lang.Object
  extended by org.mars_sim.msp.core.person.PhysicalCondition
All Implemented Interfaces:
Serializable

public class PhysicalCondition
extends Object
implements Serializable

This class represents the Physical Condition of a Person. It models the Persons health and physical characteristics.

See Also:
Serialized Form

Field Summary
static double ACCIDENT_STRESS
           
static String DEATH_EVENT
           
static String FATIGUE_EVENT
           
static String HUNGER_EVENT
           
static String ILLNESS_EVENT
           
static String PERFORMANCE_EVENT
           
static String STRESS_EVENT
           
 
Constructor Summary
PhysicalCondition(Person newPerson)
          Constructor
 
Method Summary
 void addMedicalComplaint(Complaint complaint)
          Adds a new medical complaint to the person.
 void addMedication(Medication medication)
          Adds a medication that affects the person.
 void consumeFood(double amount)
          Person consumes a given amount of food not taken from local container.
 void consumeFood(double amount, Unit container)
          Person consumes given amount of food
 void destroy()
          Prepare object for garbage collection.
 DeathInfo getDeathDetails()
          Get the details of this Person's death.
 double getFatigue()
          Gets the person's fatigue level
static double getFoodConsumptionRate()
          Gets the food consumption rate per Sol.
 String getHealthSituation()
          Get a string description of the most serious health situation.
 double getHunger()
          Gets the person's hunger level
 List<Medication> getMedicationList()
          Gets a list of medication affecting the person.
 Complaint getMostSerious()
          Gets the most serious illness.
static double getOxygenConsumptionRate()
          Gets the oxygen consumption rate per Sol.
 double getPerformanceFactor()
          Get the performance factor that effect Person with the complaint.
 Collection<HealthProblem> getProblems()
          The collection of known Medical Problems.
 double getStress()
          Gets the person's stress level
static double getWaterConsumptionRate()
          Gets the water consumption rate per Sol.
 boolean hasMedication(String medicationName)
          Checks if the person is affected by the given medication.
 boolean hasSeriousMedicalProblems()
          Checks if the person has any serious medical problems.
 boolean isDead()
          Checks if the person is dead.
 void setDead(HealthProblem illness)
          This Person is now dead.
 void setFatigue(double newFatigue)
          Define the fatigue setting for this person
 void setHunger(double newHunger)
          Define the hunger setting for this person
 void setStress(double newStress)
          Sets the person's stress level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FATIGUE_EVENT

public static final String FATIGUE_EVENT
See Also:
Constant Field Values

HUNGER_EVENT

public static final String HUNGER_EVENT
See Also:
Constant Field Values

STRESS_EVENT

public static final String STRESS_EVENT
See Also:
Constant Field Values

PERFORMANCE_EVENT

public static final String PERFORMANCE_EVENT
See Also:
Constant Field Values

ILLNESS_EVENT

public static final String ILLNESS_EVENT
See Also:
Constant Field Values

DEATH_EVENT

public static final String DEATH_EVENT
See Also:
Constant Field Values

ACCIDENT_STRESS

public static final double ACCIDENT_STRESS
See Also:
Constant Field Values
Constructor Detail

PhysicalCondition

public PhysicalCondition(Person newPerson)
Constructor

Parameters:
newPerson - The person requiring a physical presence.
Method Detail

addMedicalComplaint

public void addMedicalComplaint(Complaint complaint)
Adds a new medical complaint to the person.

Parameters:
complaint - the new medical complaint

consumeFood

public void consumeFood(double amount,
                        Unit container)
Person consumes given amount of food

Parameters:
amount - amount of food to consume (in kg).
container - unit to get food from
Throws:
Exception - if error consuming food.

consumeFood

public void consumeFood(double amount)
Person consumes a given amount of food not taken from local container.

Parameters:
amount - the amount of food to consume (in kg).

getDeathDetails

public DeathInfo getDeathDetails()
Get the details of this Person's death.

Returns:
Deatial of the death, will be null if person os still alive.

getFatigue

public double getFatigue()
Gets the person's fatigue level

Returns:
person's fatigue

getPerformanceFactor

public double getPerformanceFactor()
Get the performance factor that effect Person with the complaint.

Returns:
The value is between 0 -> 1.

setFatigue

public void setFatigue(double newFatigue)
Define the fatigue setting for this person

Parameters:
newFatigue - New fatigue.

getHunger

public double getHunger()
Gets the person's hunger level

Returns:
person's hunger

setHunger

public void setHunger(double newHunger)
Define the hunger setting for this person

Parameters:
newHunger - New hunger.

getStress

public double getStress()
Gets the person's stress level

Returns:
stress (0.0 to 100.0)

setStress

public void setStress(double newStress)
Sets the person's stress level.

Parameters:
newStress - the new stress level (0.0 to 100.0)

setDead

public void setDead(HealthProblem illness)
This Person is now dead.

Parameters:
illness - The compliant that makes person dead.

isDead

public boolean isDead()
Checks if the person is dead.

Returns:
true if dead

getHealthSituation

public String getHealthSituation()
Get a string description of the most serious health situation.

Returns:
A string containing the current illness if any.

getMostSerious

public Complaint getMostSerious()
Gets the most serious illness.

Returns:
most serious illness

getProblems

public Collection<HealthProblem> getProblems()
The collection of known Medical Problems.


hasSeriousMedicalProblems

public boolean hasSeriousMedicalProblems()
Checks if the person has any serious medical problems.

Returns:
true if serious medical problems

getOxygenConsumptionRate

public static double getOxygenConsumptionRate()
Gets the oxygen consumption rate per Sol.

Returns:
oxygen consumed (kg/Sol)
Throws:
Exception - if error in configuration.

getWaterConsumptionRate

public static double getWaterConsumptionRate()
Gets the water consumption rate per Sol.

Returns:
water consumed (kg/Sol)
Throws:
Exception - if error in configuration.

getFoodConsumptionRate

public static double getFoodConsumptionRate()
Gets the food consumption rate per Sol.

Returns:
food consumed (kg/Sol)
Throws:
Exception - if error in configuration.

getMedicationList

public List<Medication> getMedicationList()
Gets a list of medication affecting the person.

Returns:
list of medication.

hasMedication

public boolean hasMedication(String medicationName)
Checks if the person is affected by the given medication.

Parameters:
medicationName - the name of the medication.
Returns:
true if person is affected by it.

addMedication

public void addMedication(Medication medication)
Adds a medication that affects the person.

Parameters:
medication - the medication to add.

destroy

public void destroy()
Prepare object for garbage collection.



Copyright © 2009-2013. All Rights Reserved.