org.mars_sim.msp.simulation.structure.building
Class BuildingConfig

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

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

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

See Also:
Serialized Form

Constructor Summary
BuildingConfig(org.w3c.dom.Document buildingDoc)
          Constructor
 
Method Summary
 int getAirlockCapacity(java.lang.String buildingName)
          Gets the number of people who can use the building's airlock at once.
 double getBasePowerDownPowerRequirement(java.lang.String buildingName)
          Gets the base power-down power requirement for the building.
 double getBasePowerRequirement(java.lang.String buildingName)
          Gets the base power requirement for the building.
 int getCookCapacity(java.lang.String buildingName)
          Gets the capacity of the cooking facility in the building.
 double getCropGrowingArea(java.lang.String buildingName)
          Gets the crop growing area in the building.
 int getCropNum(java.lang.String buildingName)
          Gets the number of crops in the building.
 int getExerciseCapacity(java.lang.String buildingName)
          Gets the capacity of the exercise facility in the building.
 java.util.Map<java.lang.String,java.lang.Double> getInitialStorage(java.lang.String buildingName)
          Gets a map of the initial resources stored in this building.
 int getLifeSupportCapacity(java.lang.String buildingName)
          Gets the number of inhabitants the building's life support can handle.
 double getLifeSupportPowerRequirement(java.lang.String buildingName)
          Gets the power required for life support.
 int getLivingAccommodationBeds(java.lang.String buildingName)
          Gets the number of beds in the building's living accommodations.
 int getManufactureConcurrentProcesses(java.lang.String buildingName)
          Gets the concurrent process limit of the manufacture facility in the building.
 int getManufactureTechLevel(java.lang.String buildingName)
          Gets the tech level of the manufacture facility in the building.
 int getMedicalCareBeds(java.lang.String buildingName)
          Gets the number of beds in the building's medical care.
 int getMedicalCareTechLevel(java.lang.String buildingName)
          Gets the tech level of the building's medical care.
 double getPowerForGrowingCrop(java.lang.String buildingName)
          Gets the power required to grow a crop.
 double getPowerForSustainingCrop(java.lang.String buildingName)
          Gets the power required to sustain a crop.
 java.util.List<PowerSource> getPowerSources(java.lang.String buildingName)
          Gets a list of the building's power sources.
 int getResearchCapacity(java.lang.String buildingName)
          Gets the number of researchers who can use the building's lab at once.
 java.util.List<java.lang.String> getResearchSpecialities(java.lang.String buildingName)
          Gets a list of research specialities for the building's lab.
 int getResearchTechLevel(java.lang.String buildingName)
          Gets the research tech level of the building.
 java.util.List<ResourceProcess> getResourceProcesses(java.lang.String buildingName)
          Gets the building's resource processes.
 double getResourceProcessingPowerDown(java.lang.String buildingName)
          Gets the level of resource processing when the building is in power down mode.
 java.util.Map<java.lang.String,java.lang.Double> getStorageCapacities(java.lang.String buildingName)
          Gets a list of the building's resource capacities.
 int getVehicleCapacity(java.lang.String buildingName)
          Gets the vehicle capacity of the building.
 boolean hasCommunication(java.lang.String buildingName)
          Checks if the building has communication capabilities.
 boolean hasCooking(java.lang.String buildingName)
          Checks if the building has the cooking function.
 boolean hasDining(java.lang.String buildingName)
          Checks if the building has a dining facility.
 boolean hasEVA(java.lang.String buildingName)
          Checks if the building has EVA capabilities.
 boolean hasExercise(java.lang.String buildingName)
          Checks if the building has the exercise function.
 boolean hasFarming(java.lang.String buildingName)
          Checks if building has the farming function.
 boolean hasGroundVehicleMaintenance(java.lang.String buildingName)
          Checks if the building has the ground vehicle maintenance function.
 boolean hasLifeSupport(java.lang.String buildingName)
          Checks if the building has life support.
 boolean hasLivingAccommodations(java.lang.String buildingName)
          Checks if the building provides living accommodations.
 boolean hasManufacture(java.lang.String buildingName)
          Checks if the building has the manufacture function.
 boolean hasMedicalCare(java.lang.String buildingName)
          Checks if building has medical care capability.
 boolean hasPowerGeneration(java.lang.String buildingName)
          Checks if building has power generation capability.
 boolean hasRecreation(java.lang.String buildingName)
          Checks if the building has a recreation facility.
 boolean hasResearchLab(java.lang.String buildingName)
          Checks if the building has a research lab.
 boolean hasResourceProcessing(java.lang.String buildingName)
          Checks if the building has resource processing capability.
 boolean hasStorage(java.lang.String buildingName)
          Checks if building has storage capability.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildingConfig

public BuildingConfig(org.w3c.dom.Document buildingDoc)
Constructor

Parameters:
buildingDoc - DOM document with building configuration
Method Detail

getBasePowerRequirement

