org.mars_sim.msp.simulation.structure
Class SettlementConfig

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

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

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

See Also:
Serialized Form

Field Summary
static java.lang.String RANDOM
           
 
Constructor Summary
SettlementConfig(org.w3c.dom.Document settlementDoc, PartPackageConfig partPackageConfig)
          Constructor
 
Method Summary
 java.lang.String getInitialSettlementLatitude(int index)
          Gets the latitude of an initial settlement, or 'random' if the longitude is to be randomly determined.
 java.lang.String getInitialSettlementLongitude(int index)
          Gets the longitude of an initial settlement, or 'random' if the longitude is to be randomly determined.
 java.lang.String getInitialSettlementName(int index)
          Gets the name of an initial settlement or 'random' if the name is to chosen randomly from the settlement name list.
 java.lang.String getInitialSettlementTemplate(int index)
          Gets the template used by an initial settlement.
 int getNumberOfInitialSettlements()
          Gets the number of initial settlements.
 int getNumberOfTemplateResupplies(java.lang.String templateName)
          Gets the number of resupplies for a settlement template.
 java.util.List<java.lang.String> getSettlementNameList()
          Gets a list of possible settlement names.
 java.util.List<java.lang.String> getTemplateBuildingTypes(java.lang.String templateName)
          Gets the building types in a settlement template.
 java.util.Map<java.lang.String,java.lang.Integer> getTemplateEquipment(java.lang.String templateName)
          Gets the equipment types in a settlement template.
 java.util.Map<Part,java.lang.Integer> getTemplateParts(java.lang.String templateName)
          Gets the part types in a settlement template.
 java.util.Map<AmountResource,java.lang.Double> getTemplateResources(java.lang.String templateName)
          Gets the resource types in a settlement template.
 double getTemplateResupplyArrivalTime(java.lang.String templateName, int index)
          Gets the arrival time of a settlement resupply for a particular settlement template.
 java.lang.String getTemplateResupplyName(java.lang.String templateName, int index)
          Gets the name of a settlement resupply for a particular settlement template.
 java.util.List<java.lang.String> getTemplateVehicleTypes(java.lang.String templateName)
          Gets the vehicle types in a settlement template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM

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

SettlementConfig

public SettlementConfig(org.w3c.dom.Document settlementDoc,
                        PartPackageConfig partPackageConfig)
                 throws java.lang.Exception
Constructor

Parameters:
settlementDoc - DOM document with settlement configuration.
partPackageConfig - the part package configuration.
Throws:
java.lang.Exception - if error reading XML document.
Method Detail

getTemplateBuildingTypes

public java.util.List<java.lang.String> getTemplateBuildingTypes(java.lang.String templateName)
Gets the building types in a settlement template. If there are multiple buildings of the same type, they are separately listed.

Parameters:
templateName - the name of the settlement template.
Returns:
list of building types as strings.

getTemplateVehicleTypes

public java.util.List<java.lang.String> getTemplateVehicleTypes(java.lang.String templateName)
Gets the vehicle types in a settlement template. If there are multiple vehicles of the same type, they are separately listed.

Parameters:
templateName - the name of the settlement template.
Returns:
list of vehicle types as strings.

getTemplateEquipment

public java.util.Map<java.lang.String,java.lang.Integer> getTemplateEquipment(java.lang.String templateName)
Gets the equipment types in a settlement template.

Parameters:
templateName - the name of the settlement template.
Returns:
map of equipment types and number.

getTemplateResources

public java.util.Map<AmountResource,java.lang.Double> getTemplateResources(java.lang.String templateName)
Gets the resource types in a settlement template.

Parameters:
templateName - the name of the settlement template.
Returns:
map of resources and amounts.

getTemplateParts

public java.util.Map<Part,java.lang.Integer> getTemplateParts(java.lang.String templateName)
Gets the part types in a settlement template.

Parameters:
templateName - the name of the settlement template.
Returns:
map of parts and number.

getNumberOfTemplateResupplies

public int getNumberOfTemplateResupplies(java.lang.String templateName)
Gets the number of resupplies for a settlement template.

Parameters:
templateName - the name of the settlement template.
Returns:
number of resupplies

getTemplateResupplyName

public java.lang.String getTemplateResupplyName(java.lang.String templateName,
                                                int index)
Gets the name of a settlement resupply for a particular settlement template.

Parameters:
templateName - the name of the settlement template.
index - the index of the resupply mission.
Returns:
name of the resupply mission.

getTemplateResupplyArrivalTime

public double getTemplateResupplyArrivalTime(java.lang.String templateName,
                                             int index)
Gets the arrival time of a settlement resupply for a particular settlement template.

Parameters:
templateName - the name of the settlement template.
index - then index of the resupply mission.
Returns:
arrival time for the resupply mission (in Sols from when simulation starts).

getNumberOfInitialSettlements

public int getNumberOfInitialSettlements()
Gets the number of initial settlements.

Returns:
number of settlements.

getInitialSettlementName

public java.lang.String getInitialSettlementName(int index)
Gets the name of an initial settlement or 'random' if the name is to chosen randomly from the settlement name list.

Parameters:
index - the index of the initial settlement.
Returns:
settlement name

getInitialSettlementTemplate

public java.lang.String getInitialSettlementTemplate(int index)
Gets the template used by an initial settlement.

Parameters:
index - the index of the initial settlement.
Returns:
settlement template name.

getInitialSettlementLongitude

public java.lang.String getInitialSettlementLongitude(int index)
Gets the longitude of an initial settlement, or 'random' if the longitude is to be randomly determined.

Parameters:
index - the index of the initial settlement.
Returns:
longitude of the settlement as a string. Example: '0.0 W'

getInitialSettlementLatitude

public java.lang.String getInitialSettlementLatitude(int index)
Gets the latitude of an initial settlement, or 'random' if the longitude is to be randomly determined.

Parameters:
index - the index of the initial settlement.
Returns:
latitude of the settlement as a string. Example: '0.0 N'

getSettlementNameList

public java.util.List<java.lang.String> getSettlementNameList()
                                                       throws java.lang.Exception
Gets a list of possible settlement names.

Returns:
list of settlement names as strings
Throws:
java.lang.Exception