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

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

public class BuildingConfig
extends Object
implements Serializable

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

See Also:
Serialized Form

Constructor Summary
BuildingConfig(org.jdom.Document buildingDoc)
          Constructor
 
Method Summary
 void destroy()
          Prepare object for garbage collection.
 int getAirlockCapacity(String buildingName)
          Gets the number of people who can use the building's airlock at once.
 int getAstronomicalObservationCapacity(String buildingName)
          Gets capacity of the astronomy facility in the building.
 double getAstronomicalObservationPowerRequirement(String buildingName)
          Gets the power required by the astronomical observation function.
 int getAstronomicalObservationTechLevel(String buildingName)
          Gets the tech level of the astronomy facility in the building.
 double getBasePowerDownPowerRequirement(String buildingName)
          Gets the base power-down power requirement for the building.
 double getBasePowerRequirement(String buildingName)
          Gets the base power requirement for the building.
 Set<String> getBuildingNames()
          Gets a set of all building names.
 int getCookCapacity(String buildingName)
          Gets the capacity of the cooking facility in the building.
 double getCropGrowingArea(String buildingName)
          Gets the crop growing area in the building.
 int getCropNum(String buildingName)
          Gets the number of crops in the building.
 int getDiningCapacity(String buildingName)
          Gets the capacity for dining at the building.
 int getEarthReturnCrewCapacity(String buildingName)
          Gets the Earth return crew capacity of a building.
 int getExerciseCapacity(String buildingName)
          Gets the capacity of the exercise facility in the building.
 Map<AmountResource,Double> getInitialStorage(String buildingName)
          Gets a map of the initial resources stored in this building.
 double getLength(String buildingName)
          Gets the building length.
 int getLifeSupportCapacity(String buildingName)
          Gets the number of inhabitants the building's life support can handle.
 double getLifeSupportPowerRequirement(String buildingName)
          Gets the power required for life support.
 int getLivingAccommodationBeds(String buildingName)
          Gets the number of beds in the building's living accommodations.
 int getManagementPopulationSupport(String buildingName)
          Gets the management population support for a building.
 int getManufactureConcurrentProcesses(String buildingName)
          Gets the concurrent process limit of the manufacture facility in the building.
 int getManufactureTechLevel(String buildingName)
          Gets the tech level of the manufacture facility in the building.
 int getMedicalCareBeds(String buildingName)
          Gets the number of beds in the building's medical care.
 int getMedicalCareTechLevel(String buildingName)
          Gets the tech level of the building's medical care.
 Point2D.Double getParkingLocation(String buildingName, int parkingIndex)
          Gets the relative location in the building of a parking location.
 int getParkingLocationNumber(String buildingName)
          Gets the number of parking locations in the building.
 double getPowerForGrowingCrop(String buildingName)
          Gets the power required to grow a crop.
 double getPowerForSustainingCrop(String buildingName)
          Gets the power required to sustain a crop.
 List<PowerSource> getPowerSources(String buildingName)
          Gets a list of the building's power sources.
 double getPowerStorageCapacity(String buildingName)
          Gets the power storage capacity of the building.
 int getRecreationPopulationSupport(String buildingName)
          Gets the population number supported by the building's recreation function.
 int getResearchCapacity(String buildingName)
          Gets the number of researchers who can use the building's lab at once.
 List<String> getResearchSpecialities(String buildingName)
          Gets a list of research specialities for the building's lab.
 int getResearchTechLevel(String buildingName)
          Gets the research tech level of the building.
 List<ResourceProcess> getResourceProcesses(String buildingName)
          Gets the building's resource processes.
 double getResourceProcessingPowerDown(String buildingName)
          Gets the level of resource processing when the building is in power down mode.
 Map<AmountResource,Double> getStorageCapacities(String buildingName)
          Gets a list of the building's resource capacities.
 int getVehicleCapacity(String buildingName)
          Gets the vehicle capacity of the building.
 double getWidth(String buildingName)
          Gets the building width.
 boolean hasAstronomicalObservation(String buildingName)
          Checks if the building has an astronomical observation function.
 boolean hasCommunication(String buildingName)
          Checks if the building has communication capabilities.
 boolean hasCooking(String buildingName)
          Checks if the building has the cooking function.
 boolean hasDining(String buildingName)
          Checks if the building has a dining facility.
 boolean hasEarthReturn(String buildingName)
          Checks if the building has an Earth return function.
 boolean hasEVA(String buildingName)
          Checks if the building has EVA capabilities.
 boolean hasExercise(String buildingName)
          Checks if the building has the exercise function.
 boolean hasFarming(String buildingName)
          Checks if building has the farming function.
 boolean hasGroundVehicleMaintenance(String buildingName)
          Checks if the building has the ground vehicle maintenance function.
 boolean hasLifeSupport(String buildingName)
          Checks if the building has life support.
 boolean hasLivingAccommodations(String buildingName)
          Checks if the building provides living accommodations.
 boolean hasManagement(String buildingName)
          Checks if the building has the management function.
 boolean hasManufacture(String buildingName)
          Checks if the building has the manufacture function.
 boolean hasMedicalCare(String buildingName)
          Checks if building has medical care capability.
 boolean hasPowerGeneration(String buildingName)
          Checks if building has power generation capability.
 boolean hasPowerStorage(String buildingName)
          Checks if building has power storage capability.
 boolean hasRecreation(String buildingName)
          Checks if the building has a recreation facility.
 boolean hasResearchLab(String buildingName)
          Checks if the building has a research lab.
 boolean hasResourceProcessing(String buildingName)
          Checks if the building has resource processing capability.
 boolean hasStorage(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.jdom.Document buildingDoc)
