org.mars_sim.msp.simulation.person
Class PersonConfig

java.lang.Object
  extended by org.mars_sim.msp.simulation.person.PersonConfig
All Implemented Interfaces:
java.io.Serializable

public class PersonConfig
extends java.lang.Object
implements java.io.Serializable

Provides configuration information about people units. Uses a DOM document to get the information.

See Also:
Serialized Form

Constructor Summary
PersonConfig(org.w3c.dom.Document personDoc)
          Constructor
 
Method Summary
 java.lang.String getConfiguredPersonGender(int index)
          Gets the configured person's gender.
 java.lang.String getConfiguredPersonJob(int index)
          Gets the configured person's job.
 java.lang.String getConfiguredPersonName(int index)
          Gets the configured person's name.
 java.lang.String getConfiguredPersonPersonalityType(int index)
          Gets the configured person's MBTI personality type.
 java.lang.String getConfiguredPersonSettlement(int index)
          Gets the configured person's starting settlement.
 double getDecompressionTime()
          Gets the max decompression time a person can survive.
 double getFoodConsumptionRate()
          Gets the food consumption rate.
 double getFoodDeprivationTime()
          Gets the food deprivation time.
 double getFreezingTime()
          Gets the time a person can survive below minimum temperature.
 double getGenderRatio()
          Gets the gender ratio between males and the total population on Mars.
 double getMaxTemperature()
          Gets the maximum temperature a person can tolerate.
 double getMinAirPressure()
          Gets the required air pressure.
 double getMinTemperature()
          Gets the minimum temperature a person can tolerate.
 java.util.Map<java.lang.String,java.lang.Integer> getNaturalAttributeMap(int index)
          Gets a map of the configured person's natural attributes.
 int getNumberOfConfiguredPeople()
          Gets the number of people configured for the simulation.
 double getOxygenConsumptionRate()
          Gets the oxygen consumption rate.
 double getOxygenDeprivationTime()
          Gets the oxygen deprivation time.
 double getPersonalityTypePercentage(java.lang.String personalityType)
          Gets the average percentage for a particular MBTI personality type for settlers.
 java.lang.String getPersonGender(java.lang.String name)
          Gets the gender of a given person name.
 java.util.List<java.lang.String> getPersonNameList()
          Gets a list of person names for settlers.
 java.util.Map<java.lang.String,java.lang.Integer> getRelationshipMap(int index)
          Gets a map of the configured person's relationships.
 java.util.Map<java.lang.String,java.lang.Integer> getSkillMap(int index)
          Gets a map of the configured person's skills.
 double getStarvationStartTime()
          Gets the starvation start time.
 double getStressBreakdownChance()
          Gets the base percent chance that a person will have a stress breakdown when at maximum stress.
 double getWaterConsumptionRate()
          Gets the water consumption rate.
 double getWaterDeprivationTime()
          Gets the water deprivation time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersonConfig

public PersonConfig(org.w3c.dom.Document personDoc)
Constructor

Parameters:
personDoc - the person congif DOM document.
Method Detail

getPersonNameList

public java.util.List<java.lang.String> getPersonNameList()
                                                   throws java.lang.Exception
Gets a list of person names for settlers.

Returns:
List of person names.
Throws:
java.lang.Exception - if person names could not be found.

getPersonGender

public java.lang.String getPersonGender(java.lang.String name)
                                 throws java.lang.Exception
Gets the gender of a given person name.

Parameters:
name - the name of the person
Returns:
the gender of the person name ("male", "female", "unknown")
Throws:
java.lang.Exception - if person names could not be found.

getOxygenConsumptionRate

public double getOxygenConsumptionRate()
                                throws java.lang.Exception
Gets the oxygen consumption rate.

Returns:
oxygen rate (kg/sol)
Throws:
java.lang.Exception - if consumption rate could not be found.

getWaterConsumptionRate

public double getWaterConsumptionRate()
                               throws java.lang.Exception
Gets the water consumption rate.

Returns:
water rate (kg/sol)
Throws:
java.lang.Exception - if consumption rate could not be found.

getFoodConsumptionRate

public double getFoodConsumptionRate()
                              throws java.lang.Exception
Gets the food consumption rate.

Returns:
food rate (kg/sol)
Throws:
java.lang.Exception - if consumption rate could not be found.

getOxygenDeprivationTime

public double getOxygenDeprivationTime()
                                throws java.lang.Exception
Gets the oxygen deprivation time.

Returns:
oxygen time in millisols.
Throws:
java.lang.Exception - if oxygen deprivation time could not be found.

getWaterDeprivationTime

public double getWaterDeprivationTime()
                               throws java.lang.Exception
Gets the water deprivation time.

Returns:
water time in sols.
Throws:
java.lang.Exception - if water deprivation time could not be found.

getFoodDeprivationTime

public double getFoodDeprivationTime()
                              throws java.lang.Exception
Gets the food deprivation time.

Returns:
food time in sols.
Throws:
java.lang.Exception - if food deprivation time could not be found.

getStarvationStartTime

public double getStarvationStartTime()
                              throws java.lang.Exception
Gets the starvation start time.

Returns:
starvation time in sols.
Throws:
java.lang.Exception - if starvation start time could not be found.

getMinAirPressure

public double getMinAirPressure()
                         throws java.lang.Exception
Gets the required air pressure.

Returns:
air pressure in atm.
Throws:
java.lang.Exception - if air pressure could not be found.

getDecompressionTime

public double getDecompressionTime()
                            throws java.lang.Exception
Gets the max decompression time a person can survive.

Returns:
decompression time in millisols.
Throws:
java.lang.Exception - if decompression time could not be found.

getMinTemperature

public double getMinTemperature()
                         throws java.lang.Exception
Gets the minimum temperature a person can tolerate.

Returns:
temperature in celsius
Throws:
java.lang.Exception - if min temperature cannot be found.

getMaxTemperature

public double getMaxTemperature()
                         throws java.lang.Exception
Gets the maximum temperature a person can tolerate.

Returns:
temperature in celsius
Throws:
java.lang.Exception - if max temperature cannot be found.

getFreezingTime

public double getFreezingTime()
                       throws java.lang.Exception
Gets the time a person can survive below minimum temperature.

Returns:
freezing time in millisols.
Throws:
java.lang.Exception - if freezing time could not be found.

getStressBreakdownChance

public double getStressBreakdownChance()
                                throws java.lang.Exception
Gets the base percent chance that a person will have a stress breakdown when at maximum stress.

Returns:
percent chance of a breakdown per millisol.
Throws:
java.lang.Exception - if stress breakdown time could not be found.

getGenderRatio

public double getGenderRatio()
                      throws java.lang.Exception
Gets the gender ratio between males and the total population on Mars.

Returns:
gender ratio between males and total population.
Throws:
java.lang.Exception - if gender ratio could not be found.

getPersonalityTypePercentage

public double getPersonalityTypePercentage(java.lang.String personalityType)
                                    throws java.lang.Exception
Gets the average percentage for a particular MBTI personality type for settlers.

Parameters:
personalityType - the MBTI personality type
Returns:
percentage
Throws:
java.lang.Exception - if personality type could not be found.

getNumberOfConfiguredPeople

public int getNumberOfConfiguredPeople()
                                throws java.lang.Exception
Gets the number of people configured for the simulation.

Returns:
number of people.
Throws:
java.lang.Exception - if error in XML parsing.

getConfiguredPersonName

public java.lang.String getConfiguredPersonName(int index)
                                         throws java.lang.Exception
Gets the configured person's name.

Parameters:
index - the person's index.
Returns:
name or null if none.
Throws:
java.lang.Exception - if error in XML parsing.

getConfiguredPersonGender

public java.lang.String getConfiguredPersonGender(int index)
                                           throws java.lang.Exception
Gets the configured person's gender.

Parameters:
index - the person's index.
Returns:
"male", "female" or null if not found.
Throws:
java.lang.Exception - if error in XML parsing.

getConfiguredPersonPersonalityType

public java.lang.String getConfiguredPersonPersonalityType(int index)
                                                    throws java.lang.Exception
Gets the configured person's MBTI personality type.

Parameters:
index - the person's index.
Returns:
four character string for MBTI ex. "ISTJ". Return null if none.
Throws:
java.lang.Exception - if error in XML parsing.

getConfiguredPersonSettlement

public java.lang.String getConfiguredPersonSettlement(int index)
                                               throws java.lang.Exception
Gets the configured person's starting settlement.

Parameters:
index - the person's index.
Returns:
the settlement name or null if none.
Throws:
java.lang.Exception - if error in XML parsing.

getConfiguredPersonJob

public java.lang.String getConfiguredPersonJob(int index)
                                        throws java.lang.Exception
Gets the configured person's job.

Parameters:
index - the person's index.
Returns:
the job name or null if none.
Throws:
java.lang.Exception - if error in XML parsing.

getNaturalAttributeMap

public java.util.Map<java.lang.String,java.lang.Integer> getNaturalAttributeMap(int index)
                                                                         throws java.lang.Exception
Gets a map of the configured person's natural attributes.

Parameters:
index - the person's index.
Returns:
map of natural attributes (empty map if not found).
Throws:
java.lang.Exception - if error in XML parsing.

getSkillMap

public java.util.Map<java.lang.String,java.lang.Integer> getSkillMap(int index)
                                                              throws java.lang.Exception
Gets a map of the configured person's skills.

Parameters:
index - the person's index.
Returns:
map of skills (empty map if not found).
Throws:
java.lang.Exception - if error in XML parsing.

getRelationshipMap

public java.util.Map<java.lang.String,java.lang.Integer> getRelationshipMap(int index)
                                                                     throws java.lang.Exception
Gets a map of the configured person's relationships.

Parameters:
index - the person's index.
Returns:
map of relationships (key: person name, value: opinion (0 - 100)) (empty map if not found).
Throws:
java.lang.Exception - if error in XML parsing.