org.mars_sim.msp.core.structure.building.function
Class VehicleMaintenance

java.lang.Object
  extended by org.mars_sim.msp.core.structure.building.function.Function
      extended by org.mars_sim.msp.core.structure.building.function.VehicleMaintenance
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GroundVehicleMaintenance

public abstract class VehicleMaintenance
extends Function
implements Serializable

The VehicleMaintenance interface is a building function for a building capable of maintaining vehicles.

See Also:
Serialized Form

Nested Class Summary
 class VehicleMaintenance.ParkingLocation
          Inner class to represent a parking location in the building.
 
Field Summary
protected  List<VehicleMaintenance.ParkingLocation> parkingLocations
           
protected  int vehicleCapacity
           
 
Constructor Summary
VehicleMaintenance(String name, Building building)
          Constructor
 
Method Summary
protected  void addParkingLocation(double xLocation, double yLocation)
          Add a new parking location in the building.
 void addVehicle(Vehicle vehicle)
          Add vehicle to building if there's room.
 boolean containsVehicle(Vehicle vehicle)
          Checks if a vehicle is in the building.
 void destroy()
          Prepare object for garbage collection.
 int getCurrentVehicleNumber()
          Gets the current number of vehicles in the building.
 VehicleMaintenance.ParkingLocation getEmptyParkingLocation()
          Gets an empty parking location.
 double getFullPowerRequired()
          Gets the amount of power required when function is at full power.
 double getPowerDownPowerRequired()
          Gets the amount of power required when function is at power down level.
 int getVehicleCapacity()
          Gets the number of vehicles the building can accommodate.
 VehicleMaintenance.ParkingLocation getVehicleParkedLocation(Vehicle vehicle)
          Gets the parking location of a given parked vehicle.
 Collection<Vehicle> getVehicles()
          Gets a collection of vehicles in the building.
 void removeVehicle(Vehicle vehicle)
          Remove vehicle from building if it's in the building.
 void timePassing(double time)
          Time passing for the building.
 
Methods inherited from class org.mars_sim.msp.core.structure.building.function.Function
getBuilding, getMalfunctionScopeStrings, getName, removeFromSettlement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vehicleCapacity

protected int vehicleCapacity

parkingLocations

protected List<VehicleMaintenance.ParkingLocation> parkingLocations
Constructor Detail

VehicleMaintenance

public VehicleMaintenance(String name,
                          Building building)
Constructor

Parameters:
name - the name of the child function.
building - the building this function is for.
Method Detail

getVehicleCapacity

public int getVehicleCapacity()
Gets the number of vehicles the building can accommodate.

Returns:
vehicle capacity

getCurrentVehicleNumber

public int getCurrentVehicleNumber()
Gets the current number of vehicles in the building.

Returns:
number of vehicles

addVehicle

public void addVehicle(Vehicle vehicle)
Add vehicle to building if there's room.

Parameters:
vehicle - the vehicle to be added.
Throws:
BuildingException - if vehicle cannot be added.

removeVehicle

public void removeVehicle(Vehicle vehicle)
Remove vehicle from building if it's in the building.

Parameters:
vehicle - the vehicle to be removed.
Throws:
BuildingException - if vehicle is not in the building.

containsVehicle

public boolean containsVehicle(Vehicle vehicle)
Checks if a vehicle is in the building.

Returns:
true if vehicle is in the building.

getVehicles

public Collection<Vehicle> getVehicles()
Gets a collection of vehicles in the building.

Returns:
Collection of vehicles in the building.

timePassing

public void timePassing(double time)
Time passing for the building.

Specified by:
timePassing in class Function
Parameters:
time - amount of time passing (in millisols)
Throws:
BuildingException - if error occurs.

getFullPowerRequired

public double getFullPowerRequired()
Gets the amount of power required when function is at full power.

Specified by:
getFullPowerRequired in class Function
Returns:
power (kW)

getPowerDownPowerRequired

public double getPowerDownPowerRequired()
Gets the amount of power required when function is at power down level.

Specified by:
getPowerDownPowerRequired in class Function
Returns:
power (kW)

addParkingLocation

protected void addParkingLocation(double xLocation,
                                  double yLocation)
Add a new parking location in the building.

Parameters:
xLocation - the relative X location of the parking spot.
yLocation - the relative Y location of the parking spot.

getVehicleParkedLocation

public VehicleMaintenance.ParkingLocation getVehicleParkedLocation(Vehicle vehicle)
Gets the parking location of a given parked vehicle.

Parameters:
vehicle - the parked vehicle.
Returns:
the parking location or null if none.

getEmptyParkingLocation

public VehicleMaintenance.ParkingLocation getEmptyParkingLocation()
Gets an empty parking location.

Returns:
empty parking location or null if none available.

destroy

public void destroy()
Description copied from class: Function
Prepare object for garbage collection.

Overrides:
destroy in class Function


Copyright © 2009-2013. All Rights Reserved.