org.mars_sim.msp.simulation.person.ai.mission
Class RescueSalvageVehicle

java.lang.Object
  extended by org.mars_sim.msp.simulation.person.ai.mission.Mission
      extended by org.mars_sim.msp.simulation.person.ai.mission.TravelMission
          extended by org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
              extended by org.mars_sim.msp.simulation.person.ai.mission.RoverMission
                  extended by org.mars_sim.msp.simulation.person.ai.mission.RescueSalvageVehicle
All Implemented Interfaces:
java.io.Serializable, UnitListener

public class RescueSalvageVehicle
extends RoverMission
implements java.io.Serializable

The RescueSalvageRover class is a mission to rescue the crew of a vehicle that has an emergency beacon on and tow the vehicle back, or to simply tow the vehicle back if the crew is already dead.

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_DESCRIPTION
           
protected static java.lang.String RENDEZVOUS
           
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.RoverMission
MIN_PEOPLE, STARTING_SETTLEMENT_EVENT
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
DISEMBARKING, EMBARKING, equipmentNeededCache, loadedFlag, OPERATOR_EVENT, TRAVELLING, VEHICLE_EVENT
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.TravelMission
AT_NAVPOINT, DISTANCE_EVENT, NAVPOINTS_EVENT, TRAVEL_STATUS_EVENT, TRAVEL_TO_NAVPOINT
 
Fields inherited from class org.mars_sim.msp.simulation.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
RescueSalvageVehicle(java.util.Collection<Person> members, Settlement startingSettlement, Vehicle vehicleTarget, Rover rover, java.lang.String description)
          Constructor with explicit data.
RescueSalvageVehicle(Person startingPerson)
          Constructor
 
Method Summary
protected  void determineNewPhase()
          Determines a new phase for the mission when the current phase has ended.
 Settlement getAssociatedSettlement()
          Gets the settlement associated with 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.
protected  double getMissionQualification(Person person)
          Gets the mission qualification value for the person.
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.
 java.util.Map<Resource,java.lang.Number> getResourcesToLoad()
          Gets the resources needed for loading the vehicle.
 Vehicle getVehicleTarget()
          Gets the vehicle being rescued/salvaged by this mission.
protected  boolean isCapableOfMission(Person person)
          Checks to see if a person is capable of joining a mission.
 boolean isRescueMission()
          Check if mission is a rescue mission or a salvage mission.
protected  void performDisembarkToSettlementPhase(Person person, Settlement disembarkSettlement)
          Performs the disembark to settlement phase of the mission.
protected  void performPhase(Person person)
          The person performs the current phase of the mission.
protected  void recruitPeopleForMission(Person startingPerson)
          Recruits new people into the mission.
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.RoverMission
areVehiclesAvailable, atLeastOnePersonRemainingAtSettlement, endMission, getOperateVehicleTask, getResourcesNeededForTrip, getRover, getStartingSettlement, getVehicleWithGreatestRange, hasDangerousMedicalProblemAtAssociatedSettlement, hasEmergency, isEveryoneInRover, isNoOneInRover, isRoverInAGarage, isUsableVehicle, minAvailablePeopleAtSettlement, performEmbarkFromSettlementPhase, setStartingSettlement
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
compareVehicles, determineEmergencyDestination, findClosestSettlement, getAverageVehicleSpeedForOperators, getEquipmentToLoad, getEstimatedRemainingMissionTime, getEstimatedTripTime, getFuelNeededForTrip, getLegETA, getPartsNeededForTrip, getTotalDistanceTravelled, getVehicle, hasEmbarkingMissions, hasEnoughResourcesForRemainingMission, hasVehicle, isVehicleLoadable, isVehicleLoaded, leaveVehicle, performTravelPhase, reserveVehicle, setEmergencyBeacon, setVehicle, timePassing, unitUpdate, updateTravelDestination
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.TravelMission
addNavpoint, clearRemainingNavpoints, getCurrentLegDistance, getCurrentLegRemainingDistance, getCurrentLegStartingTime, getCurrentNavpoint, getCurrentNavpointIndex, getNavpoint, getNavpointIndex, getNextNavpoint, getNextNavpointIndex, getNumberOfNavpoints, getPreviousNavpoint, getTotalDistance, getTotalRemainingDistance, getTravelStatus, reachedNextNode, setNavpoint, setNextNavpointIndex, startTravelToNextNode
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.Mission
addMissionListener, addPerson, addPhase, assignTask, associateAllMembersWithSettlement, fireMissionUpdate, fireMissionUpdate, getCurrentMissionLocation, getDescription, getMinPeople, getMissionCapacity, getName, getPeople, getPeopleNumber, getPhase, getPhaseDescription, getPhaseEnded, hasDangerousMedicalProblems, hasDangerousMedicalProblemsAllCrew, hasEmergencyAllCrew, hasPerson, isDone, performMission, removeMissionListener, removePerson, setDescription, setMinPeople, setMissionCapacity, setName, setPhase, setPhaseDescription, setPhaseEnded, 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

RENDEZVOUS

protected static final java.lang.String RENDEZVOUS
See Also:
Constant Field Values
Constructor Detail

RescueSalvageVehicle

public RescueSalvageVehicle(Person startingPerson)
                     throws MissionException
Constructor

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

RescueSalvageVehicle

public RescueSalvageVehicle(java.util.Collection<Person> members,
                            Settlement startingSettlement,
                            Vehicle vehicleTarget,
                            Rover rover,
                            java.lang.String description)
                     throws MissionException
Constructor with explicit data.

Parameters:
members - collection of mission members.
startingSettlement - the starting settlement.
vehicleTarget - the vehicle to rescue/salvage.
rover - the rover to use.
description - the mission's description.
Throws:
MissionException - if error constructing 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

isRescueMission

public boolean isRescueMission()
Check if mission is a rescue mission or a salvage mission.

Returns:
true if rescue mission

getVehicleTarget

public Vehicle getVehicleTarget()
Gets the vehicle being rescued/salvaged by this mission.

Returns:
vehicle

determineNewPhase

protected void determineNewPhase()
                          throws MissionException
Determines a new phase for the mission when the current phase has ended.

Overrides:
determineNewPhase in class VehicleMission
Throws:
MissionException - if problem setting a new phase.

performPhase

protected void performPhase(Person person)
                     throws MissionException
The person performs the current phase of the mission.

Overrides:
performPhase in class RoverMission
Parameters:
person - the person performing the phase.
Throws:
MissionException - if problem performing the phase.

performDisembarkToSettlementPhase

protected void performDisembarkToSettlementPhase(Person person,
                                                 Settlement disembarkSettlement)
                                          throws MissionException
Performs the disembark to settlement phase of the mission.

Overrides:
performDisembarkToSettlementPhase in class RoverMission
Parameters:
person - the person currently performing the mission.
disembarkSettlement - the settlement to be disembarked to.
Throws:
MissionException - if error performing phase.

getAssociatedSettlement

public Settlement getAssociatedSettlement()
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
Gets the number and amounts of resources needed for the mission.

Overrides:
getResourcesNeededForRemainingMission in class VehicleMission
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
Gets the number and types of equipment needed for the mission.

Specified by:
getEquipmentNeededForRemainingMission in class RoverMission
Parameters:
useBuffer - use time buffer in estimation if true.
Returns:
map of equipment class and Integer number.
Throws:
MissionException - if error determining needed equipment.

getMissionQualification

protected double getMissionQualification(Person person)
                                  throws MissionException
Gets the mission qualification value for the person. Person is qualified and interested in joining the mission if the value is larger than 0. The larger the qualification value, the more likely the person will be picked for the mission. Qualification values of zero or negative will not join missions.

Overrides:
getMissionQualification in class Mission
Parameters:
person - the person to check.
Returns:
mission qualification value.
Throws:
MissionException - if problem finding mission qualification.

isCapableOfMission

protected boolean isCapableOfMission(Person person)
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.

recruitPeopleForMission

protected void recruitPeopleForMission(Person startingPerson)
Recruits new people into the mission.

Overrides:
recruitPeopleForMission in class Mission
Parameters:
startingPerson - the person starting the mission.

getResourcesToLoad

public java.util.Map<Resource,java.lang.Number> getResourcesToLoad()
                                                            throws MissionException
Gets the resources needed for loading the vehicle.

Overrides:
getResourcesToLoad in class VehicleMission
Returns:
resources and their number.
Throws:
MissionException - if error determining resources.