|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mars_sim.msp.simulation.Unit
org.mars_sim.msp.simulation.vehicle.Vehicle
public abstract class Vehicle
The Vehicle class represents a generic vehicle. It keeps track of generic information about the vehicle. This class needs to be subclassed to represent a specific type of vehicle.
Field Summary | |
---|---|
static java.lang.String |
EMERGENCY_BEACON_EVENT
|
static java.lang.String |
MAINTENANCE
|
static java.lang.String |
MALFUNCTION
|
protected MalfunctionManager |
malfunctionManager
|
static java.lang.String |
MOVING
|
static java.lang.String |
OPERATOR_EVENT
|
static java.lang.String |
PARKED
|
static double |
RANGE_ERROR_MARGIN
|
static java.lang.String |
RESERVED_EVENT
|
static java.lang.String |
SPEED_EVENT
|
static java.lang.String |
STATUS_EVENT
|
static java.lang.String |
TOWED
|
Fields inherited from class org.mars_sim.msp.simulation.Unit |
---|
CONTAINER_UNIT_EVENT, DESCRIPTION_EVENT, LOCATION_EVENT, MASS_EVENT, NAME_EVENT |
Constructor Summary | |
---|---|
protected |
Vehicle(java.lang.String name,
java.lang.String description,
Settlement settlement,
double baseSpeed,
double baseMass,
double fuelEfficiency)
Constructor to be used for testing. |
Method Summary | |
---|---|
void |
addDistanceLastMaintenance(double distance)
Adds a distance (in km.) to the vehicle's distance since last maintenance. |
void |
addTotalDistanceTraveled(double distance)
Adds a distance (in km.) to the vehicle's total distance traveled |
void |
addToTrail(Coordinates location)
Adds a location to the vehicle's trail if appropriate. |
void |
clearDistanceLastMaintenance()
Sets vehicle's distance since last maintenance to zero |
java.util.Collection<Person> |
getAffectedPeople()
Gets a collection of people affected by this entity. |
double |
getBaseSpeed()
Gets the base speed of vehicle |
Direction |
getDirection()
Returns direction of vehicle (0 = north, clockwise in radians) |
double |
getDistanceLastMaintenance()
Returns distance traveled by vehicle since last maintenance (in km.) |
double |
getEstimatedTravelDistancePerSol()
Gets the estimated distance traveled in one sol. |
double |
getFuelEfficiency()
Gets the fuel efficiency of the vehicle. |
abstract AmountResource |
getFuelType()
Gets the resource type that this vehicle uses for fuel. |
MalfunctionManager |
getMalfunctionManager()
Gets the unit's malfunction manager. |
VehicleOperator |
getOperator()
Gets the operator of the vehicle (person or AI) |
double |
getRange()
Gets the range of the vehicle |
Settlement |
getSettlement()
Returns the current settlement vehicle is parked at. |
double |
getSpeed()
Gets the speed of vehicle |
java.lang.String |
getStatus()
Returns vehicle's current status |
double |
getTotalDistanceTraveled()
Returns total distance traveled by vehicle (in km.) |
Vehicle |
getTowingVehicle()
Gets the vehicle that is currently towing this vehicle. |
java.util.Collection<Coordinates> |
getTrail()
Gets the vehicle's trail as a collection of coordinate locations. |
abstract boolean |
isAppropriateOperator(VehicleOperator operator)
Checks if a particular operator is appropriate for a vehicle. |
boolean |
isEmergencyBeacon()
Checks if the vehicle's emergency beacon is turned on. |
boolean |
isReserved()
Checks if the vehicle is reserved for any reason. |
boolean |
isReservedForMaintenance()
Checks if the vehicle is reserved for maintenance. |
boolean |
isReservedForMission()
Checks if the vehicle is reserved for a mission. |
void |
setBaseSpeed(double speed)
Sets the base speed of vehicle |
void |
setDirection(Direction direction)
Sets the vehicle's facing direction (0 = north, clockwise in radians) |
void |
setEmergencyBeacon(boolean isOn)
Sets the vehicle's emergency beacon on or off. |
void |
setOperator(VehicleOperator vehicleOperator)
Sets the operator of the vehicle |
void |
setReservedForMaintenance(boolean reserved)
Sets if the vehicle is reserved for maintenance or not. |
void |
setReservedForMission(boolean reserved)
Sets if the vehicle is reserved for a mission or not. |
void |
setSpeed(double speed)
Sets the vehicle's current speed |
void |
setTowingVehicle(Vehicle towingVehicle)
Sets the vehicle that is currently towing this vehicle. |
void |
timePassing(double time)
Time passing for vehicle. |
Methods inherited from class org.mars_sim.msp.simulation.Unit |
---|
addUnitListener, fireUnitUpdate, fireUnitUpdate, getBaseMass, getContainerUnit, getCoordinates, getDescription, getInventory, getMass, getName, getTopContainerUnit, getUnitManager, removeUnitListener, setBaseMass, setContainerUnit, setCoordinates, setDescription, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mars_sim.msp.simulation.malfunction.Malfunctionable |
---|
getInventory, getName |
Field Detail |
---|
public static final java.lang.String STATUS_EVENT
public static final java.lang.String SPEED_EVENT
public static final java.lang.String OPERATOR_EVENT
public static final java.lang.String EMERGENCY_BEACON_EVENT
public static final java.lang.String RESERVED_EVENT
public static final java.lang.String PARKED
public static final java.lang.String MOVING
public static final java.lang.String MALFUNCTION
public static final java.lang.String MAINTENANCE
public static final java.lang.String TOWED
public static final double RANGE_ERROR_MARGIN
protected MalfunctionManager malfunctionManager
Constructor Detail |
---|
protected Vehicle(java.lang.String name, java.lang.String description, Settlement settlement, double baseSpeed, double baseMass, double fuelEfficiency) throws java.lang.Exception
name
- the vehicle's namedescription
- the configuration description of the vehicle.settlement
- the settlement the vehicle is parked at.baseSpeed
- the base speed of the vehicle (kph)baseMass
- the base mass of the vehicle (kg)fuelEfficiency
- the fuel efficiency of the vehicle (km/kg)
java.lang.Exception
- if error constructing vehicleMethod Detail |
---|
public java.lang.String getStatus()
public boolean isReserved()
public boolean isReservedForMission()
public void setReservedForMission(boolean reserved)
reserved
- the vehicle's reserved for mission statuspublic boolean isReservedForMaintenance()
public void setReservedForMaintenance(boolean reserved)
reserved
- true if reserved for maintenancepublic void setTowingVehicle(Vehicle towingVehicle)
towingVehicle
- the vehiclepublic Vehicle getTowingVehicle()
public double getSpeed()
public void setSpeed(double speed)
speed
- the vehicle's speed (in km/hr)public double getBaseSpeed()
public void setBaseSpeed(double speed)
speed
- the vehicle's base speed (in km/hr)public double getRange() throws java.lang.Exception
java.lang.Exception
- if error getting range.public double getFuelEfficiency()
public double getTotalDistanceTraveled()
public void addTotalDistanceTraveled(double distance)
distance
- distance to add to total distance traveled (in km)public double getDistanceLastMaintenance()
public void addDistanceLastMaintenance(double distance)
distance
- distance to add (in km)public void clearDistanceLastMaintenance()
public Direction getDirection()
public void setDirection(Direction direction)
direction
- the direction the vehicle is travleling (in radians)public VehicleOperator getOperator()
public void setOperator(VehicleOperator vehicleOperator)
vehicleOperator
- the vehicle operatorpublic abstract boolean isAppropriateOperator(VehicleOperator operator)
operator
- the operator to check
public Settlement getSettlement()
public MalfunctionManager getMalfunctionManager()
getMalfunctionManager
in interface Malfunctionable
public void timePassing(double time) throws java.lang.Exception
timePassing
in class Unit
time
- the amount of time passing (millisols)
java.lang.Exception
- if error during time.public java.util.Collection<Person> getAffectedPeople()
getAffectedPeople
in interface Malfunctionable
public java.util.Collection<Coordinates> getTrail()
public void addToTrail(Coordinates location)
location
- location to be added to trailpublic abstract AmountResource getFuelType()
public double getEstimatedTravelDistancePerSol()
public boolean isEmergencyBeacon()
public void setEmergencyBeacon(boolean isOn)
isOn
- true if beacon is on.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |