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

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.CollectResourcesMission
All Implemented Interfaces:
java.io.Serializable, UnitListener
Direct Known Subclasses:
CollectIce, CollectRegolith

public abstract class CollectResourcesMission
extends RoverMission
implements java.io.Serializable

The CollectResourcesMission class is a mission to travel in a rover to several random locations around a settlement and collect resources of a given type.

See Also:
Serialized Form

Field Summary
static java.lang.String COLLECT_RESOURCES
           
static double EVA_COLLECTION_OVERHEAD
           
 
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
 
Method Summary
protected  void determineNewPhase()
          Determines a new phase for the mission when the current phase has ended.
 void endCollectingAtSite()
           
 Settlement getAssociatedSettlement()
          Gets the settlement associated with the mission.
protected abstract  java.lang.String getCollectionSiteDescription(int siteNum)
          Gets the description of a collection site.
 java.util.Map<java.lang.Class,java.lang.Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
          Gets the number and types of equipment needed for the mission.
 double getEstimatedRemainingMissionTime(boolean useBuffer)
          Gets the estimated time remaining for the mission.
protected  double getEstimatedTimeAtCollectionSite(boolean useBuffer)
          Gets the estimated time spent at a collection site.
static double getNewMissionProbability(Person person, java.lang.Class containerType, int containerNum, int minPeople, java.lang.Class missionType)
          Gets the weighted probability that a given person would start this mission.
 int getNumCollectionSites()
          Gets the total number of collection sites for this mission.
 int getNumCollectionSitesVisited()
          Gets the number of collection sites that have been currently visited by the mission.
protected  java.util.Map<Resource,java.lang.Number> getPartsNeededForTrip(double distance)
          Gets the parts needed for the trip.
 java.util.Map<Resource,java.lang.Number> getResourcesNeededForRemainingMission(boolean useBuffer, boolean parts)
          Gets the number and amounts of resources needed for the mission.
static double getTotalTripTimeLimit(Rover rover, int memberNum, boolean useBuffer)
          Gets the time limit of the trip based on life support capacity.
protected  boolean isCapableOfMission(Person person)
          Checks to see if a person is capable of joining a mission.
protected static int numCollectingContainersAvailable(Settlement settlement, java.lang.Class containerType)
          Gets the number of empty containers of given type at the settlement.
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, performDisembarkToSettlementPhase, performEmbarkFromSettlementPhase, setStartingSettlement
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
compareVehicles, determineEmergencyDestination, findClosestSettlement, getAverageVehicleSpeedForOperators, getEquipmentToLoad, getEstimatedTripTime, getFuelNeededForTrip, getLegETA, getResourcesToLoad, 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, getMissionQualification, getName, getNewMissionProbability, 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

COLLECT_RESOURCES

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

EVA_COLLECTION_OVERHEAD

public static final double EVA_COLLECTION_OVERHEAD
See Also:
Constant Field Values
Method Detail

getNewMissionProbability

public static double getNewMissionProbability(Person person,
                                              java.lang.Class containerType,
                                              int containerNum,
                                              int minPeople,
                                              java.lang.Class missionType)
Gets the weighted probability that a given person would start this mission.

Parameters:
person - the given person
containerType - = the required container class.
containerNum - = the number of containers required.
minPeople - = the minimum number of people required.
missionType - the mission class.
Returns:
the weighted probability

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.

endCollectingAtSite

public void endCollectingAtSite()

getAssociatedSettlement

public Settlement getAssociatedSettlement()
Gets the settlement associated with the mission.

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

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.

numCollectingContainersAvailable

protected static int numCollectingContainersAvailable(Settlement settlement,
                                                      java.lang.Class containerType)
                                               throws MissionException
Gets the number of empty containers of given type at the settlement.

Parameters:
settlement - the settlement
containerType - the type of container
Returns:
number of empty containers.
Throws:
MissionException - if error determining number.

getEstimatedRemainingMissionTime

public double getEstimatedRemainingMissionTime(boolean useBuffer)
                                        throws MissionException
Gets the estimated time remaining for the mission.

Overrides:
getEstimatedRemainingMissionTime in class VehicleMission
Parameters:
useBuffer - use time buffer in estimations if true.
Returns:
time (millisols)
Throws:
MissionException

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.

getPartsNeededForTrip

protected java.util.Map<Resource,java.lang.Number> getPartsNeededForTrip(double distance)
                                                                  throws MissionException
Gets the parts needed for the trip.

Overrides:
getPartsNeededForTrip in class VehicleMission
Parameters:
distance - the distance of the trip.
Returns:
map of part resources and their number.
Throws:
MissionException - if error determining parts.

getNumCollectionSites

public final int getNumCollectionSites()
Gets the total number of collection sites for this mission.

Returns:
number of sites.

getNumCollectionSitesVisited

public final int getNumCollectionSitesVisited()
Gets the number of collection sites that have been currently visited by the mission.

Returns:
number of sites.

getEstimatedTimeAtCollectionSite

protected double getEstimatedTimeAtCollectionSite(boolean useBuffer)
Gets the estimated time spent at a collection site.

Parameters:
useBuffer - Use time buffer in estimation if true.
Returns:
time (millisols)

getTotalTripTimeLimit

public static double getTotalTripTimeLimit(Rover rover,
                                           int memberNum,
                                           boolean useBuffer)
                                    throws MissionException
Gets the time limit of the trip based on life support capacity.

Parameters:
useBuffer - use time buffer in estimation if true.
Returns:
time (millisols) limit.
Throws:
MissionException - if error determining time limit.

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.

getCollectionSiteDescription

protected abstract java.lang.String getCollectionSiteDescription(int siteNum)
Gets the description of a collection site.

Parameters:
siteNum - the number of the site.
Returns:
description