org.mars_sim.msp.core.vehicle
Class VehicleConfig

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

public class VehicleConfig
extends Object
implements Serializable

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

See Also:
Serialized Form

Constructor Summary
VehicleConfig(org.jdom.Document vehicleDoc)
          Constructor
 
Method Summary
 void destroy()
          Prepare object for garbage collection.
 Collection<Part> getAttachableParts(String vehicleType)
          Gets all of the parts that can be attached to a vehicle.
 double getBaseSpeed(String vehicleType)
          Gets the vehicle's base speed.
 double getCargoCapacity(String vehicleType, String resource)
          Gets the vehicle's capacity for a resource.
 int getCrewSize(String vehicleType)
          Gets the vehicle's maximum crew size.
 double getEmptyMass(String vehicleType)
          Gets the vehicle's mass when empty.
 double getFuelEfficiency(String vehicleType)
          Gets the vehicle's fuel efficiency.
 int getLabTechLevel(String vehicleType)
          Gets the vehicle's lab tech level.
 List<String> getLabTechSpecialities(String vehicleType)
          Gets a list of the vehicle's lab tech specialities.
 double getLength(String vehicleType)
          Gets the vehicle's length.
 int getPartAttachmentSlotNumber(String vehicleType)
          Gets the number of part attachment slots for a vehicle.
 List<String> getRoverNameList()
          Gets a list of rover names.
 int getSickbayBeds(String vehicleType)
          Gets the vehicle's sickbay bed number.
 int getSickbayTechLevel(String vehicleType)
          Gets the vehicle's sickbay tech level.
 double getTotalCapacity(String vehicleType)
          Gets the vehicle's total cargo capacity.
 Set<String> getVehicleTypes()
          Returns a set of all vehicle types.
 double getWidth(String vehicleType)
          Gets the vehicle's width.
 boolean hasLab(String vehicleType)
          Checks if the vehicle has a lab.
 boolean hasPartAttachments(String vehicleType)
          Checks if a vehicle type has the ability to attach parts.
 boolean hasSickbay(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.jdom.Document vehicleDoc)
Constructor

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

getVehicleTypes

public Set<String> getVehicleTypes()
Returns a set of all vehicle types.

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

getWidth

public double getWidth(String vehicleType)
Gets the vehicle's width.

Parameters:
vehicleType - the vehicle type.
Returns:
width (meters).

getLength

public double getLength(String vehicleType)
Gets the vehicle's length.

Parameters:
vehicleType - the vehicle type.
Returns:
length (meters).

getFuelEfficiency

public double getFuelEfficiency(String vehicleType)
Gets the vehicle's fuel efficiency.

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

getBaseSpeed

public double getBaseSpeed(String vehicleType)
Gets the vehicle's base speed.

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

getEmptyMass

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

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

getCrewSize

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

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

getTotalCapacity

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

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

getCargoCapacity

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

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

hasSickbay

public boolean hasSickbay(String vehicleType)
Checks if the vehicle has a sickbay.

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

getSickbayTechLevel

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

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

getSickbayBeds

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

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

hasLab

public boolean hasLab(String vehicleType)
Checks if the vehicle has a lab.

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

getLabTechLevel

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

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

getLabTechSpecialities

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

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

hasPartAttachments

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

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

getPartAttachmentSlotNumber

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

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

getAttachableParts

public Collection<Part> getAttachableParts(String vehicleType)
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:
Exception - if vehicle type could not be found or XML parsing error.

getRoverNameList

public List<String> getRoverNameList()
Gets a list of rover names.

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

destroy

public void destroy()
Prepare object for garbage collection.



Copyright © 2009-2013. All Rights Reserved.