org.jscience.architecture.lift
Class Passenger

java.lang.Object
  extended by org.jscience.architecture.lift.Tickable
      extended by org.jscience.architecture.lift.Passenger
All Implemented Interfaces:
TickableInterface

public class Passenger
extends Tickable

This file is licensed under the GNU Public Licens (GPL).
This is the fundamental class that simulated Passengers.

See Also:
PassengerGenerator, PassengerProcessor

Field Summary
static int FINISHED
          The Passenger is finished it's travel, it is ready to terminate in the PassengerProcessors.
protected  int GetInTime
          The time needed by the Passenger to get in into the Car
protected  int GetOutTime
          The time needed by the Passenger to get out of the Car
static int GETTING_IN
          The Passenger is getting into a Car.
static int GETTING_OUT
          The Passenger is getting out from a Car.
static java.util.Random PassengerRandom
          The (in this case, absolutely not) random seed used by the Random entity used to generate pseudorandom numbers for the Passenger class.
protected  int Progress
          The current progress of the Passenger's current action.
protected  Car TravelCar
          The Car in which the Passenger is travelling in.
static int TRAVELLING
          The Passenger is travelling in a Car.
static int WAITING
          The Passenger is waiting.
 
Constructor Summary
Passenger(int FromFloor, int ToFloor)
          Constructor.
Passenger(int FromFloor, int ToFloor, boolean AbsFloor)
          Constructor.
 
Method Summary
 boolean decideGetIn(InOutput CarIO)
          Called by the World every time the Passenger may decide to get into a the given Car C with the given indicator InOutput IO.
 void finishGetIn()
          Called by the World, this function switches the Passenger from GETTING_IN to TRAVELLING
 void finishGetOut()
          Called by the World, this function switches the Passenger from GETTING_OUT to FINISHED
 int get12Progress()
          Returns the progress of the Passenger in a [0,12] scale instead of the usual [0,1] scale.
 int getAngerLevel()
          Returns the Anger Level.
 int getCreationTime()
          Returns the Creation Time.
 int getCrtF()
          Returns the Current Floor.
 int getDstF()
          Returns the Destination Floor.
 java.lang.String getName()
          Returns the Name of the object.
 int getSrcF()
          Returns the Source Floor.
 int getState()
          Returns the State.
 int getTicksTravelled()
          Returns the number of Ticks travelled.
 int getTicksWaited()
          Returns the number of Ticks waited.
 java.lang.String getVersion()
          Returns the Version of the object
 void increaseDstF()
          Called by the GUI to increase the Destination Floor.
 void mayPushButtons(InOutput IO)
          Called by the World every time the Passenger may push one or more of the given InOutput IO.
 void startGetIn(Car C)
          Called by the World, this function switches the Passenger from WAITING to GETTING_IN
 void startGetOut()
          Called by the World, this function switches the Passenger from TRAVELLING to GETTING_OUT
 void Tick()
          This function is called in each step of the simulator.
 java.lang.String toString()
          Object
 
Methods inherited from class org.jscience.architecture.lift.Tickable
getFullName, getID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WAITING

public static final int WAITING
The Passenger is waiting.

See Also:
Constant Field Values

GETTING_IN

public static final int GETTING_IN
The Passenger is getting into a Car.

See Also:
Constant Field Values

TRAVELLING

public static final int TRAVELLING
The Passenger is travelling in a Car.

See Also:
Constant Field Values

GETTING_OUT

public static final int GETTING_OUT
The Passenger is getting out from a Car.

See Also:
Constant Field Values

FINISHED

public static final int FINISHED
The Passenger is finished it's travel, it is ready to terminate in the PassengerProcessors.

See Also:
Constant Field Values

PassengerRandom

public static final java.util.Random PassengerRandom
The (in this case, absolutely not) random seed used by the Random entity used to generate pseudorandom numbers for the Passenger class.


Progress

protected int Progress
The current progress of the Passenger's current action.


TravelCar

protected Car TravelCar
The Car in which the Passenger is travelling in.