public double getBasePowerRequirement(java.lang.String buildingName)
                               throws java.lang.Exception
Gets the base power requirement for the building.

Parameters:
buildingName - the name of the building
Returns:
base power requirement (kW)
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getBasePowerDownPowerRequirement

public double getBasePowerDownPowerRequirement(java.lang.String buildingName)
                                        throws java.lang.Exception
Gets the base power-down power requirement for the building.

Parameters:
buildingName - the name of the building
Returns:
base power-down power (kW)
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasLifeSupport

public boolean hasLifeSupport(java.lang.String buildingName)
                       throws java.lang.Exception
Checks if the building has life support.

Parameters:
buildingName - the name of the building
Returns:
true if life support
Throws:
java.lang.Exception - if building name can not be found.

getLifeSupportCapacity

public int getLifeSupportCapacity(java.lang.String buildingName)
                           throws java.lang.Exception
Gets the number of inhabitants the building's life support can handle.

Parameters:
buildingName - the name of the building
Returns:
number of people
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getLifeSupportPowerRequirement

public double getLifeSupportPowerRequirement(java.lang.String buildingName)
                                      throws java.lang.Exception
Gets the power required for life support.

Parameters:
buildingName - the name of the building
Returns:
power required (kW)
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasLivingAccommodations

public boolean hasLivingAccommodations(java.lang.String buildingName)
                                throws java.lang.Exception
Checks if the building provides living accommodations.

Parameters:
buildingName - the name of the building
Returns:
true if living accommodations
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getLivingAccommodationBeds

public int getLivingAccommodationBeds(java.lang.String buildingName)
                               throws java.lang.Exception
Gets the number of beds in the building's living accommodations.

Parameters:
buildingName - the name of the building.
Returns:
number of beds.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasResearchLab

public boolean hasResearchLab(java.lang.String buildingName)
                       throws java.lang.Exception
Checks if the building has a research lab.

Parameters:
buildingName - the name of the building
Returns:
true if research lab.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getResearchTechLevel

public int getResearchTechLevel(java.lang.String buildingName)
                         throws java.lang.Exception
Gets the research tech level of the building.

Parameters:
buildingName - the name of the building
Returns:
tech level
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getResearchCapacity

public int getResearchCapacity(java.lang.String buildingName)
                        throws java.lang.Exception
Gets the number of researchers who can use the building's lab at once.

Parameters:
buildingName - the name of the building
Returns:
number of researchers
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getResearchSpecialities

public java.util.List<java.lang.String> getResearchSpecialities(java.lang.String buildingName)
                                                         throws java.lang.Exception
Gets a list of research specialities for the building's lab.

Parameters:
buildingName - the name of the building
Returns:
list of research specialities as strings.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasCommunication

public boolean hasCommunication(java.lang.String buildingName)
                         throws java.lang.Exception
Checks if the building has communication capabilities.

Parameters:
buildingName - the name of the building
Returns:
true if communication
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasEVA

public boolean hasEVA(java.lang.String buildingName)
               throws java.lang.Exception
Checks if the building has EVA capabilities.

Parameters:
buildingName - the name of the building
Returns:
true if EVA
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getAirlockCapacity

public int getAirlockCapacity(java.lang.String buildingName)
                       throws java.lang.Exception
Gets the number of people who can use the building's airlock at once.

Parameters:
buildingName - the name of the building
Returns:
airlock capacity
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasRecreation

public boolean hasRecreation(java.lang.String buildingName)
                      throws java.lang.Exception
Checks if the building has a recreation facility.

Parameters:
buildingName - the name of the building
Returns:
true if recreation
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasDining

public boolean hasDining(java.lang.String buildingName)
                  throws java.lang.Exception
Checks if the building has a dining facility.

Parameters:
buildingName - the name of the building
Returns:
true if dining
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasResourceProcessing

public boolean hasResourceProcessing(java.lang.String buildingName)
                              throws java.lang.Exception
Checks if the building has resource processing capability.

Parameters:
buildingName - the name of the building
Returns:
true if resource processing
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getResourceProcessingPowerDown

public double getResourceProcessingPowerDown(java.lang.String buildingName)
                                      throws java.lang.Exception
Gets the level of resource processing when the building is in power down mode.

Parameters:
buildingName - the name of the building
Returns:
power down level
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getResourceProcesses

public java.util.List<ResourceProcess> getResourceProcesses(java.lang.String buildingName)
                                                     throws java.lang.Exception
Gets the building's resource processes.

Parameters:
buildingName - the name of the building.
Returns:
a list of resource processes.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasStorage

public boolean hasStorage(java.lang.String buildingName)
                   throws java.lang.Exception
Checks if building has storage capability.

Parameters:
buildingName - the name of the building.
Returns:
true if storage.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getStorageCapacities

public java.util.Map<java.lang.String,java.lang.Double> getStorageCapacities(java.lang.String buildingName)
                                                                      throws java.lang.Exception
Gets a list of the building's resource capacities.

Parameters:
buildingName - the name of the building.
Returns:
list of storage capacities
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getInitialStorage

public java.util.Map<java.lang.String,java.lang.Double> getInitialStorage(java.lang.String buildingName)
                                                                   throws java.lang.Exception
Gets a map of the initial resources stored in this building.

Parameters:
buildingName - the name of the building
Returns:
map of initial resources
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasPowerGeneration

public boolean hasPowerGeneration(java.lang.String buildingName)
                           throws java.lang.Exception
Checks if building has power generation capability.

Parameters:
buildingName - the name of the building
Returns:
true if power generation
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getPowerSources

public java.util.List<PowerSource> getPowerSources(java.lang.String buildingName)
                                            throws java.lang.Exception
Gets a list of the building's power sources.

Parameters:
buildingName - the name of the building.
Returns:
list of power sources
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasMedicalCare

public boolean hasMedicalCare(java.lang.String buildingName)
                       throws java.lang.Exception
Checks if building has medical care capability.

Parameters:
buildingName - the name of the building.
Returns:
true if medical care
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getMedicalCareTechLevel

public int getMedicalCareTechLevel(java.lang.String buildingName)
                            throws java.lang.Exception
Gets the tech level of the building's medical care.

Parameters:
buildingName - the name of the building.
Returns:
tech level
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getMedicalCareBeds

public int getMedicalCareBeds(java.lang.String buildingName)
                       throws java.lang.Exception
Gets the number of beds in the building's medical care.

Parameters:
buildingName - the name of the building.
Returns:
tech level
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasFarming

public boolean hasFarming(java.lang.String buildingName)
                   throws java.lang.Exception
Checks if building has the farming function.

Parameters:
buildingName - the name of the building.
Returns:
true if farming
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getCropNum

public int getCropNum(java.lang.String buildingName)
               throws java.lang.Exception
Gets the number of crops in the building.

Parameters:
buildingName - the name of the building.
Returns:
number of crops
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getPowerForGrowingCrop

public double getPowerForGrowingCrop(java.lang.String buildingName)
                              throws java.lang.Exception
Gets the power required to grow a crop.

Parameters:
buildingName - the name of the building.
Returns:
power (kW)
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getPowerForSustainingCrop

public double getPowerForSustainingCrop(java.lang.String buildingName)
                                 throws java.lang.Exception
Gets the power required to sustain a crop.

Parameters:
buildingName - the name of the building.
Returns:
power (kW)
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getCropGrowingArea

public double getCropGrowingArea(java.lang.String buildingName)
                          throws java.lang.Exception
Gets the crop growing area in the building.

Parameters:
buildingName - the name of the building.
Returns:
crop growing area (square meters)
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasExercise

public boolean hasExercise(java.lang.String buildingName)
                    throws java.lang.Exception
Checks if the building has the exercise function.

Parameters:
buildingName - the name of the building.
Returns:
true if exercise
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getExerciseCapacity

public int getExerciseCapacity(java.lang.String buildingName)
                        throws java.lang.Exception
Gets the capacity of the exercise facility in the building.

Parameters:
buildingName - the name of the building.
Returns:
capacity for exercise
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasGroundVehicleMaintenance

public boolean hasGroundVehicleMaintenance(java.lang.String buildingName)
                                    throws java.lang.Exception
Checks if the building has the ground vehicle maintenance function.

Parameters:
buildingName - the name of the building.
Returns:
true if ground vehicle maintenance
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getVehicleCapacity

public int getVehicleCapacity(java.lang.String buildingName)
                       throws java.lang.Exception
Gets the vehicle capacity of the building.

Parameters:
buildingName - the name of the building.
Returns:
vehicle capacity
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasCooking

public boolean hasCooking(java.lang.String buildingName)
                   throws java.lang.Exception
Checks if the building has the cooking function.

Parameters:
buildingName - the name of the building.
Returns:
true if cooking
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getCookCapacity

public int getCookCapacity(java.lang.String buildingName)
                    throws java.lang.Exception
Gets the capacity of the cooking facility in the building.

Parameters:
buildingName - the name of the building.
Returns:
capacity for cooking
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

hasManufacture

public boolean hasManufacture(java.lang.String buildingName)
                       throws java.lang.Exception
Checks if the building has the manufacture function.

Parameters:
buildingName - the name of the building.
Returns:
true if manufacture.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getManufactureTechLevel

public int getManufactureTechLevel(java.lang.String buildingName)
                            throws java.lang.Exception
Gets the tech level of the manufacture facility in the building.

Parameters:
buildingName - the name of the building.
Returns:
tech level.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.

getManufactureConcurrentProcesses

public int getManufactureConcurrentProcesses(java.lang.String buildingName)
                                      throws java.lang.Exception
Gets the concurrent process limit of the manufacture facility in the building.

Parameters:
buildingName - the name of the building.
Returns:
concurrent process limit.
Throws:
java.lang.Exception - if building name can not be found or XML parsing error.