org.mars_sim.msp.simulation.malfunction
Class MalfunctionConfig

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

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

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

See Also:
Serialized Form

Constructor Summary
MalfunctionConfig(org.w3c.dom.Document malfunctionDoc)
          Constructor
 
Method Summary
 java.util.List<Malfunction> getMalfunctionList()
          Gets a list of malfunctions
 java.lang.String[] getRepairPartNamesForMalfunction(java.lang.String malfunctionName)
          Gets all the repair part names for a malfunction.
 int getRepairPartNumber(java.lang.String malfunctionName, java.lang.String partName)
          Gets the maximum number of a repair part for a malfunction.
 int getRepairPartProbability(java.lang.String malfunctionName, java.lang.String partName)
          Gets the probability of a repair part for a malfunction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MalfunctionConfig

public MalfunctionConfig(org.w3c.dom.Document malfunctionDoc)
Constructor

Parameters:
malfunctionDoc - DOM document containing malfunction configuration.
Method Detail

getMalfunctionList

public java.util.List<Malfunction> getMalfunctionList()
                                               throws java.lang.Exception
Gets a list of malfunctions

Returns:
list of malfunctions
Throws:
java.lang.Exception - when malfunctions can not be resolved.

getRepairPartNamesForMalfunction

public java.lang.String[] getRepairPartNamesForMalfunction(java.lang.String malfunctionName)
Gets all the repair part names for a malfunction.

Parameters:
malfunctionName - the name of the malfunction.
Returns:
array of part names.

getRepairPartNumber

public int getRepairPartNumber(java.lang.String malfunctionName,
                               java.lang.String partName)
Gets the maximum number of a repair part for a malfunction.

Parameters:
malfunctionName - the name of the malfunction.
partName - the name of the part.
Returns:
the maximum number of parts.

getRepairPartProbability

public int getRepairPartProbability(java.lang.String malfunctionName,
                                    java.lang.String partName)
Gets the probability of a repair part for a malfunction.

Parameters:
malfunctionName - the name of the malfunction.
partName - the name of the part.
Returns:
the probability of the repair part.