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

java.lang.Object
  extended by org.mars_sim.msp.simulation.structure.building.Building
All Implemented Interfaces:
java.io.Serializable, Malfunctionable
Direct Known Subclasses:
MockBuilding

public class Building
extends java.lang.Object
implements Malfunctionable, java.io.Serializable

The Building class is a settlement's building.

See Also:
Serialized Form

Field Summary
protected  double basePowerDownPowerRequirement
           
protected  double basePowerRequirement
           
static java.lang.String FULL_POWER
           
protected  java.util.List<Function> functions
           
protected  MalfunctionManager malfunctionManager
           
protected  BuildingManager manager
           
protected  java.lang.String name
           
static java.lang.String NO_POWER
           
static java.lang.String POWER_DOWN
           
protected  java.lang.String powerMode
           
 
Constructor Summary
protected Building()
          Empty constructor.
  Building(java.lang.String name, BuildingManager manager)
          Constructs a Building object.
 
Method Summary
 java.util.Collection<Person> getAffectedPeople()
          Gets a collection of people affected by this entity.
 BuildingManager getBuildingManager()
          Gets the building's building manager.
 double getFullPowerRequired()
          Gets the power this building currently requires for full-power mode.
 Function getFunction(java.lang.String functionName)
          Gets a function if the building has it.
 Inventory getInventory()
          Gets the inventory associated with this entity.
 MalfunctionManager getMalfunctionManager()
          Gets the entity's malfunction manager.
 java.lang.String getName()
          Gets the building's name.
 double getPoweredDownPowerRequired()
          Gets the power the building requires for power-down mode.
 java.lang.String getPowerMode()
          Gets the building's power mode.
 boolean hasFunction(java.lang.String functionName)
          Checks if a building has a particular function.
 void setPowerMode(java.lang.String powerMode)
          Sets the building's power mode.
 void timePassing(double time)
          Time passing for building.
 java.lang.String toString()
          String representation of this building.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FULL_POWER

public static final java.lang.String FULL_POWER
See Also:
Constant Field Values

POWER_DOWN

public static final java.lang.String POWER_DOWN
See Also:
Constant Field Values

NO_POWER

public static final java.lang.String NO_POWER
See Also:
Constant Field Values

manager

protected BuildingManager manager

name

protected java.lang.String name

powerMode

protected java.lang.String powerMode

malfunctionManager

protected MalfunctionManager malfunctionManager

functions

protected java.util.List<Function> functions

basePowerRequirement

protected double basePowerRequirement

basePowerDownPowerRequirement

protected double basePowerDownPowerRequirement
Constructor Detail

Building

public Building(java.lang.String name,
                BuildingManager manager)
         throws BuildingException
Constructs a Building object.

Parameters:
name - the building's name.
manager - the building's building manager.
Throws:
BuildingException - if building can not be created.

Building

protected Building()
Empty constructor.

Method Detail

hasFunction

public boolean hasFunction(java.lang.String functionName)
Checks if a building has a particular function.

Parameters:
functionName - the name of the function.
Returns:
true if function.

getFunction

public Function getFunction(java.lang.String functionName)
                     throws BuildingException
Gets a function if the building has it.

Parameters:
functionName - the name of the function.
Returns:
function.
Throws:
BuildingException - if building doesn't have the function.

getBuildingManager

public BuildingManager getBuildingManager()
Gets the building's building manager.

Returns:
building manager

getName

public java.lang.String getName()
Gets the building's name.

Specified by:
getName in interface Malfunctionable
Returns:
building's name as a String.

timePassing

public void timePassing(double time)
                 throws BuildingException
Time passing for building.

Parameters:
time - amount of time passing (in millisols)
Throws:
BuildingException - if error occurs.

getFullPowerRequired

public double getFullPowerRequired()
Gets the power this building currently requires for full-power mode.

Returns:
power in kW.

getPoweredDownPowerRequired

public double getPoweredDownPowerRequired()
Gets the power the building requires for power-down mode.

Returns:
power in kW.

getPowerMode

public java.lang.String getPowerMode()
Gets the building's power mode.


setPowerMode

public void setPowerMode(java.lang.String powerMode)
Sets the building's power mode.


getMalfunctionManager

public MalfunctionManager getMalfunctionManager()
Gets the entity's malfunction manager.

Specified by:
getMalfunctionManager in interface Malfunctionable
Returns:
malfunction manager

getAffectedPeople

public java.util.Collection<Person> getAffectedPeople()
Gets a collection of people affected by this entity. Children buildings should add additional people as necessary.

Specified by:
getAffectedPeople in interface Malfunctionable
Returns:
person collection

getInventory

public Inventory getInventory()
Gets the inventory associated with this entity.

Specified by:
getInventory in interface Malfunctionable
Returns:
inventory

toString

public java.lang.String toString()
String representation of this building.

Overrides:
toString in class java.lang.Object
Returns:
The settlement and building name.