GetInTime

protected int GetInTime
The time needed by the Passenger to get in into the Car


GetOutTime

protected int GetOutTime
The time needed by the Passenger to get out of the Car

Constructor Detail

Passenger

public Passenger(int FromFloor,
                 int ToFloor)
Constructor. Calls Passenger(FromFloor,ToFloor,true).

Parameters:
FromFloor - The Passenger's source floor
ToFloor - The Passenger's destination floor

Passenger

public Passenger(int FromFloor,
                 int ToFloor,
                 boolean AbsFloor)
Constructor. The tricky one.

Parameters:
FromFloor - The Passenger's source floor
ToFloor - The Passenger's destination floor
AbsFloor - This must be set to true if the above parameters are given in "absolute floors" and not in "building floors". For example, if the building has [-2,5] floors, the lowest floor is 0 in absolute floors and -2 in building floors.
Method Detail

Tick

public void Tick()
Description copied from interface: TickableInterface
This function is called in each step of the simulator. In other words, this method is called whenever a discrete simulation step (0.1 second) happens. All objects that are time-variant is notified by this method that some time has elapsed since.

Specified by:
Tick in interface TickableInterface
Specified by:
Tick in class Tickable

get12Progress

public int get12Progress()
Returns the progress of the Passenger in a [0,12] scale instead of the usual [0,1] scale.

Returns:
DOCUMENT ME!

getAngerLevel

public int getAngerLevel()
Returns the Anger Level.

Returns:
DOCUMENT ME!

getCreationTime

public int getCreationTime()
Returns the Creation Time.

Returns:
DOCUMENT ME!

getCrtF

public int getCrtF()
Returns the Current Floor.

Returns:
DOCUMENT ME!

getDstF

public int getDstF()
Returns the Destination Floor.

Returns:
DOCUMENT ME!

getSrcF

public int getSrcF()
Returns the Source Floor.

Returns:
DOCUMENT ME!

getName

public java.lang.String getName()
Description copied from interface: TickableInterface
Returns the Name of the object.

Specified by:
getName in interface TickableInterface
Specified by:
getName in class Tickable
Returns:
DOCUMENT ME!

getState

public int getState()
Returns the State.

Returns:
DOCUMENT ME!

getTicksTravelled

public int getTicksTravelled()
Returns the number of Ticks travelled.

Returns:
DOCUMENT ME!

getTicksWaited

public int getTicksWaited()
Returns the number of Ticks waited.

Returns:
DOCUMENT ME!

getVersion

public java.lang.String getVersion()
Description copied from interface: TickableInterface
Returns the Version of the object

Specified by:
getVersion in interface TickableInterface
Specified by:
getVersion in class Tickable
Returns:
DOCUMENT ME!

increaseDstF

public void increaseDstF()
Called by the GUI to increase the Destination Floor. Pretty neat. Ruins some calls sometimes. Used only when demonstrating the GUI. TODO: replace it later with a "New Passenger Wizard"


mayPushButtons

public void mayPushButtons(InOutput IO)
Called by the World every time the Passenger may push one or more of the given InOutput IO.

Parameters:
IO - DOCUMENT ME!

decideGetIn

public boolean decideGetIn(InOutput CarIO)
Called by the World every time the Passenger may decide to get into a the given Car C with the given indicator InOutput IO.

Parameters:
CarIO - DOCUMENT ME!
Returns:
DOCUMENT ME!

finishGetIn

public void finishGetIn()
Called by the World, this function switches the Passenger from GETTING_IN to TRAVELLING


finishGetOut

public void finishGetOut()
Called by the World, this function switches the Passenger from GETTING_OUT to FINISHED


startGetIn

public void startGetIn(Car C)
Called by the World, this function switches the Passenger from WAITING to GETTING_IN

Parameters:
C - DOCUMENT ME!

startGetOut

public void startGetOut()
Called by the World, this function switches the Passenger from TRAVELLING to GETTING_OUT


toString

public java.lang.String toString()
Object

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!