|
||||||||||
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.task.Task
org.mars_sim.msp.simulation.person.ai.task.OperateVehicle
public abstract class OperateVehicle
The OperateVehicle class is an abstract task for operating a vehicle, driving/flying it to a destination.
Field Summary | |
---|---|
protected double |
backingUpDistance
|
static double |
BASE_ACCIDENT_CHANCE
|
protected boolean |
isBackingUp
|
static java.lang.String |
MOBILIZE
|
Fields inherited from class org.mars_sim.msp.simulation.person.ai.task.Task |
---|
effortDriven, hasDuration, person, phaseTimeCompleted, phaseTimeRequired, stressModifier, subTask, TASK_DESC_EVENT, TASK_ENDED_EVENT, TASK_NAME_EVENT, TASK_PHASE_EVENT, TASK_SUBTASK_EVENT |
Constructor Summary | |
---|---|
OperateVehicle(java.lang.String name,
Person person,
Vehicle vehicle,
Coordinates destination,
MarsClock startTripTime,
double startTripDistance,
double stressModifier,
boolean hasDuration,
double duration)
Default Constructor |
Method Summary | |
---|---|
protected abstract void |
checkForAccident(double time)
Check if vehicle has had an accident. |
void |
endTask()
Ends the task and performs any final actions. |
static double |
getAverageVehicleSpeed(Vehicle vehicle,
VehicleOperator operator)
Gets the average operating speed of a vehicle for a given operator. |
Coordinates |
getDestination()
Gets the location of the destination of the trip. |
protected double |
getDistanceToDestination()
Gets the distance to the destination. |
MarsClock |
getETA()
Determines the ETA (Estimated Time of Arrival) to the destination. |
protected double |
getSpeed(Direction direction)
Determine vehicle speed for a given direction. |
protected double |
getSpeedSkillModifier()
Determine the speed modifier based on the driver's skill level. |
protected double |
getStartTripDistance()
Gets the distance to the destination at the start of the trip. |
protected MarsClock |
getStartTripTime()
Gets the time/date the trip was started on. |
Vehicle |
getVehicle()
Gets the vehicle operated with this task. |
protected double |
getVehicleElevation()
Returns the elevation at the vehicle's position. |
protected double |
mobilizeVehicle(double time)
Move the vehicle in its direction at its speed for the amount of time given. |
protected double |
mobilizeVehiclePhase(double time)
Perform the mobilize vehicle phase for the amount of time given. |
protected double |
performMappedPhase(double time)
Performs the method mapped to the task's current phase. |
void |
setDestination(Coordinates newDestination)
Sets the location of the destination of this trip. |
protected abstract void |
updateVehicleElevationAltitude()
Update vehicle with its current elevation or altitude. |
Methods inherited from class org.mars_sim.msp.simulation.person.ai.task.Task |
---|
addExperience, addPhase, compareTo, getAssociatedSkills, getCreateEvents, getCrowdingProbabilityModifier, getDescription, getDuration, getEffectiveSkillLevel, getName, getPhase, getProbability, getRelationshipModifier, getSubTask, getTeacher, getTeachingExperienceModifier, getTimeCompleted, getTopPhase, hasTeacher, isDone, isEffortDriven, setCreateEvents, setDescription, setDuration, setName, setPhase, setStressModifier, setTeacher, toString |
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 MOBILIZE
public static final double BASE_ACCIDENT_CHANCE
protected double backingUpDistance
protected boolean isBackingUp
Constructor Detail |
---|
public OperateVehicle(java.lang.String name, Person person, Vehicle vehicle, Coordinates destination, MarsClock startTripTime, double startTripDistance, double stressModifier, boolean hasDuration, double duration) throws java.lang.Exception
name
- the name of the particular task.person
- the person performing the task.vehicle
- the vehicle to operate.destination
- the location of destination of the trip.startTripTime
- the time/date the trip is starting.startTripDistance
- the distance (km) to the destination at the start of the trip.stressModifier
- the modifier for stress on the person performing the task.hasDuration
- does the task have a time duration?duration
- the time duration (millisols) of the task (or 0 if none).
java.lang.Exception
- if task cannot be constructed.Method Detail |
---|
protected double performMappedPhase(double time) throws java.lang.Exception
performMappedPhase
in class Task
time
- the amount of time the phase is to be performed.
java.lang.Exception
- if error in performing phase or if phase cannot be found.public Vehicle getVehicle()
public Coordinates getDestination()
public void setDestination(Coordinates newDestination)
newDestination
- location of the destination.protected MarsClock getStartTripTime()
protected double getStartTripDistance()
protected double mobilizeVehiclePhase(double time) throws java.lang.Exception
time
- the amount of time (ms) to perform the phase.
java.lang.Exception
- if error while performing phase.protected double mobilizeVehicle(double time) throws java.lang.Exception
time
- the amount of time (ms) to drive.
java.lang.Exception
- if error while mobilizing vehicle.protected abstract void updateVehicleElevationAltitude()
public MarsClock getETA()
protected abstract void checkForAccident(double time)
time
- the amount of time vehicle is driven (millisols)protected double getSpeed(Direction direction)
direction
- the direction of travel
protected double getSpeedSkillModifier()
protected double getDistanceToDestination()
protected double getVehicleElevation()
public void endTask()
endTask
in class Task
public static double getAverageVehicleSpeed(Vehicle vehicle, VehicleOperator operator)
vehicle
- the vehicle.operator
- the vehicle operator.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |