|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.core.person.ai.mission.Mission
org.mars_sim.msp.core.person.ai.mission.TravelMission
org.mars_sim.msp.core.person.ai.mission.VehicleMission
public abstract class VehicleMission
A mission that involves driving a vehicle along a series of navpoints.
| Field Summary | |
|---|---|
static String |
DISEMBARKING
|
static String |
EMBARKING
|
protected Map<Class,Integer> |
equipmentNeededCache
|
protected boolean |
loadedFlag
|
static String |
OPERATOR_EVENT
|
static String |
TRAVELLING
|
static String |
VEHICLE_EVENT
|
| Fields inherited from class org.mars_sim.msp.core.person.ai.mission.TravelMission |
|---|
AT_NAVPOINT, DISTANCE_EVENT, NAVPOINTS_EVENT, TRAVEL_STATUS_EVENT, TRAVEL_TO_NAVPOINT |
| 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 | |
|---|---|
protected |
VehicleMission(String name,
Person startingPerson,
int minPeople)
Constructor |
protected |
VehicleMission(String name,
Person startingPerson,
int minPeople,
Vehicle vehicle)
Constructor with vehicle. |
| Method Summary | |
|---|---|
protected int |
compareVehicles(Vehicle firstVehicle,
Vehicle secondVehicle)
Compares the quality of two vehicles for use in this mission. |
void |
destroy()
Prepare object for garbage collection. |
protected void |
determineEmergencyDestination(Person person)
Determines the emergency destination settlement for the mission if one is reachable, otherwise sets the emergency beacon and ends the mission. |
protected void |
determineNewPhase()
Determines a new phase for the mission when the current phase has ended. |
void |
endMission(String reason)
Finalizes the mission |
Settlement |
findClosestSettlement()
Finds the closest settlement to the mission. |
protected double |
getAverageVehicleSpeedForOperators()
Gets the average operating speed of the mission vehicle for all of the mission members. |
double |
getEstimatedRemainingMissionTime(boolean useBuffer)
Gets the estimated time remaining for the mission. |
double |
getEstimatedTripTime(boolean useBuffer,
double distance)
Gets the estimated time for a trip. |
static double |
getFuelNeededForTrip(double tripDistance,
double fuelEfficiency,
boolean useBuffer)
Gets the amount of fuel (kg) needed for a trip of a given distance (km). |
MarsClock |
getLegETA()
Gets the estimated time of arrival (ETA) for the current leg of the mission. |
protected abstract OperateVehicle |
getOperateVehicleTask(Person person,
String lastOperateVehicleTaskPhase)
Gets a new instance of an OperateVehicle task for the person. |
Map<Class,Integer> |
getOptionalEquipmentToLoad()
Gets the optional equipment needed for loading the vehicle. |
Map<Resource,Number> |
getOptionalResourcesToLoad()
Gets the optional resources needed for loading the vehicle. |
protected Map<Resource,Number> |
getPartsNeededForTrip(double distance)
Gets the parts needed for the trip. |
Map<Class,Integer> |
getRequiredEquipmentToLoad()
Gets the required equipment needed for loading the vehicle. |
Map<Resource,Number> |
getRequiredResourcesToLoad()
Gets the required resources needed for loading the vehicle. |
Map<Resource,Number> |
getResourcesNeededForRemainingMission(boolean useBuffer)
Gets the number and amounts of resources needed for the mission. |
Map<Resource,Number> |
getResourcesNeededForTrip(boolean useBuffer,
double distance)
Gets the number and amounts of resources needed for a trip. |
double |
getTotalDistanceTravelled()
Gets the total distance travelled during the mission so far. |
Vehicle |
getVehicle()
Gets the mission's vehicle if there is one. |
protected static boolean |
hasEmbarkingMissions(Settlement settlement)
Checks to see if there are any currently embarking missions at the settlement. |
protected boolean |
hasEnoughResourcesForRemainingMission(boolean useBuffers)
Checks if there are enough resources available in the vehicle for the remaining mission. |
boolean |
hasVehicle()
Checks if the mission has a vehicle. |
protected boolean |
isUsableVehicle(Vehicle newVehicle)
Checks if vehicle is usable for this mission. |
boolean |
isVehicleLoadable()
Checks if a vehicle can load the supplies needed by the mission. |
boolean |
isVehicleLoaded()
Determine if a vehicle is sufficiently loaded with fuel and supplies. |
protected void |
leaveVehicle()
Leaves the mission's vehicle and unreserves it. |
protected abstract void |
performDisembarkToSettlementPhase(Person person,
Settlement disembarkSettlement)
Performs the disembark to settlement phase of the mission. |
protected abstract void |
performEmbarkFromSettlementPhase(Person person)
Performs the embark from settlement phase of the mission. |
protected void |
performPhase(Person person)
The person performs the current phase of the mission. |
protected void |
performTravelPhase(Person person)
Performs the travel phase of the mission. |
protected boolean |
reserveVehicle(Person person)
Reserves a vehicle for the mission if possible. |
void |
setEmergencyBeacon(Person person,
Vehicle vehicle,
boolean beaconOn)
Sets the vehicle's emergency beacon on or off. |
protected void |
setVehicle(Vehicle newVehicle)
Sets the vehicle for this mission. |
void |
timePassing(double time)
Time passing for mission. |
void |
unitUpdate(UnitEvent event)
Catch unit update event. |
void |
updateTravelDestination()
Update mission to the next navpoint destination. |
| Methods inherited from class org.mars_sim.msp.core.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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String VEHICLE_EVENT
public static final String OPERATOR_EVENT
public static final String EMBARKING
public static final String TRAVELLING
public static final String DISEMBARKING
protected boolean loadedFlag
protected Map<Class,Integer> equipmentNeededCache
| Constructor Detail |
|---|
protected VehicleMission(String name,
Person startingPerson,
int minPeople)
name - the name of the mission.startingPerson - the person starting the missionminPeople - the minimum number of mission members allowed
MissionException - if error constructing mission.
protected VehicleMission(String name,
Person startingPerson,
int minPeople,
Vehicle vehicle)
name - the name of the mission.startingPerson - the person starting the missionminPeople - the minimum number of mission members allowedvehicle - the vehicle to use on the mission.
MissionException - if error constructing mission.| Method Detail |
|---|
public final Vehicle getVehicle()
protected void setVehicle(Vehicle newVehicle)
newVehicle - the vehicle to use.
MissionException - if vehicle cannot be used.public final boolean hasVehicle()
protected final void leaveVehicle()
protected boolean isUsableVehicle(Vehicle newVehicle)
newVehicle - the vehicle to check
IllegalArgumentException - if newVehicle is null.
MissionException - if problem checking vehicle is loadable.
protected int compareVehicles(Vehicle firstVehicle,
Vehicle secondVehicle)
firstVehicle - the first vehicle to comparesecondVehicle - the second vehicle to compare
MissionException - if error determining vehicle range.protected final boolean reserveVehicle(Person person)
person - the person reserving the vehicle.
MissionException - if error reserving vehicle.public void endMission(String reason)
endMission in class Missionreason - the reason of ending the mission.public final boolean isVehicleLoaded()
MissionException - if error checking vehicle.public final boolean isVehicleLoadable()
Exception - if error checking vehicle.
public static double getFuelNeededForTrip(double tripDistance,
double fuelEfficiency,
boolean useBuffer)
tripDistance - the distance (km) of the trip.fuelEfficiency - the vehicle's fuel efficiency (km/kg).useBuffer - use time buffers in estimation if true.
protected void determineNewPhase()
determineNewPhase in class MissionMissionException - if problem setting a new phase.protected void performPhase(Person person)
performPhase in class Missionperson - the person performing the phase.
MissionException - if problem performing the phase.protected final void performTravelPhase(Person person)
performTravelPhase in class TravelMissionperson - the person currently performing the mission.
MissionException - if error performing phase.
protected abstract OperateVehicle getOperateVehicleTask(Person person,
String lastOperateVehicleTaskPhase)
person - the person operating the vehicle.
MissionException - if error creating OperateVehicle task.protected abstract void performEmbarkFromSettlementPhase(Person person)
person - the person currently performing the mission.
MissionException - if error performing phase.
protected abstract void performDisembarkToSettlementPhase(Person person,
Settlement disembarkSettlement)
person - the person currently performing the mission.disembarkSettlement - the settlement to be disembarked to.
MissionException - if error performing phase.public final MarsClock getLegETA()
getLegETA in class TravelMission
public final double getEstimatedTripTime(boolean useBuffer,
double distance)
getEstimatedTripTime in class TravelMissionuseBuffer - use time buffers in estimation if true.distance - the distance of the trip.
MissionExceptionpublic double getEstimatedRemainingMissionTime(boolean useBuffer)
getEstimatedRemainingMissionTime in class TravelMissionuseBuffer - Use time buffer in estimations if true.
MissionExceptionprotected final double getAverageVehicleSpeedForOperators()
public Map<Resource,Number> getResourcesNeededForRemainingMission(boolean useBuffer)
getResourcesNeededForRemainingMission in class MissionuseBuffer - use time buffers in estimation if true.
public Map<Resource,Number> getResourcesNeededForTrip(boolean useBuffer,
double distance)
useBuffer - use time buffers in estimation if true.distance - the distance (km) of the trip.
protected Map<Resource,Number> getPartsNeededForTrip(double distance)
distance - the distance of the trip.
protected final boolean hasEnoughResourcesForRemainingMission(boolean useBuffers)
useBuffers - use time buffers for estimation if true.
protected final void determineEmergencyDestination(Person person)
person - the person performing the mission.
public void setEmergencyBeacon(Person person,
Vehicle vehicle,
boolean beaconOn)
person - the person performing the mission.vehicle - the vehicle on the mission.beaconOn - true if beacon is on, false if not.public void updateTravelDestination()
updateTravelDestination in class TravelMissionpublic final Settlement findClosestSettlement()
public final double getTotalDistanceTravelled()
getTotalDistanceTravelled in class TravelMissionpublic void timePassing(double time)
timePassing in class Missiontime - the amount of time passing (in millisols)public void unitUpdate(UnitEvent event)
unitUpdate in interface UnitListenerevent - the unit event.public Map<Resource,Number> getRequiredResourcesToLoad()
public Map<Resource,Number> getOptionalResourcesToLoad()
public Map<Class,Integer> getRequiredEquipmentToLoad()
public Map<Class,Integer> getOptionalEquipmentToLoad()
protected static boolean hasEmbarkingMissions(Settlement settlement)
settlement - the settlement.
public void destroy()
Mission
destroy in class TravelMission
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||