org.mars_sim.msp.simulation.malfunction
Class MalfunctionManager

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

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

The MalfunctionManager class manages the current malfunctions in a unit.

See Also:
Serialized Form

Field Summary
static java.lang.String MALFUNCTION_EVENT
           
 
Constructor Summary
MalfunctionManager(Malfunctionable entity)
          Constructor
 
Method Summary
 void accident()
          Called when the unit has an accident.
 void activeTimePassing(double time)
          Time passing while the unit is being actively used.
 void addMaintenanceWorkTime(double time)
          Add work time to maintenance.
 void addScopeString(java.lang.String scopeString)
          Add a unit scope string to the manager.
 void depleteResources(double time)
          Depletes resources due to malfunctions.
 double getAirPressureModifier()
          Gets the air flow modifier.
 double getEffectiveTimeSinceLastMaintenance()
          Gets the time the entity has been actively used since its last maintenance.
 double getEstimatedNumberOfMaintenancesPerOrbit()
          Gets the estimated number of periodic maintenances this entity will have in one Martian orbit.
 double getEstimatedNumberOfMalfunctionsPerOrbit()
          Gets the estimated number of malfunctions this entity will have in one Martian orbit.
 java.util.List<Malfunction> getEVAMalfunctions()
          Gets a list of all EVA malfunctions sorted by highest severity first.
 java.util.Map<Part,java.lang.Double> getMaintenancePartProbabilities()
           
 java.util.Map<Part,java.lang.Integer> getMaintenanceParts()
          Gets the parts needed for maintenance on this entity.
 double getMaintenanceWorkTime()
          Gets the required work time for maintenance for the entity.
 double getMaintenanceWorkTimeCompleted()
          Gets the work time completed on maintenance.
 java.util.List<Malfunction> getMalfunctions()
          Gets a list of the unit's current malfunctions.
 Malfunction getMostSeriousEmergencyMalfunction()
          Gets the most serious emergency malfunction the entity has.
 Malfunction getMostSeriousEVAMalfunction()
          Gets the most serious EVA malfunction the entity has.
 Malfunction getMostSeriousMalfunction()
          Gets the most serious malfunction the entity has.
 Malfunction getMostSeriousNormalMalfunction()
          Gets the most serious normal malfunction the entity has.
 java.util.List<Malfunction> getNormalMalfunctions()
          Gets a list of all normal malfunctions sorted by highest severity first.
 double getOxygenFlowModifier()
          Gets the oxygen flow modifier.
 java.util.Map<Part,java.lang.Double> getRepairPartProbabilities()
          Gets off of the repair part probabilities for the malfunctionable.
 double getTemperatureModifier()
          Gets the temperature modifier.
 double getTimeSinceLastMaintenance()
          Gets the time since last maintenance on entity.
 double getWaterFlowModifier()
          Gets the water flow modifier.
 boolean hasEmergencyMalfunction()
          Checks if entity has any emergency malfunctions.
 boolean hasEVAMalfunction()
          Checks if entity has any EVA malfunctions.
 boolean hasMalfunction()
          Checks if entity has a malfunction.
 boolean hasMalfunction(Malfunction malfunction)
          Checks if the entity has a given malfunction.
 boolean hasNormalMalfunction()
          Checks if entity has any normal malfunctions.
 void issueMedicalComplaints(Malfunction malfunction)
          Issues any necessary medical complaints.
 void maintainWithParts(Part part, int number)
          Adds a number of a part to the entity for maintenance.
 void setLifeSupportModifiers(double time)
          Determine life support modifiers for given time.
 void setMaintenanceWorkTime(double maintenanceWorkTime)
          Sets the required work time for maintenance for the entity.
 void timePassing(double time)
          Time passing for unit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MALFUNCTION_EVENT

public static final java.lang.String MALFUNCTION_EVENT
See Also:
Constant Field Values
Constructor Detail

MalfunctionManager

public MalfunctionManager(Malfunctionable entity)
Constructor

Parameters:
entity - the malfunctionable entity.
Method Detail

addScopeString

public void addScopeString(java.lang.String scopeString)
Add a unit scope string to the manager.

Parameters:
scopeString - a unit scope string

hasMalfunction

public boolean hasMalfunction()
Checks if entity has a malfunction.

Returns:
true if malfunction

hasMalfunction

public boolean hasMalfunction(Malfunction malfunction)
Checks if the entity has a given malfunction.

Returns:
true if entity has malfunction

hasEmergencyMalfunction

public boolean hasEmergencyMalfunction()
Checks if entity has any emergency malfunctions.

Returns:
true if emergency malfunction

hasNormalMalfunction

public boolean hasNormalMalfunction()
Checks if entity has any normal malfunctions.

Returns:
true if normal malfunction

hasEVAMalfunction

public boolean hasEVAMalfunction()
Checks if entity has any EVA malfunctions.

Returns:
true if EVA malfunction

getMalfunctions

public java.util.List<Malfunction> getMalfunctions()
Gets a list of the unit's current malfunctions.

Returns:
malfunction list

getMostSeriousMalfunction

public Malfunction getMostSeriousMalfunction()
Gets the most serious malfunction the entity has.

Returns:
malfunction

getMostSeriousEmergencyMalfunction

public Malfunction getMostSeriousEmergencyMalfunction()
Gets the most serious emergency malfunction the entity has.

Returns:
malfunction

getMostSeriousNormalMalfunction

public Malfunction getMostSeriousNormalMalfunction()
Gets the most serious normal malfunction the entity has.

Returns:
malfunction

getNormalMalfunctions

public java.util.List<Malfunction> getNormalMalfunctions()
Gets a list of all normal malfunctions sorted by highest severity first.

Returns:
list of malfunctions.

getMostSeriousEVAMalfunction

public Malfunction getMostSeriousEVAMalfunction()
Gets the most serious EVA malfunction the entity has.

Returns:
malfunction

getEVAMalfunctions

public java.util.List<Malfunction> getEVAMalfunctions()
Gets a list of all EVA malfunctions sorted by highest severity first.

Returns:
list of malfunctions.

activeTimePassing

public void activeTimePassing(double time)
Time passing while the unit is being actively used.

Parameters:
time - amount of time passing (in millisols)

timePassing

public void timePassing(double time)
Time passing for unit.

Parameters:
time - amount of time passing (in millisols)

setLifeSupportModifiers

public void setLifeSupportModifiers(double time)
Determine life support modifiers for given time.

Parameters:
time - amount of time passing (in millisols)

depleteResources

public void depleteResources(double time)
                      throws java.lang.Exception
Depletes resources due to malfunctions.

Parameters:
time - amount of time passing (in millisols)
Throws:
java.lang.Exception - if error depleting resources.

accident

public void accident()
Called when the unit has an accident.


getTimeSinceLastMaintenance

public double getTimeSinceLastMaintenance()
Gets the time since last maintenance on entity.

Returns:
time (in millisols)

getEffectiveTimeSinceLastMaintenance

public double getEffectiveTimeSinceLastMaintenance()
Gets the time the entity has been actively used since its last maintenance.

Returns:
time (in millisols)

getMaintenanceWorkTime

public double getMaintenanceWorkTime()
Gets the required work time for maintenance for the entity.

Returns:
time (in millisols)

setMaintenanceWorkTime

public void setMaintenanceWorkTime(double maintenanceWorkTime)
Sets the required work time for maintenance for the entity.

Parameters:
maintenanceWorkTime - (in millisols)

getMaintenanceWorkTimeCompleted

public double getMaintenanceWorkTimeCompleted()
Gets the work time completed on maintenance.

Returns:
time (in millisols)

addMaintenanceWorkTime

public void addMaintenanceWorkTime(double time)
Add work time to maintenance.

Parameters:
time - (in millisols)

issueMedicalComplaints

public void issueMedicalComplaints(Malfunction malfunction)
Issues any necessary medical complaints.

Parameters:
malfunction - the new malfunction

getOxygenFlowModifier

public double getOxygenFlowModifier()
Gets the oxygen flow modifier.

Returns:
modifier

getWaterFlowModifier

public double getWaterFlowModifier()
Gets the water flow modifier.

Returns:
modifier

getAirPressureModifier

public double getAirPressureModifier()
Gets the air flow modifier.

Returns:
modifier

getTemperatureModifier

public double getTemperatureModifier()
Gets the temperature modifier.

Returns:
modifier

getMaintenanceParts

public java.util.Map<Part,java.lang.Integer> getMaintenanceParts()
Gets the parts needed for maintenance on this entity.

Returns:
map of parts and their number.

maintainWithParts

public void maintainWithParts(Part part,
                              int number)
Adds a number of a part to the entity for maintenance.

Parameters:
part - the part.
number - the number used.

getRepairPartProbabilities

public java.util.Map<Part,java.lang.Double> getRepairPartProbabilities()
                                                                throws java.lang.Exception
Gets off of the repair part probabilities for the malfunctionable.

Returns:
maps of parts and probable number of parts needed per malfunction.
Throws:
java.lang.Exception - if error finding probabilities.

getMaintenancePartProbabilities

public java.util.Map<Part,java.lang.Double> getMaintenancePartProbabilities()
                                                                     throws java.lang.Exception
Throws:
java.lang.Exception

getEstimatedNumberOfMalfunctionsPerOrbit

public double getEstimatedNumberOfMalfunctionsPerOrbit()
Gets the estimated number of malfunctions this entity will have in one Martian orbit.

Returns:
number of malfunctions.

getEstimatedNumberOfMaintenancesPerOrbit

public double getEstimatedNumberOfMaintenancesPerOrbit()
Gets the estimated number of periodic maintenances this entity will have in one Martian orbit.

Returns:
number of maintenances.