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

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

public class BuildingSalvageMission
extends Mission
implements Serializable

Mission for salvaging a construction stage at a building construction site.

See Also:
Serialized Form

Field Summary
static String DEFAULT_DESCRIPTION
           
static String PREPARE_SITE_PHASE
           
static String SALVAGE_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
BuildingSalvageMission(Collection<Person> members, Settlement settlement, Building building, ConstructionSite site, List<GroundVehicle> vehicles)
          Constructor
BuildingSalvageMission(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

SALVAGE_PHASE

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

BuildingSalvageMission

public BuildingSalvageMission(Person startingPerson)
Constructor

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

BuildingSalvageMission

public BuildingSalvageMission(Collection<Person> members,
                              Settlement settlement,
                              Building building,
                              ConstructionSite site,
                              List<GroundVehicle> vehicles)
Constructor

Parameters:
members - the mission members.
settlement - the settlement.
building - the building to salvage. (null if none)
site - the existing salvage construction site. (null if none)
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

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.

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.

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.

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.

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

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.

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.