org.mars_sim.msp.simulation.person.medical
Class MedicalManager

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

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

This class provides a Factory for the Complaint class. Some of the Medical Complaints are pre-defined. Instances are accessed via a factory method since the properties of the individual complaints are loaded from the XML.

See Also:
Serialized Form

Field Summary
static java.lang.String DECOMPRESSION
          The name of the decompression complaint
static java.lang.String DEHYDRATION
          The name of the Dehydration complaint
static java.lang.String FREEZING
          The name of the freezing complaint
static java.lang.String HEAT_STROKE
          The name of the heat stroke complaint
static int MINSPERDAY
           
static java.lang.String STARVATION
          The name of the starvation complaint
static java.lang.String SUFFOCATION
          The name of the suffocation complaint
 
Constructor Summary
MedicalManager()
          Construct a new Medical Manager.
 
Method Summary
 Complaint getComplaintByName(java.lang.String name)
          This is a finder method that returns a Meidcal Complaint matching the specified name.
 Complaint getDecompression()
          Return the pre-defined Medical Complaint that signifies a Decompression conplaint.
 Complaint getDehydration()
          Return the pre-defined Medical Complaint that signifies a dehydration complaint.
 Complaint getFreezing()
          Return the pre-defined Medical Complaint that signifies a Freezing complaint.
 Complaint getHeatStroke()
          Return the pre-defined Medical Complaint that signifies a Heat Stroke complaint.
 Complaint getProbableComplaint(Person person, double time)
          Select a probable complaint to strike the Person down.
 Complaint getStarvation()
          Return the pre-defined Medical Complaint that signifies a Stavation complaint.
 Complaint getSuffocation()
          Return the pre-defined Medical Complaint that signifies a suffocation complaint.
 java.util.List<Treatment> getSupportedTreatments(int level)
          Get the supported Treatments for a Medical Facility of a particular level.
 Treatment getTreatmentByName(java.lang.String name)
          This is a finder method that returns a Meidcal Treatment matching the specified name.
 void initMedical()
          Initialise the Medical Complaints from the configuration.
 boolean isEnvironmentalComplaint(Complaint complaint)
          Checks if a health complaint is an environmental complaint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINSPERDAY

public static final int MINSPERDAY
See Also:
Constant Field Values

SUFFOCATION

public static final java.lang.String SUFFOCATION
The name of the suffocation complaint

See Also:
Constant Field Values

DEHYDRATION

public static final java.lang.String DEHYDRATION
The name of the Dehydration complaint

See Also:
Constant Field Values

STARVATION

public static final java.lang.String STARVATION
The name of the starvation complaint

See Also:
Constant Field Values

DECOMPRESSION

public static final java.lang.String DECOMPRESSION
The name of the decompression complaint

See Also:
Constant Field Values

FREEZING

public static final java.lang.String FREEZING
The name of the freezing complaint

See Also:
Constant Field Values

HEAT_STROKE

public static final java.lang.String HEAT_STROKE
The name of the heat stroke complaint

See Also:
Constant Field Values
Constructor Detail

MedicalManager

public MedicalManager()
               throws java.lang.Exception
Construct a new Medical Manager. This also constructs all the pre-defined Complaints and the user-defined ones in the XML propery file.

Throws:
java.lang.Exception - if unable to construct.
Method Detail

initMedical

public void initMedical()
                 throws java.lang.Exception
Initialise the Medical Complaints from the configuration.

Throws:
exception - if not able to initialize complaints.
java.lang.Exception

getProbableComplaint

public Complaint getProbableComplaint(Person person,
                                      double time)
Select a probable complaint to strike the Person down. This uses a random factor to select the complaint based on the probability rating. The physical characteristics of the Person are taken into account.

Parameters:
person - The person that may have a complaint.
time - the time passing (millisols).
Returns:
Possible Complaint, this maybe null.

getComplaintByName

public Complaint getComplaintByName(java.lang.String name)
This is a finder method that returns a Meidcal Complaint matching the specified name.

Parameters:
name - Name of the complaint to retrieve.
Returns:
Matched complaint, if none is found then a null.

getTreatmentByName

public Treatment getTreatmentByName(java.lang.String name)
This is a finder method that returns a Meidcal Treatment matching the specified name.

Parameters:
name - Name of the treatment to retrieve.
Returns:
Matched Treatment, if none is found then a null.

getSuffocation

public Complaint getSuffocation()
Return the pre-defined Medical Complaint that signifies a suffocation complaint.

Returns:
Medical complaint for shortage of oxygen.

getSupportedTreatments

public java.util.List<Treatment> getSupportedTreatments(int level)
Get the supported Treatments for a Medical Facility of a particular level. This will be a combination of all the Treatments of the specified level and all those lower.

Parameters:
level - Level of Medical facility.
Returns:
List of Treatments

getDehydration

public Complaint getDehydration()
Return the pre-defined Medical Complaint that signifies a dehydration complaint.

Returns:
Medical complaint for shortage of water.

getStarvation

public Complaint getStarvation()
Return the pre-defined Medical Complaint that signifies a Stavation complaint.

Returns:
Medical complaint for shortage of oxygen.

getDecompression

public Complaint getDecompression()
Return the pre-defined Medical Complaint that signifies a Decompression conplaint.

Returns:
Medical complaint for decompression.

getFreezing

public Complaint getFreezing()
Return the pre-defined Medical Complaint that signifies a Freezing complaint.

Returns:
Medical complaint for freezing.

getHeatStroke

public Complaint getHeatStroke()
Return the pre-defined Medical Complaint that signifies a Heat Stroke complaint.

Returns:
Medical complaint for heat stroke.

isEnvironmentalComplaint

public boolean isEnvironmentalComplaint(Complaint complaint)
Checks if a health complaint is an environmental complaint.

Parameters:
complaint - the complaint to check.
Returns:
true if complaint is environmental complaint.