org.mars_sim.msp.simulation.vehicle
Class VehicleConfig

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

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

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

See Also:
Serialized Form

Constructor Summary
VehicleConfig(org.w3c.dom.Document vehicleDoc)
          Constructor
 
Method Summary
 java.util.Collection<Part> getAttachableParts(java.lang.String vehicleType)
          Gets all of the parts that can be attached to a vehicle.
 double getBaseSpeed(java.lang.String vehicleType)
          Gets the vehicle's base speed.
 double getCargoCapacity(java.lang.String vehicleType, java.lang.String resource)
          Gets the vehicle's capacity for a resource.
 int getCrewSize(java.lang.String vehicleType)
          Gets the vehicle's maximum crew size.
 double getEmptyMass(java.lang.String vehicleType)
          Gets the vehicle's mass when empty.
 double getFuelEfficiency(java.lang.String vehicleType)
          Gets the vehicle's fuel efficiency.
 int getLabTechLevel(java.lang.String vehicleType)
          Gets the vehicle's lab tech level.
 java.util.List<java.lang.String> getLabTechSpecialities(java.lang.String vehicleType)
          Gets a list of the vehicle's lab tech specialities.
 int getPartAttachmentSlotNumber(java.lang.String vehicleType)
          Gets the number of part attachment slots for a vehicle.
 java.util.List<java.lang.String> getRoverNameList()
          Gets a list of rover names.
 int getSickbayBeds(java.lang.String vehicleType)
          Gets the vehicle's sickbay bed number.
 int getSickbayTechLevel(java.lang.String vehicleType)
          Gets the vehicle's sickbay tech level.
 double getTotalCapacity(java.lang.String vehicleType)
          Gets the vehicle's total cargo capacity.
 java.util.Set<java.lang.String> getVehicleTypes()
          Returns a set of all vehicle types.
 boolean hasLab(java.lang.String vehicleType)
          Checks if the vehicle has a lab.
 boolean hasPartAttachments(java.lang.String vehicleType)
          Checks if a vehicle type has the ability to attach parts.
 boolean hasSickbay(java.lang.String vehicleType)
          Checks if the vehicle has a sickbay.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VehicleConfig

public VehicleConfig(org.w3c.dom.Document vehicleDoc)
Constructor

Parameters:
vehicleDoc - DOM document with vehicle configuration.
Method Detail

getVehicleTypes

public java.util.Set<java.lang.String> getVehicleTypes()
                                                throws java.lang.Exception
Returns a set of all vehicle types.

Returns:
set of vehicle types as strings.
Throws:
java.lang.Exception - if error retrieving vehicle types.

getFuelEfficiency

public double getFuelEfficiency(java.lang.String vehicleType)
                         throws java.lang.Exception
Gets the vehicle's fuel efficiency.

Parameters:
vehicleType - the vehicle type
Returns:
fuel efficiency in km/kg.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getBaseSpeed

public double getBaseSpeed(java.lang.String vehicleType)
                    throws java.lang.Exception
Gets the vehicle's base speed.

Parameters:
vehicleType - the vehicle type
Returns:
base speed in km/hr.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getEmptyMass

public double getEmptyMass(java.lang.String vehicleType)
                    throws java.lang.Exception
Gets the vehicle's mass when empty.

Parameters:
vehicleType - the vehicle type
Returns:
empty mass in kg.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getCrewSize

public int getCrewSize(java.lang.String vehicleType)
                throws java.lang.Exception
Gets the vehicle's maximum crew size.

Parameters:
vehicleType - the vehicle type
Returns:
crew size
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getTotalCapacity

public double getTotalCapacity(java.lang.String vehicleType)
                        throws java.lang.Exception
Gets the vehicle's total cargo capacity.

Parameters:
vehicleType - the vehicle type
Returns:
total cargo capacity
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getCargoCapacity

public double getCargoCapacity(java.lang.String vehicleType,
                               java.lang.String resource)
                        throws java.lang.Exception
Gets the vehicle's capacity for a resource.

Parameters:
vehicleType - the vehicle type
resource - the resource
Returns:
vehicle capacity for resource
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

hasSickbay

public boolean hasSickbay(java.lang.String vehicleType)
                   throws java.lang.Exception
Checks if the vehicle has a sickbay.

Parameters:
vehicleType - the vehicle type
Returns:
true if sickbay
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getSickbayTechLevel

public int getSickbayTechLevel(java.lang.String vehicleType)
                        throws java.lang.Exception
Gets the vehicle's sickbay tech level.

Parameters:
vehicleType - the vehicle type
Returns:
tech level or -1 if no sickbay.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getSickbayBeds

public int getSickbayBeds(java.lang.String vehicleType)
                   throws java.lang.Exception
Gets the vehicle's sickbay bed number.

Parameters:
vehicleType - the vehicle type
Returns:
number of sickbay beds or -1 if no sickbay.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

hasLab

public boolean hasLab(java.lang.String vehicleType)
               throws java.lang.Exception
Checks if the vehicle has a lab.

Parameters:
vehicleType - the vehicle type
Returns:
true if lab
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getLabTechLevel

public int getLabTechLevel(java.lang.String vehicleType)
                    throws java.lang.Exception
Gets the vehicle's lab tech level.

Parameters:
vehicleType - the vehicle type
Returns:
lab tech level or -1 if no lab.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getLabTechSpecialities

public java.util.List<java.lang.String> getLabTechSpecialities(java.lang.String vehicleType)
                                                        throws java.lang.Exception
Gets a list of the vehicle's lab tech specialities.

Parameters:
vehicleType - the vehicle type
Returns:
list of lab tech speciality strings.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

hasPartAttachments

public boolean hasPartAttachments(java.lang.String vehicleType)
                           throws java.lang.Exception
Checks if a vehicle type has the ability to attach parts.

Parameters:
vehicleType - the vehicle type
Returns:
true if can attach parts.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getPartAttachmentSlotNumber

public int getPartAttachmentSlotNumber(java.lang.String vehicleType)
                                throws java.lang.Exception
Gets the number of part attachment slots for a vehicle.

Parameters:
vehicleType - the vehicle type.
Returns:
number of part attachment slots.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getAttachableParts

public java.util.Collection<Part> getAttachableParts(java.lang.String vehicleType)
                                              throws java.lang.Exception
Gets all of the parts that can be attached to a vehicle.

Parameters:
vehicleType - the vehicle type
Returns:
collection of parts that are attachable.
Throws:
java.lang.Exception - if vehicle type could not be found or XML parsing error.

getRoverNameList

public java.util.List<java.lang.String> getRoverNameList()
                                                  throws java.lang.Exception
Gets a list of rover names.

Returns:
list of rover names as strings.
Throws:
java.lang.Exception - if XML parsing error.