|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jscience.architecture.lift.Tickable
org.jscience.architecture.lift.Passenger
public class Passenger
This file is licensed under the GNU Public Licens (GPL).
This is the fundamental class that simulated Passenger
s.
PassengerGenerator
,
PassengerProcessor
Field Summary | |
---|---|
static int |
FINISHED
The Passenger is finished it's travel, it is ready to
terminate in the PassengerProcessor s. |
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 |
---|
public static final int WAITING
Passenger
is waiting.
public static final int GETTING_IN
Passenger
is getting into a Car
.
public static final int TRAVELLING
Passenger
is travelling in a Car
.
public static final int GETTING_OUT
Passenger
is getting out from a Car
.
public static final int FINISHED
Passenger
is finished it's travel, it is ready to
terminate in the PassengerProcessor
s.
public static final java.util.Random PassengerRandom
Random
entity used to generate pseudorandom numbers
for the Passenger
class.
protected int Progress
Passenger
's current action.
protected Car TravelCar
Car
in which the Passenger
is travelling in.
protected int GetInTime
Passenger
to get in into the Car
protected int GetOutTime
Passenger
to get out of the Car
Constructor Detail |
---|
public Passenger(int FromFloor, int ToFloor)
Passenger(FromFloor,ToFloor,true).
FromFloor
- The Passenger
's source floorToFloor
- The Passenger
's destination floorpublic Passenger(int FromFloor, int ToFloor, boolean AbsFloor)
FromFloor
- The Passenger
's source floorToFloor
- The Passenger
's destination floorAbsFloor
- 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 |
---|
public void Tick()
TickableInterface
Tick
in interface TickableInterface
Tick
in class Tickable
public int get12Progress()
Passenger
in a [0,12]
scale instead of the usual [0,1]
scale.
public int getAngerLevel()
Anger Level
.
public int getCreationTime()
Creation Time
.
public int getCrtF()
Current Floor
.
public int getDstF()
Destination Floor
.
public int getSrcF()
Source Floor
.
public java.lang.String getName()
TickableInterface
getName
in interface TickableInterface
getName
in class Tickable
public int getState()
State
.
public int getTicksTravelled()
Ticks
travelled.
public int getTicksWaited()
Ticks
waited.
public java.lang.String getVersion()
TickableInterface
getVersion
in interface TickableInterface
getVersion
in class Tickable
public void increaseDstF()
Destination Floor
.
Pretty neat. Ruins some calls sometimes. Used only when demonstrating
the GUI. TODO: replace it later with a "New Passenger Wizard"
public void mayPushButtons(InOutput IO)
World
every time the Passenger
may
push one or more of the given InOutput
IO.
IO
- DOCUMENT ME!public boolean decideGetIn(InOutput CarIO)
World
every time the Passenger
may
decide to get into a the given Car
C with the given indicator
InOutput
IO.
CarIO
- DOCUMENT ME!
public void finishGetIn()
World
, this function switches the Passenger
from GETTING_IN
to TRAVELLING
public void finishGetOut()
World
, this function switches the Passenger
from GETTING_OUT
to FINISHED
public void startGetIn(Car C)
World
, this function switches the Passenger
from WAITING
to GETTING_IN
C
- DOCUMENT ME!public void startGetOut()
World
, this function switches the Passenger
from TRAVELLING
to GETTING_OUT
public java.lang.String toString()
Object
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |