org.mars_sim.msp.core.person.ai.mission
Class BuildingConstructionMission

java.lang.Object
  extended by org.mars_sim.msp.core.person.ai.mission.Mission
      extended by org.mars_sim.msp.core.person.ai.mission.BuildingConstructionMission
All Implemented Interfaces:
Serializable

public class BuildingConstructionMission
extends Mission
implements Serializable

Mission for construction a stage for a settlement building.

See Also:
Serialized Form

Field Summary
static String CONSTRUCTION_PHASE
           
static String DEFAULT_DESCRIPTION
           
static String PREPARE_SITE_PHASE
           
 
Fields inherited from class org.mars_sim.msp.core.person.ai.mission.Mission
ADD_MEMBER_EVENT, ASSOCIATED_SETTLEMENT_EVENT, CAPACITY_EVENT, DESCRIPTION_EVENT, END_MISSION_EVENT, MIN_PEOPLE_EVENT, NAME_EVENT, PHASE_DESCRIPTION_EVENT, PHASE_EVENT, REMOVE_MEMBER_EVENT
 
Constructor Summary
BuildingConstructionMission(Collection<Person> members, Settlement settlement, ConstructionSite site, ConstructionStageInfo stageInfo, double xLoc, double yLoc, double facing, List<GroundVehicle> vehicles)
          Constructor
BuildingConstructionMission(Person startingPerson)
          Constructor
 
Method Summary
 void destroy()
          Prepare object for garbage collection.
protected  void determineNewPhase()
          Determines a new phase for the mission when the current phase has ended.
 void endMission(String reason)
          Finalizes the mission.
 Settlement getAssociatedSettlement()
          Gets the settlement associated with the mission.
 ConstructionSite getConstructionSite()
          Gets the mission's construction site.
 ConstructionStage getConstructionStage()
          Gets the mission's construction stage.
 List<GroundVehicle> getConstructionVehicles()
          Gets a list of all construction vehicles used by the mission.
 Map<Class,Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
          Gets the number and types of equipment needed for the mission.
static double getNewMissionProbability(Person person)
          Gets the weighted probability that a given person would start this mission.
 Map<Resource,Number> getResourcesNeededForRemainingMission(boolean useBuffer)
          Gets the number and amounts of resources needed for the mission.
protected  boolean hasEmergency()
          Checks if the mission has an emergency situation.
protected  boolean isCapableOfMission(Person person)
          Checks to see if a person is capable of joining a mission.
protected  void performPhase(Person person)
          The person performs the current phase of the mission.
 
Methods inherited from class org.mars_sim.msp.core.person.ai.mission.Mission
addMissionListener, addPerson, addPhase, assignTask, associateAllMembersWithSettlement, fireMissionUpdate, fireMissionUpdate, getCurrentMissionLocation, getDescription, getMinPeople, getMissionCapacity, getMissionQualification, getName, getPeople, getPeopleNumber, getPhase, getPhaseDescription, getPhaseEnded, hasDangerousMedicalProblems, hasDangerousMedicalProblemsAllCrew, hasEmergencyAllCrew, hasPerson, isDone, performMission, recruitPeopleForMission, removeMissionListener, removePerson, setDescription, setMinPeople, setMissionCapacity, setName, setPhase, setPhaseDescription, setPhaseEnded, timePassing, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DESCRIPTION

public static final String DEFAULT_DESCRIPTION
See Also:
Constant Field Values

PREPARE_SITE_PHASE

public static final String PREPARE_SITE_PHASE
See Also:
Constant Field Values

CONSTRUCTION_PHASE

public static final String CONSTRUCTION_PHASE
See Also:
Constant Field Values
Constructor Detail

BuildingConstructionMission

public BuildingConstructionMission(Person startingPerson)
Constructor

Parameters:
startingPerson - the person starting the mission.
Throws:
MissionException - if error creating mission.

BuildingConstructionMission

public BuildingConstructionMission(Collection<Person> members,
                                   Settlement settlement,
                                   ConstructionSite site,
                                   ConstructionStageInfo stageInfo,
                                   double xLoc,
                                   double yLoc,
                                   double facing,
                                   List<GroundVehicle> vehicles)
Constructor

Parameters:
members - the mission members.
settlement - the settlement.
site - the construction site.
stageInfo - the construction stage info.
xLoc - the X location of the new construction site (ignored if existing site).
yLoc - the Y location of the new construction site (ignored if existing site).
facing - the facing of the new construction site (ignored if existing site).
vehicles - the construction vehicles.
Throws:
MissionException - if error creating mission.
Method Detail

getNewMissionProbability

public static double getNewMissionProbability(Person person)
Gets the weighted probability that a given person would start this mission.

Parameters:
person - the given person
Returns:
the weighted probability

isCapableOfMission

protected boolean isCapableOfMission(Person person)
Description copied from class: Mission
Checks to see if a person is capable of joining a mission.

Overrides:
isCapableOfMission in class Mission
Parameters:
person - the person to check.
Returns:
true if person could join mission.

determineNewPhase

protected void determineNewPhase()
Description copied from class: Mission
Determines a new phase for the mission when the current phase has ended.

Specified by:
determineNewPhase in class Mission

performPhase

protected void performPhase(Person person)
Description copied from class: Mission
The person performs the current phase of the mission.

Overrides:
performPhase in class Mission
Parameters:
person - the person performing the phase.

endMission

public void endMission(String reason)
Description copied from class: Mission
Finalizes the mission. String reason Reason for ending mission. Mission can override this to perform necessary finalizing operations.

Overrides:
endMission in class Mission

getAssociatedSettlement

public Settlement getAssociatedSettlement()
Description copied from class: Mission
Gets the settlement associated with the mission.

Specified by:
getAssociatedSettlement in class Mission
Returns:
settlement or null if none.

getResourcesNeededForRemainingMission

public Map<Resource,Number> getResourcesNeededForRemainingMission(boolean useBuffer)
Description copied from class: Mission
Gets the number and amounts of resources needed for the mission.

Specified by:
getResourcesNeededForRemainingMission in class Mission
Parameters:
useBuffer - use time buffers in estimation if true.
Returns:
map of amount and item resources and their Double amount or Integer number.

getEquipmentNeededForRemainingMission

public Map<Class,Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
Description copied from class: Mission
Gets the number and types of equipment needed for the mission.

Specified by:
getEquipmentNeededForRemainingMission in class Mission
Parameters:
useBuffer - use time buffers in estimation if true.
Returns:
map of equipment class and Integer number.

getConstructionVehicles

public List<GroundVehicle> getConstructionVehicles()
Gets a list of all construction vehicles used by the mission.

Returns:
list of construction vehicles.

hasEmergency

protected boolean hasEmergency()
Description copied from class: Mission
Checks if the mission has an emergency situation.

Overrides:
hasEmergency in class Mission
Returns:
true if emergency.

getConstructionSite

public ConstructionSite getConstructionSite()
Gets the mission's construction site.

Returns:
construction site.

getConstructionStage

public ConstructionStage getConstructionStage()
Gets the mission's construction stage.

Returns:
construction stage.

destroy

public void destroy()
Description copied from class: Mission
Prepare object for garbage collection.

Overrides:
destroy in class Mission


Copyright © 2009-2013. All Rights Reserved.