org.mars_sim.msp.simulation
Class Airlock

java.lang.Object
  extended by org.mars_sim.msp.simulation.Airlock
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BuildingAirlock, VehicleAirlock

public abstract class Airlock
extends java.lang.Object
implements java.io.Serializable

The Airlock class represents an airlock to a vehicle or structure.

See Also:
Serialized Form

Field Summary
protected  boolean pressurized
           
 
Constructor Summary
Airlock(int capacity)
          Constructs an airlock object for a unit.
 
Method Summary
 boolean activateAirlock()
          Activates the airlock if it is not already activated.
 double addActivationTime(double time)
          Activate the airlock for a period of time.
 boolean enterAirlock(Person person, boolean inside)
          Enters a person into the airlock from either the inside or the outside.
protected abstract  void exitAirlock(Person person)
          Causes a person within the airlock to exit either inside or outside.
abstract  Inventory getEntityInventory()
          Gets the inventory of the entity this airlock is attached to.
abstract  java.lang.String getEntityName()
          Gets the name of the entity this airlock is attached to.
 boolean inAirlock(Person person)
          Checks if given person is currently in the airlock.
 boolean isInnerDoorOpen()
          Checks if the airlock's inner door is open.
 boolean isOuterDoorOpen()
          Checks if the airlock's outer door is open.
 void timePassing(double time)
          Operates the airlock for the given amount of time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pressurized

protected boolean pressurized
Constructor Detail

Airlock

public Airlock(int capacity)
        throws java.lang.IllegalArgumentException
Constructs an airlock object for a unit.

Parameters:
capacity - number of people airlock can hold.
Throws:
java.lang.IllegalArgumentException - if capacity is less than one.
Method Detail

enterAirlock

public boolean enterAirlock(Person person,
                            boolean inside)
Enters a person into the airlock from either the inside or the outside. Inner or outer door (respectively) must be open for person to enter.

Parameters:
person - the person to enter the airlock
inside - true if person is entering from inside false if person is entering from outside
Returns:
true if person entered the airlock successfully

activateAirlock

public boolean activateAirlock()
Activates the airlock if it is not already activated. Automatically closes both doors and starts pressurizing/depressurizing.

Returns:
true if airlock was successfully activated

addActivationTime

public double addActivationTime(double time)
Activate the airlock for a period of time.

Parameters:
time - activation time (millisols)
Returns:
time remaining after activation (millisols)

exitAirlock

protected abstract void exitAirlock(Person person)
                             throws java.lang.Exception
Causes a person within the airlock to exit either inside or outside.

Parameters:
person - the person to exit.
Throws:
java.lang.Exception - if person is not in the airlock.

isOuterDoorOpen

public boolean isOuterDoorOpen()
Checks if the airlock's outer door is open.

Returns:
true if outer door is open

isInnerDoorOpen

public boolean isInnerDoorOpen()
Checks if the airlock's inner door is open.

Returns:
true if inner door is open

timePassing

public void timePassing(double time)
Operates the airlock for the given amount of time. Called from the unit owning the airlock.

Parameters:
time - amount of time (in millisols)

inAirlock

public boolean inAirlock(Person person)
Checks if given person is currently in the airlock.

Parameters:
person - to be checked
Returns:
true if person is in airlock

getEntityName

public abstract java.lang.String getEntityName()
Gets the name of the entity this airlock is attached to.

Returns:
name

getEntityInventory

public abstract Inventory getEntityInventory()
Gets the inventory of the entity this airlock is attached to.

Returns:
inventory