|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.core.structure.building.BuildingManager
public class BuildingManager
The BuildingManager manages the settlement's buildings.
| Field Summary | |
|---|---|
static String |
ADD_BUILDING_EVENT
|
static String |
REMOVE_BUILDING_EVENT
|
| Constructor Summary | |
|---|---|
BuildingManager(Settlement settlement)
Constructor to construct buildings from settlement config template. |
|
BuildingManager(Settlement settlement,
List<BuildingTemplate> buildingTemplates)
Constructor to construct buildings from name list. |
|
| Method Summary | |
|---|---|
void |
addBuilding(Building newBuilding)
Adds a new building to the settlement. |
void |
addBuilding(BuildingTemplate template)
Adds a building with a template 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. |
boolean |
checkIfNewBuildingLocationOpen(double xLoc,
double yLoc,
double width,
double length,
double facing)
Checks if a new building's proposed location is open or intersects with existing buildings or construction sites. |
boolean |
checkIfNewBuildingLocationOpen(double xLoc,
double yLoc,
double width,
double length,
double facing,
ConstructionSite site)
Checks if a new building's proposed location is open or intersects with existing buildings or construction sites. |
void |
destroy()
Prepare object for garbage collection. |
static Map<Building,Double> |
getBestRelationshipBuildings(Person person,
List<Building> buildingList)
Gets a map of buildings and their probabilities for being chosen based on 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. |
List<Building> |
getBuildings()
Gets the settlement's collection of buildings. |
List<Building> |
getBuildings(String functionName)
Gets the buildings in a settlement that has a given function. |
List<Building> |
getBuildingsOfName(String buildingName)
Gets the buildings in the settlement with a given building name. |
double |
getBuildingValue(Building building)
Gets the value of a building at the settlement. |
double |
getBuildingValue(String buildingName,
boolean newBuilding)
Gets the value of a named building at the settlement. |
static List<Building> |
getLeastCrowdedBuildings(List<Building> buildingList)
Gets a list of the least crowded buildings from a given list of buildings with life support. |
static List<Building> |
getNonMalfunctioningBuildings(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 List<Building> |
getUncrowdedBuildings(List<Building> buildingList)
Gets a list of uncrowded buildings from a given list of buildings with life support. |
boolean |
hasBuildingFrame(String frameName)
Checks if a building frame exists at the settlement. |
void |
removeBuilding(Building oldBuilding)
Removes a building from the settlement. |
static void |
removePersonFromBuilding(Person person,
Building building)
Removes the person from a building if possible. |
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 String ADD_BUILDING_EVENT
public static final String REMOVE_BUILDING_EVENT
| Constructor Detail |
|---|
public BuildingManager(Settlement settlement)
settlement - the manager's settlement.
Exception - if buildings cannot be constructed.
public BuildingManager(Settlement settlement,
List<BuildingTemplate> buildingTemplates)
settlement - the manager's settlementbuildingTemplates - the settlement's building templates.
Exception - if buildings cannot be constructed.| Method Detail |
|---|
public Settlement getSettlement()
public void addBuilding(Building newBuilding)
newBuilding - the building to add.public void removeBuilding(Building oldBuilding)
oldBuilding - the building to remove.public void addBuilding(BuildingTemplate template)
template - the building template.
Exception - if error creating or adding building.public List<Building> getBuildings()
public List<Building> getBuildings(String functionName)
functionName - the name of the building.
public List<Building> getBuildingsOfName(String buildingName)
buildingName - the building name.
public int getBuildingNum()
public void timePassing(double time)
time - amount of time passing (in millisols)
Exception - if error.
public static void addToRandomBuilding(Person person,
Settlement settlement)
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)
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 List<Building> getUncrowdedBuildings(List<Building> buildingList)
buildingList - list of buildings with the life support function.
BuildingException - if building in list does not have the life support function.public static List<Building> getLeastCrowdedBuildings(List<Building> buildingList)
buildingList - list of buildings with the life support function.
BuildingException - if building in list does not have the life support function.
public static Map<Building,Double> getBestRelationshipBuildings(Person person,
List<Building> buildingList)
person - the person to check for.buildingList - the list of buildings to filter.
public static List<Building> getNonMalfunctioningBuildings(List<Building> buildingList)
buildingList - the list of buildings.
public static void addPersonToBuilding(Person person,
Building building)
person - the person to add.building - the building to add the person to.
public static void removePersonFromBuilding(Person person,
Building building)
person - the person to remove.building - the building to remove the person from.
public double getBuildingValue(String buildingName,
boolean newBuilding)
buildingName - the building name.newBuilding - true if adding a new building.
public double getBuildingValue(Building building)
building - the building.
Exception - if error getting building value.
public boolean checkIfNewBuildingLocationOpen(double xLoc,
double yLoc,
double width,
double length,
double facing)
xLoc - the new building's X location.yLoc - the new building's Y location.width - the new building's width (meters).length - the new building's length (meters).facing - the new building's facing (degrees clockwise from North).
public boolean checkIfNewBuildingLocationOpen(double xLoc,
double yLoc,
double width,
double length,
double facing,
ConstructionSite site)
xLoc - the new building's X location.yLoc - the new building's Y location.width - the new building's width (meters).length - the new building's length (meters).facing - the new building's facing (degrees clockwise from North).site - the new construction site or null if none.
public boolean hasBuildingFrame(String frameName)
frameName - the frame's name.
public void destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||