|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mars_sim.msp.simulation.structure.building.BuildingManager
public class BuildingManager
The BuildingManager manages the settlement's buildings.
Field Summary | |
---|---|
static java.lang.String |
ADD_BUILDING_EVENT
|
Constructor Summary | |
---|---|
BuildingManager(Settlement settlement)
Constructor to construct buildings from settlement config template. |
|
BuildingManager(Settlement settlement,
java.util.List<java.lang.String> buildingNames)
Constructor to construct buildings from name list. |
Method Summary | |
---|---|
void |
addBuilding(Building newBuilding)
Adds a new building to the settlement. |
void |
addBuilding(java.lang.String buildingType)
Adds a building of a specific building type to the settlement. |
static void |
addPersonToBuilding(Person person,
Building building)
Adds the person to the building if possible. |
static void |
addToRandomBuilding(GroundVehicle vehicle,
Settlement settlement)
Adds a ground vehicle to a random ground vehicle maintenance building within a settlement. |
static void |
addToRandomBuilding(Person person,
Settlement settlement)
Adds a person to a random inhabitable building within a settlement. |
static java.util.List<Building> |
getBestRelationshipBuildings(Person person,
java.util.List<Building> buildingList)
Gets a list of buildings with the best relationships for a given person from a list of buildings. |
static Building |
getBuilding(Person person)
Gets the building a given person is in. |
static Building |
getBuilding(Vehicle vehicle)
Gets the vehicle maintenance building a given vehicle is in. |
int |
getBuildingNum()
Gets the number of buildings at the settlement. |
java.util.List<Building> |
getBuildings()
Gets the settlement's collection of buildings. |
java.util.List<Building> |
getBuildings(java.lang.String functionName)
Gets the buildings in a settlement that has a given function. |
static java.util.List<Building> |
getLeastCrowdedBuildings(java.util.List<Building> buildingList)
Gets a list of the least crowded buildings from a given list of buildings with life support. |
static java.util.List<Building> |
getNonMalfunctioningBuildings(java.util.List<Building> buildingList)
Gets a list of buildings that don't have any malfunctions from a list of buildings. |
Settlement |
getSettlement()
Gets the building manager's settlement. |
static java.util.List<Building> |
getUncrowdedBuildings(java.util.List<Building> buildingList)
Gets a list of uncrowded buildings from a given list of buildings with life support. |
void |
timePassing(double time)
Time passing for all buildings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ADD_BUILDING_EVENT
Constructor Detail |
---|
public BuildingManager(Settlement settlement) throws java.lang.Exception
settlement
- the manager's settlement.
java.lang.Exception
- if buildings cannot be constructed.public BuildingManager(Settlement settlement, java.util.List<java.lang.String> buildingNames) throws java.lang.Exception
settlement
- the manager's settlementbuildingNames
- the names of the settlement's buildings.
java.lang.Exception
- if buildings cannot be constructed.Method Detail |
---|
public Settlement getSettlement()
public void addBuilding(Building newBuilding)
newBuilding
- the building to add.public void addBuilding(java.lang.String buildingType) throws java.lang.Exception
buildingType
- the type of building.
java.lang.Exception
- if error creating or adding building.public java.util.List<Building> getBuildings()
public java.util.List<Building> getBuildings(java.lang.String functionName)
functionName
- the name of the building.
public int getBuildingNum()
public void timePassing(double time) throws java.lang.Exception
time
- amount of time passing (in millisols)
java.lang.Exception
- if error.public static void addToRandomBuilding(Person person, Settlement settlement) throws BuildingException
person
- the person to add.settlement
- the settlement to find a building.
BuildingException
- if person cannot be added to any building.public static void addToRandomBuilding(GroundVehicle vehicle, Settlement settlement) throws BuildingException
vehicle
- the ground vehicle to add.settlement
- the settlement to find a building.
BuildingException
- if vehicle cannot be added to any building.public static Building getBuilding(Person person)
public static Building getBuilding(Vehicle vehicle)
public static java.util.List<Building> getUncrowdedBuildings(java.util.List<Building> buildingList) throws BuildingException
buildingList
- list of buildings with the life support function.
BuildingException
- if building in list does not have the life support function.public static java.util.List<Building> getLeastCrowdedBuildings(java.util.List<Building> buildingList) throws BuildingException
buildingList
- list of buildings with the life support function.
BuildingException
- if building in list does not have the life support function.public static java.util.List<Building> getBestRelationshipBuildings(Person person, java.util.List<Building> buildingList) throws BuildingException
person
- the person to check for.buildingList
- the list of buildings to filter.
BuildingException
- if building in list does not have the life support function.if building in list does not have the life support function.public static java.util.List<Building> getNonMalfunctioningBuildings(java.util.List<Building> buildingList)
buildingList
- the list of buildings.
public static void addPersonToBuilding(Person person, Building building) throws BuildingException
person
- the person to add.building
- the building to add the person to.
BuildingException
- if person could not be added to the building.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |