|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.simulation.Passenger
public class Passenger
A class representing passengers in the elevator simulation for Dr. Warner's MTHSC 865 class at Clemson University.
Nested Class Summary | |
---|---|
static class |
Passenger.FloorTimePair
A simple class representing a floor and time pair, telling us what floor we need to be at and how much time we'll spend there. |
static class |
Passenger.State
The possible states the passenger may be in. |
Constructor Summary | |
---|---|
Passenger(java.util.List<Passenger.FloorTimePair> schedule,
DepartmentStore deptStore)
Create a new passenger with the given schedule, a list of FloorTimePair objects. |
|
Passenger(java.util.List<Passenger.FloorTimePair> schedule,
DepartmentStore deptStore,
int maxWaitingTime,
int walkingTime,
int loadingTime,
int unloadingTime)
Create a new passenger with the given schedule, a list of FloorTimePair objects. |
Method Summary | |
---|---|
void |
balk()
Stop waiting for the elevator and take the stairs. |
BalkEvent |
getBalkEvent()
Get the BalkEvent associated with this passenger. |
int |
getCurrentFloor()
Get the floor the passenger is currently on. |
Passenger.FloorTimePair |
getCurrentFloorTimePair()
Get the FloorTimePair of the passenger's current
task. |
int |
getLoadingTime()
Get the amount of time it takes the passenger to get onto the elevator. |
int |
getMaxWait()
Get the maximum amount of time the passenger is willing to wait on the elevator before taking the stairs. |
int |
getNextFloor()
See which floor the passenger's next task is on. |
Passenger.FloorTimePair |
getNextFloorTimePair()
Get the next FloorTimePair , telling us where the
passenger needs to go next. |
int |
getNumBalks()
Get the number of times the passenger has balked. |
java.util.List<Passenger.FloorTimePair> |
getSchedule()
Retrieve the passenger's schedule. |
Passenger.State |
getState()
The passenger's current state. |
java.lang.Integer[] |
getTravelTimes()
Get an array of the times the passenger spent travelling on the elevator. |
int |
getUnloadingTime()
Get the amount of time it takes the passenger to get off of the elevator. |
java.lang.Integer[] |
getWaitingTimes()
Get an array of the times the passenger spent waiting on the elevator. |
int |
getWalkingTime()
Get the amount of time it takes the passenger to walk up or down a flight of stairs. |
boolean |
hasMoreToDo()
See if the passenger has more tasks they need to complete. |
void |
removeBalkEvent()
Remove the BalkEvent associated with this passenger. |
void |
setBalkEvent(BalkEvent e)
Tell the passenger which BalkEvent they're
associated with. |
java.lang.String |
toString()
Get a String representation of the passenger. |
void |
updateTime()
Update the passenger's time records. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Passenger(java.util.List<Passenger.FloorTimePair> schedule, DepartmentStore deptStore)
schedule
- The passenger's schedule.deptStore
- The department store the passenger is visiting.public Passenger(java.util.List<Passenger.FloorTimePair> schedule, DepartmentStore deptStore, int maxWaitingTime, int walkingTime, int loadingTime, int unloadingTime)
schedule
- The passenger's schedule.deptStore
- The department store the passenger is visiting.maxWaitingTime
- The maximum amount of time the passenger
will wait on the elevator before taking the stairs.walkingTime
- The amount of time it takes the passenger to
walk up and down one flight of stairs.loadingTime
- The time it takes the passenger to get onto
the elevator.unloadingTime
- The time it takes the passenger to get off
of the elevator.Method Detail |
---|
public Passenger.State getState()
public int getWalkingTime()
public int getMaxWait()
public int getLoadingTime()
public int getUnloadingTime()
public void updateTime()
public void setBalkEvent(BalkEvent e)
BalkEvent
they're
associated with.
public BalkEvent getBalkEvent()
BalkEvent
associated with this passenger.
BalkEvent
associated with the passenger.public void removeBalkEvent()
BalkEvent
associated with this passenger.
public void balk()
public int getNumBalks()
public java.util.List<Passenger.FloorTimePair> getSchedule()
public boolean hasMoreToDo()
public Passenger.FloorTimePair getNextFloorTimePair()
FloorTimePair
, telling us where the
passenger needs to go next.
public int getNextFloor()
public java.lang.Integer[] getWaitingTimes()
public java.lang.Integer[] getTravelTimes()
public Passenger.FloorTimePair getCurrentFloorTimePair()
FloorTimePair
of the passenger's current
task.
null
will be returned.public int getCurrentFloor()
public java.lang.String toString()
String
representation of the passenger.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |