|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.core.Unit
org.mars_sim.msp.core.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 String |
EMERGENCY_BEACON_EVENT
|
static String |
MAINTENANCE
|
static String |
MALFUNCTION
|
protected MalfunctionManager |
malfunctionManager
|
static String |
MOVING
|
static String |
OPERATOR_EVENT
|
static String |
PARKED
|
static double |
RANGE_ERROR_MARGIN
|
static String |
RESERVED_EVENT
|
static String |
SPEED_EVENT
|
static String |
STATUS_EVENT
|
static String |
TOWED
|
| Fields inherited from class org.mars_sim.msp.core.Unit |
|---|
CONTAINER_UNIT_EVENT, DESCRIPTION_EVENT, LOCATION_EVENT, MASS_EVENT, NAME_EVENT |
| Constructor Summary | |
|---|---|
protected |
Vehicle(String name,
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 |
void |
destroy()
Prepare object for garbage collection. |
abstract void |
determinedSettlementParkedLocationAndFacing()
Set initial parked location and facing at settlement. |
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 |
getFacing()
Gets the object's facing. |
double |
getFuelEfficiency()
Gets the fuel efficiency of the vehicle. |
abstract AmountResource |
getFuelType()
Gets the resource type that this vehicle uses for fuel. |
double |
getLength()
Gets the object's length. |
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 |
SalvageInfo |
getSalvageInfo()
Gets the salvage info. |
Settlement |
getSettlement()
Returns the current settlement vehicle is parked at. |
double |
getSpeed()
Gets the speed of vehicle |
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. |
Collection<Coordinates> |
getTrail()
Gets the vehicle's trail as a collection of coordinate locations. |
double |
getWidth()
Gets the object's width. |
double |
getXLocation()
Gets the X location of the object from the local area's center point. |
double |
getYLocation()
Gets the Y location of the object from the local area's center point. |
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. |
boolean |
isSalvaged()
Checks if the item is salvaged. |
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 |
setParkedLocation(double xLocation,
double yLocation,
double facing)
Sets the location and facing of the vehicle when parked at a settlement. |
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 |
startSalvage(SalvageProcessInfo info,
Settlement settlement)
Indicate the start of a salvage process on the item. |
void |
timePassing(double time)
Time passing for vehicle. |
| Methods inherited from class org.mars_sim.msp.core.Unit |
|---|
addUnitListener, compareTo, fireUnitUpdate, fireUnitUpdate, getBaseMass, getContainerUnit, getCoordinates, getDescription, getInventory, getMass, getName, getTopContainerUnit, getUnitManager, hasUnitListener, 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.core.malfunction.Malfunctionable |
|---|
getInventory, getName |
| Field Detail |
|---|
public static final String STATUS_EVENT
public static final String SPEED_EVENT
public static final String OPERATOR_EVENT
public static final String EMERGENCY_BEACON_EVENT
public static final String RESERVED_EVENT
public static final String PARKED
public static final String MOVING
public static final String MALFUNCTION
public static final String MAINTENANCE
public static final String TOWED
public static final double RANGE_ERROR_MARGIN
protected MalfunctionManager malfunctionManager
| Constructor Detail |
|---|
protected Vehicle(String name,
String description,
Settlement settlement,
double baseSpeed,
double baseMass,
double fuelEfficiency)
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)
Exception - if error constructing vehicle| Method Detail |
|---|
public double getWidth()
LocalBoundedObject
getWidth in interface LocalBoundedObjectpublic double getLength()
LocalBoundedObject
getLength in interface LocalBoundedObjectpublic double getXLocation()
LocalBoundedObject
getXLocation in interface LocalBoundedObjectpublic double getYLocation()
LocalBoundedObject
getYLocation in interface LocalBoundedObjectpublic double getFacing()
LocalBoundedObject
getFacing in interface LocalBoundedObject
public void setParkedLocation(double xLocation,
double yLocation,
double facing)
xLocation - the x location (meters from settlement center - West: positive, East: negative).yLocation - the y location (meters from settlement center - North: positive, South: negative).facing - (degrees from North clockwise).public 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()
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 Malfunctionablepublic void timePassing(double time)
timePassing in class Unittime - the amount of time passing (millisols)
Exception - if error during time.public Collection<Person> getAffectedPeople()
getAffectedPeople in interface Malfunctionablepublic 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.public boolean isSalvaged()
isSalvaged in interface Salvagable
public void startSalvage(SalvageProcessInfo info,
Settlement settlement)
startSalvage in interface Salvagableinfo - the salvage process info.settlement - the settlement where the salvage is taking place.public SalvageInfo getSalvageInfo()
getSalvageInfo in interface Salvagablepublic abstract void determinedSettlementParkedLocationAndFacing()
public void destroy()
Unit
destroy in class Unit
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||