Constructor

Parameters:
buildingDoc - DOM document with building configuration
Method Detail

getBuildingNames

public Set<String> getBuildingNames()
Gets a set of all building names.

Returns:
set of building names.

getWidth

public double getWidth(String buildingName)
Gets the building width.

Parameters:
buildingName - the name of the building.
Returns:
building width (meters).
Throws:
Exception - if building name cannot be found or XML parsing error.

getLength

public double getLength(String buildingName)
Gets the building length.

Parameters:
buildingName - the name of the building.
Returns:
building length (meters).
Throws:
Exception - if building name cannot be found or XML parsing error.

getBasePowerRequirement

public double getBasePowerRequirement(String buildingName)
Gets the base power requirement for the building.

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

getBasePowerDownPowerRequirement

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

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

hasLifeSupport

public boolean hasLifeSupport(String buildingName)
Checks if the building has life support.

Parameters:
buildingName - the name of the building
Returns:
true if life support
Throws:
Exception - if building name cannot be found.

getLifeSupportCapacity

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

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

getLifeSupportPowerRequirement

public double getLifeSupportPowerRequirement(String buildingName)
Gets the power required for life support.

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

hasLivingAccommodations

public boolean hasLivingAccommodations(String buildingName)
Checks if the building provides living accommodations.

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

getLivingAccommodationBeds

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

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

hasResearchLab

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

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

getResearchTechLevel

public int getResearchTechLevel(String buildingName)
Gets the research tech level of the building.

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

getResearchCapacity

public int getResearchCapacity(String buildingName)
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:
Exception - if building name cannot be found or XML parsing error.

getResearchSpecialities

public List<String> getResearchSpecialities(String buildingName)
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:
Exception - if building name cannot be found or XML parsing error.

hasCommunication

public boolean hasCommunication(String buildingName)
Checks if the building has communication capabilities.

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

hasEVA

public boolean hasEVA(String buildingName)
Checks if the building has EVA capabilities.

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

getAirlockCapacity

public int getAirlockCapacity(String buildingName)
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:
Exception - if building name cannot be found or XML parsing error.

hasRecreation

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

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

getRecreationPopulationSupport

public int getRecreationPopulationSupport(String buildingName)
Gets the population number supported by the building's recreation function.

Parameters:
buildingName - the name of the building.
Returns:
population support.

hasDining

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

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

getDiningCapacity

public int getDiningCapacity(String buildingName)
Gets the capacity for dining at the building.

Parameters:
buildingName - the name of the building.
Returns:
capacity.

hasResourceProcessing

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

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

getResourceProcessingPowerDown

public double getResourceProcessingPowerDown(String buildingName)
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:
Exception - if building name cannot be found or XML parsing error.

getResourceProcesses

public List<ResourceProcess> getResourceProcesses(String buildingName)
Gets the building's resource processes.

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

hasStorage

public boolean hasStorage(String buildingName)
Checks if building has storage capability.

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

getStorageCapacities

public Map<AmountResource,Double> getStorageCapacities(String buildingName)
Gets a list of the building's resource capacities.

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

getInitialStorage

public Map<AmountResource,Double> getInitialStorage(String buildingName)
Gets a map of the initial resources stored in this building.

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

hasPowerGeneration

public boolean hasPowerGeneration(String buildingName)
Checks if building has power generation capability.

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

getPowerSources

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

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

hasPowerStorage

public boolean hasPowerStorage(String buildingName)
Checks if building has power storage capability.

Parameters:
buildingName - the name of the building
Returns:
true if power storage
Throws:
Exception - if building name cannot be found or XML parsing error.

getPowerStorageCapacity

public double getPowerStorageCapacity(String buildingName)
Gets the power storage capacity of the building.

Parameters:
buildingName - the name of the building.
Returns:
power storage capacity (kW hr).
Throws:
Exception - if building name cannot be found or XML parsing error.

hasMedicalCare

public boolean hasMedicalCare(String buildingName)
Checks if building has medical care capability.

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

getMedicalCareTechLevel

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

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

getMedicalCareBeds

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

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

hasFarming

public boolean hasFarming(String buildingName)
Checks if building has the farming function.

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

getCropNum

public int getCropNum(String buildingName)
Gets the number of crops in the building.

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

getPowerForGrowingCrop

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

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

getPowerForSustainingCrop

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

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

getCropGrowingArea

public double getCropGrowingArea(String buildingName)
Gets the crop growing area in the building.

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

hasExercise

public boolean hasExercise(String buildingName)
Checks if the building has the exercise function.

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

getExerciseCapacity

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

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

hasGroundVehicleMaintenance

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

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

getVehicleCapacity

public int getVehicleCapacity(String buildingName)
Gets the vehicle capacity of the building.

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

getParkingLocationNumber

public int getParkingLocationNumber(String buildingName)
Gets the number of parking locations in the building.

Parameters:
buildingName - the name of the building.
Returns:
number of parking locations.

getParkingLocation

public Point2D.Double getParkingLocation(String buildingName,
                                         int parkingIndex)
Gets the relative location in the building of a parking location.

Parameters:
buildingName - the name of the building.
parkingIndex - the parking location index.
Returns:
Point object containing the relative X & Y position from the building center.

hasCooking

public boolean hasCooking(String buildingName)
Checks if the building has the cooking function.

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

getCookCapacity

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

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

hasManufacture

public boolean hasManufacture(String buildingName)
Checks if the building has the manufacture function.

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

getManufactureTechLevel

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

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

hasAstronomicalObservation

public boolean hasAstronomicalObservation(String buildingName)
Checks if the building has an astronomical observation function.

Parameters:
buildingName - the name of the building.
Returns:
true if building has astronomical observation function.
Throws:
Exception - if building name cannot be found or XML parsing error.

getAstronomicalObservationTechLevel

public int getAstronomicalObservationTechLevel(String buildingName)
Gets the tech level of the astronomy facility in the building.

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

getAstronomicalObservationCapacity

public int getAstronomicalObservationCapacity(String buildingName)
Gets capacity of the astronomy facility in the building.

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

getAstronomicalObservationPowerRequirement

public double getAstronomicalObservationPowerRequirement(String buildingName)
Gets the power required by the astronomical observation function.

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

getManufactureConcurrentProcesses

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

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

hasManagement

public boolean hasManagement(String buildingName)
Checks if the building has the management function.

Parameters:
buildingName - the name of the building.
Returns:
true if building has management function.

getManagementPopulationSupport

public int getManagementPopulationSupport(String buildingName)
Gets the management population support for a building.

Parameters:
buildingName - the name of the building.
Returns:
population support

hasEarthReturn

public boolean hasEarthReturn(String buildingName)
Checks if the building has an Earth return function.

Parameters:
buildingName - the name of the building.
Returns:
true if building has earth return function.

getEarthReturnCrewCapacity

public int getEarthReturnCrewCapacity(String buildingName)
Gets the Earth return crew capacity of a building.

Parameters:
buildingName - the name of the building.
Returns:
the crew capacity.

destroy

public void destroy()
Prepare object for garbage collection.



Copyright © 2009-2013. All Rights Reserved.