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

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

public abstract class VehicleMaintenance
extends Function
implements java.io.Serializable

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

See Also:
Serialized Form

Field Summary
protected  int vehicleCapacity
           
 
Constructor Summary
VehicleMaintenance(java.lang.String name, Building building)
          Constructor
 
Method Summary
 void addVehicle(Vehicle vehicle)
          Add vehicle to building if there's room.
 boolean containsVehicle(Vehicle vehicle)
          Checks if a vehicle is in the building.
 int getCurrentVehicleNumber()
          Gets the current number of vehicles in the building.
 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.
 java.util.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.simulation.structure.building.function.Function
getBuilding, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vehicleCapacity

protected int vehicleCapacity
Constructor Detail

VehicleMaintenance

public VehicleMaintenance(java.lang.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)
                throws BuildingException
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)
                   throws BuildingException
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 java.util.Collection<Vehicle> getVehicles()
Gets a collection of vehicles in the building.

Returns:
Collection of vehicles in the building.

timePassing

public void timePassing(double time)
                 throws BuildingException
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)