org.mars_sim.msp.simulation.malfunction
Class Malfunction

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

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

The Malfunction class represents a malfunction in a vehicle, structure or equipment.

See Also:
Serialized Form

Constructor Summary
Malfunction(java.lang.String name, int severity, double probability, double emergencyWorkTime, double workTime, double EVAWorkTime, java.util.Collection<java.lang.String> scope, java.util.Map<AmountResource,java.lang.Double> resourceEffects, java.util.Map<java.lang.String,java.lang.Double> lifeSupportEffects, java.util.Map<java.lang.String,java.lang.Double> medicalComplaints)
          Constructs a Malfunction object
 
Method Summary
 double addEmergencyWorkTime(double time)
          Adds emergency work time to the malfunction.
 double addEVAWorkTime(double time)
          Adds EVA work time to the malfunction.
 double addWorkTime(double time)
          Adds work time to the malfunction.
 Malfunction getClone()
          Gets a clone of this malfunction.
 double getCompletedEmergencyWorkTime()
          Returns the completed emergency work time.
 double getCompletedEVAWorkTime()
          Returns the completed EVA work time.
 double getCompletedWorkTime()
          Returns the completed work time.
 double getEmergencyWorkTime()
          Returns the emergency work time required to repair the malfunction.
 double getEVAWorkTime()
          Returns the EVA work time required to repair the malfunction.
 java.util.Map<java.lang.String,java.lang.Double> getLifeSupportEffects()
          Gets the life support effects of the malfunction.
 java.util.Map<java.lang.String,java.lang.Double> getMedicalComplaints()
          Gets the medical complaints produced by this malfunction and their probability of occuring.
 java.lang.String getName()
          Returns the name of the malfunction.
 double getProbability()
          Returns the probability of this malfunction occuring.
 java.util.Map<Part,java.lang.Integer> getRepairParts()
          Gets the parts required to repair this malfunction.
 java.util.Map<AmountResource,java.lang.Double> getResourceEffects()
          Gets the resource effects of the malfunction.
 int getSeverity()
          Returns the severity level of the malfunction.
 double getWorkTime()
          Returns the work time required to repair the malfunction.
 boolean isFixed()
          Returns true if malfunction is fixed.
 void repairWithParts(Part part, int number)
          Repairs the malfunction with a number of a part.
 java.lang.String toString()
          Gets the string value for the object.
 boolean unitScopeMatch(java.util.Collection<java.lang.String> unitScope)
          Checks if a unit's scope strings have any matches with the malfunction's scope strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Malfunction

public Malfunction(java.lang.String name,
                   int severity,
                   double probability,
                   double emergencyWorkTime,
                   double workTime,
                   double EVAWorkTime,
                   java.util.Collection<java.lang.String> scope,
                   java.util.Map<AmountResource,java.lang.Double> resourceEffects,
                   java.util.Map<java.lang.String,java.lang.Double> lifeSupportEffects,
                   java.util.Map<java.lang.String,java.lang.Double> medicalComplaints)
Constructs a Malfunction object

Parameters:
name - name of the malfunction
Method Detail

getName

public java.lang.String getName()
Returns the name of the malfunction.

Returns:
name of the malfunction

isFixed

public boolean isFixed()
Returns true if malfunction is fixed.

Returns:
true if malfunction is fixed

getSeverity

public int getSeverity()
Returns the severity level of the malfunction.

Returns:
severity of malfunction (1 - 100)

getProbability

public double getProbability()
Returns the probability of this malfunction occuring.

Returns:
probability

getWorkTime

public double getWorkTime()
Returns the work time required to repair the malfunction.

Returns:
work time (in millisols)

getCompletedWorkTime

public double getCompletedWorkTime()
Returns the completed work time.

Returns:
completed work time (in millisols)

addWorkTime

public double addWorkTime(double time)
Adds work time to the malfunction.

Parameters:
time - work time (in millisols)
Returns:
remaining work time not used (in millisols)

getEmergencyWorkTime

public double getEmergencyWorkTime()
Returns the emergency work time required to repair the malfunction.

Returns:
emergency work time (in millisols)

getCompletedEmergencyWorkTime

public double getCompletedEmergencyWorkTime()
Returns the completed emergency work time.

Returns:
completed emergency work time (in millisols)

addEmergencyWorkTime

public double addEmergencyWorkTime(double time)
Adds emergency work time to the malfunction.

Parameters:
time - emergency work time (in millisols)
Returns:
remaining work time not used (in millisols)

getEVAWorkTime

public double getEVAWorkTime()
Returns the EVA work time required to repair the malfunction.

Returns:
EVA work time (in millisols)

getCompletedEVAWorkTime

public double getCompletedEVAWorkTime()
Returns the completed EVA work time.

Returns:
completed EVA work time (in millisols)

addEVAWorkTime

public double addEVAWorkTime(double time)
Adds EVA work time to the malfunction.

Parameters:
time - EVA work time (in millisols)
Returns:
remaining work time not used (in millisols)

unitScopeMatch

public boolean unitScopeMatch(java.util.Collection<java.lang.String> unitScope)
Checks if a unit's scope strings have any matches with the malfunction's scope strings.

Returns:
true if any matches

getResourceEffects

public java.util.Map<AmountResource,java.lang.Double> getResourceEffects()
Gets the resource effects of the malfunction.

Returns:
resource effects as name-value pairs in Map

getLifeSupportEffects

public java.util.Map<java.lang.String,java.lang.Double> getLifeSupportEffects()
Gets the life support effects of the malfunction.

Returns:
life support effects as name-value pairs in Map

getMedicalComplaints

public java.util.Map<java.lang.String,java.lang.Double> getMedicalComplaints()
Gets the medical complaints produced by this malfunction and their probability of occuring.

Returns:
medical complaints as name-value pairs in Map

getClone

public Malfunction getClone()
Gets a clone of this malfunction.

Returns:
clone of this malfunction

getRepairParts

public java.util.Map<Part,java.lang.Integer> getRepairParts()
Gets the parts required to repair this malfunction.

Returns:
map of parts and their number.

repairWithParts

public void repairWithParts(Part part,
                            int number)
Repairs the malfunction with a number of a part.

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

toString

public java.lang.String toString()
Gets the string value for the object.

Overrides:
toString in class java.lang.Object