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:
java.io.Serializable

public class BuildingConstructionMission
extends Mission
implements java.io.Serializable

Mission for construction a stage for a settlement building.

See Also:
Serialized Form

Field Summary
static java.lang.String BACKHOE
           
static java.lang.String BULLDOZER_BLADE
           
static java.lang.String CONSTRUCTION_PHASE
           
static java.lang.String CRANE_BOOM
           
static java.lang.String DEFAULT_DESCRIPTION
           
static java.lang.String PREPARE_SITE_PHASE
           
static java.lang.String SOIL_COMPACTOR
           
 
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(java.util.Collection<Person> members, Settlement settlement, ConstructionSite site, ConstructionStageInfo stageInfo, java.util.List<GroundVehicle> vehicles)
          Constructor
BuildingConstructionMission(Person startingPerson)
          Constructor
 
Method Summary
protected  void determineNewPhase()
          Determines a new phase for the mission when the current phase has ended.
 void endMission(java.lang.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.
 java.util.List<GroundVehicle> getConstructionVehicles()
          Gets a list of all construction vehicles used by the mission.
 java.util.Map<java.lang.Class,java.lang.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.
 java.util.Map<Resource,java.lang.Number> getResourcesNeededForRemainingMission(boolean useBuffer, boolean parts)
          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 java.lang.String DEFAULT_DESCRIPTION
See Also:
Constant Field Values

PREPARE_SITE_PHASE

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

CONSTRUCTION_PHASE

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

SOIL_COMPACTOR

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

BACKHOE

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

BULLDOZER_BLADE

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

CRANE_BOOM

public static final java.lang.String CRANE_BOOM
See Also:
Constant Field Values
Constructor Detail

BuildingConstructionMission

public BuildingConstructionMission(Person startingPerson)
                            throws MissionException
Constructor

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

BuildingConstructionMission

public BuildingConstructionMission(java.util.Collection<Person> members,
                                   Settlement settlement,
                                   ConstructionSite site,
                                   ConstructionStageInfo stageInfo,
                                   java.util.List<GroundVehicle> vehicles)
                            throws MissionException
Constructor

Parameters:
members - the mission members.
settlement - the settlement.
site - the construction site.
stageInfo - the construction stage info.
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()
                          throws MissionException
Description copied from class: Mission
Determines a new phase for the mission when the current phase has ended.

Specified by:
determineNewPhase in class Mission
Throws:
MissionException - if problem setting a new phase.

performPhase

protected void performPhase(Person person)
                     throws MissionException
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.
Throws:
MissionException - if problem performing the phase.

endMission

public void endMission(java.lang.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 java.util.Map<Resource,java.lang.Number> getResourcesNeededForRemainingMission(boolean useBuffer,
                                                                                      boolean parts)
                                                                               throws MissionException
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.
parts - include parts.
Returns:
map of amount and item resources and their Double amount or Integer number.
Throws:
MissionException - if error determining needed resources.

getEquipmentNeededForRemainingMission

public java.util.Map<java.lang.Class,java.lang.Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
                                                                                       throws MissionException
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.
Throws:
MissionException - if error determining needed equipment.

getConstructionVehicles

public java.util.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.