|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.simulation.person.ai.mission.Mission
org.mars_sim.msp.simulation.person.ai.mission.TravelMission
org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
public abstract class VehicleMission
A mission that involves driving a vehicle along a series of navpoints.
| Field Summary | |
|---|---|
static java.lang.String |
DISEMBARKING
|
static java.lang.String |
EMBARKING
|
protected java.util.Map<java.lang.Class,java.lang.Integer> |
equipmentNeededCache
|
protected boolean |
loadedFlag
|
static java.lang.String |
OPERATOR_EVENT
|
static java.lang.String |
TRAVELLING
|
static java.lang.String |
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 | |
|---|---|
protected |
VehicleMission(java.lang.String name,
Person startingPerson,
int minPeople)
Constructor |
protected |
VehicleMission(java.lang.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. |
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(java.lang.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. |
java.util.Map<java.lang.Class,java.lang.Integer> |
getEquipmentToLoad()
Gets the equipment needed for loading the vehicle. |
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,
java.lang.String lastOperateVehicleTaskPhase)
Gets a new instance of an OperateVehicle task for the person. |
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. |
java.util.Map<Resource,java.lang.Number> |
getResourcesNeededForTrip(boolean useBuffer,
boolean parts,
double distance)
Gets the number and amounts of resources needed for a trip. |
java.util.Map<Resource,java.lang.Number> |
getResourcesToLoad()
Gets the resources needed for loading the vehicle. |
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.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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String VEHICLE_EVENT
public static final java.lang.String OPERATOR_EVENT
public static final java.lang.String EMBARKING
public static final java.lang.String TRAVELLING
public static final java.lang.String DISEMBARKING
protected boolean loadedFlag
protected java.util.Map<java.lang.Class,java.lang.Integer> equipmentNeededCache
| Constructor Detail |
|---|
protected VehicleMission(java.lang.String name,
Person startingPerson,
int minPeople)
throws MissionException
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(java.lang.String name,
Person startingPerson,
int minPeople,
Vehicle vehicle)
throws MissionException
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 final void setVehicle(Vehicle newVehicle)
throws MissionException
newVehicle - the vehicle to use.
MissionException - if vehicle cannot be used.public final boolean hasVehicle()
protected final void leaveVehicle()
protected boolean isUsableVehicle(Vehicle newVehicle)
throws MissionException
newVehicle - the vehicle to check
java.lang.IllegalArgumentException - if newVehicle is null.
MissionException - if problem checking vehicle is loadable.
protected int compareVehicles(Vehicle firstVehicle,
Vehicle secondVehicle)
throws MissionException
firstVehicle - the first vehicle to comparesecondVehicle - the second vehicle to compare
MissionException - if error determining vehicle range.
protected final boolean reserveVehicle(Person person)
throws MissionException
person - the person reserving the vehicle.
MissionException - if error reserving vehicle.public void endMission(java.lang.String reason)
endMission in class Missionreason - the reason of ending the mission.
public final boolean isVehicleLoaded()
throws MissionException
MissionException - if error checking vehicle.
public final boolean isVehicleLoadable()
throws MissionException
java.lang.Exception - if error checking vehicle.
MissionException
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()
throws MissionException
determineNewPhase in class MissionMissionException - if problem setting a new phase.
protected void performPhase(Person person)
throws MissionException
performPhase in class Missionperson - the person performing the phase.
MissionException - if problem performing the phase.
protected final void performTravelPhase(Person person)
throws MissionException
performTravelPhase in class TravelMissionperson - the person currently performing the mission.
MissionException - if error performing phase.
protected abstract OperateVehicle getOperateVehicleTask(Person person,
java.lang.String lastOperateVehicleTaskPhase)
throws MissionException
person - the person operating the vehicle.
MissionException - if error creating OperateVehicle task.
protected abstract void performEmbarkFromSettlementPhase(Person person)
throws MissionException
person - the person currently performing the mission.
MissionException - if error performing phase.
protected abstract void performDisembarkToSettlementPhase(Person person,
Settlement disembarkSettlement)
throws MissionException
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)
throws MissionException
getEstimatedTripTime in class TravelMissionuseBuffer - use time buffers in estimation if true.distance - the distance of the trip.
MissionException
public double getEstimatedRemainingMissionTime(boolean useBuffer)
throws MissionException
getEstimatedRemainingMissionTime in class TravelMissionuseBuffer - Use time buffer in estimations if true.
MissionExceptionprotected final double getAverageVehicleSpeedForOperators()
public java.util.Map<Resource,java.lang.Number> getResourcesNeededForRemainingMission(boolean useBuffer,
boolean parts)
throws MissionException
getResourcesNeededForRemainingMission in class MissionuseBuffer - use time buffers in estimation if true.parts - include parts.
MissionException - if error determining needed resources.
public java.util.Map<Resource,java.lang.Number> getResourcesNeededForTrip(boolean useBuffer,
boolean parts,
double distance)
throws MissionException
useBuffer - use time buffers in estimation if true.parts - include parts.distance - the distance (km) of the trip.
MissionException - if error determining needed resources.
protected java.util.Map<Resource,java.lang.Number> getPartsNeededForTrip(double distance)
throws MissionException
distance - the distance of the trip.
MissionException - if error determining parts.
protected final boolean hasEnoughResourcesForRemainingMission(boolean useBuffers)
throws MissionException
useBuffers - use time buffers for estimation if true.
MissionException - if error checking resources.
protected final void determineEmergencyDestination(Person person)
throws MissionException
person - the person performing the mission.
MissionException - if error determining an emergency destination.
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 TravelMission
public final Settlement findClosestSettlement()
throws MissionException
MissionException - if error finding closest settlement.public final double getTotalDistanceTravelled()
getTotalDistanceTravelled in class TravelMission
public void timePassing(double time)
throws java.lang.Exception
timePassing in class Missiontime - the amount of time passing (in millisols)
java.lang.Exception - if error during time passing.public void unitUpdate(UnitEvent event)
unitUpdate in interface UnitListenerevent - the unit event.
public java.util.Map<Resource,java.lang.Number> getResourcesToLoad()
throws MissionException
MissionException - if error determining resources.
public java.util.Map<java.lang.Class,java.lang.Integer> getEquipmentToLoad()
throws MissionException
MissionException - if error determining equipment.protected static boolean hasEmbarkingMissions(Settlement settlement)
settlement - the settlement.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||