org.intranet.elevator.model.operate
Class Person

java.lang.Object
  extended byorg.intranet.sim.ModelElement
      extended byorg.intranet.elevator.model.operate.Person

public final class Person
extends ModelElement

A Person moves around the building, calling elevators, entering elevators, and leaving elevators. Person states:

State Variables Transitions
destination currentLocation setDestination() CarRequestPanel
[arrivedUp/Down]
Door
[doorClosed]
Car
[docked]
Door
[doorOpened]
[leftCar]
Idle null Set Idle if destination is same
pressButton(): Waiting if elevator is elsewhere
enterCar(): Travelling if elevator is there
Impossible Impossible Impossible Impossible Impossible
Waiting Set Set to Floor Illegal? enterCar(): Travelling if success
waitForDoorClose(): DoorClosing if car is full
Impossible Impossible Impossible Impossible
DoorClosing Set Set to Floor Illegal? Impossible doorClosed(): Waiting via pressedUp/Down() Impossible Impossible Impossible
Travelling Set Set to Car Illegal? Impossible Impossible waitForDoorOpen(): DoorOpening Impossible Impossible
DoorOpening Set Set to Car Illegal? Impossible Impossible Impossible leaveCar(): LeavingCar Impossible
LeavingCar Set Set to Car Illegal? Impossible Impossible Impossible Impossible Idle
Moving Set ?? Illegal Impossible Impossible: Door is obstructed Impossible Impossible Impossible


Field Summary
private  CarRequestPanel.ArrivalListener arrivalListener
           
private  Location currentLocation
           
private  Floor destination
           
private  java.util.Map doorListenerMap
           
private  int percentMoved
           
private  java.util.Map sensorListenerMap
           
private  long startTravelTime
           
private  long startWaitTime
           
private  long totalTravelTime
           
private  long totalWaitingTime
           
 
Fields inherited from class org.intranet.sim.ModelElement
eventQueue
 
Constructor Summary
(package private) Person(EventQueue eQ, Location startLocation)
           
 
Method Summary
private  void beginEnterCar(CarEntrance entrance)
           
private  void beginTravel()
           
private  void beginWaiting()
           
private  void endTravel()
           
private  void endWaiting()
           
private  void enterCar(CarEntrance carEntrance)
          The person enters the car through the specified entrance.
 Floor getDestination()
           
 int getPercentMoved()
           
 long getTotalTime()
           
 long getTotalTravelTime()
           
 long getTotalWaitingTime()
           
private  void leaveCar()
          When a person arrives at the destination, this is all the processing that has to happen.
private  void movePerson(Location destination)
          Move the person to the specified destination.
private  void payAttentionToEntrance(CarEntrance entrance, boolean up)
           
 void setDestination(Floor newDestination)
           
private  void startPayingAttention(boolean up)
           
private  void stopPayingAttention()
           
private  void tryToEnterCar(boolean up)
           
private  void waitForDoorOpen(Door arrivalDoor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

destination

private Floor destination

currentLocation

private Location currentLocation

percentMoved

private int percentMoved

sensorListenerMap

private java.util.Map sensorListenerMap

doorListenerMap

private java.util.Map doorListenerMap

arrivalListener

private CarRequestPanel.ArrivalListener arrivalListener

totalWaitingTime

private long totalWaitingTime

startWaitTime

private long startWaitTime

totalTravelTime

private long totalTravelTime

startTravelTime

private long startTravelTime
Constructor Detail

Person

Person(EventQueue eQ,
       Location startLocation)
Method Detail

setDestination

public void setDestination(Floor newDestination)

startPayingAttention

private void startPayingAttention(boolean up)

payAttentionToEntrance

private void payAttentionToEntrance(CarEntrance entrance,
                                    boolean up)

stopPayingAttention

private void stopPayingAttention()

tryToEnterCar

private void tryToEnterCar(boolean up)

beginEnterCar

private void beginEnterCar(CarEntrance entrance)

beginWaiting

private void beginWaiting()

endWaiting

private void endWaiting()

beginTravel

private void beginTravel()

endTravel

private void endTravel()

getTotalWaitingTime

public long getTotalWaitingTime()

getTotalTravelTime

public long getTotalTravelTime()

getTotalTime

public long getTotalTime()

getDestination

public Floor getDestination()

leaveCar

private void leaveCar()
When a person arrives at the destination, this is all the processing that has to happen.


enterCar

private void enterCar(CarEntrance carEntrance)
The person enters the car through the specified entrance. This method is called after the TrackingUpdateEvent that animates moving the person to the elevator car has completed.

Parameters:
carEntrance - The entrance to the car.

movePerson

private void movePerson(Location destination)
Move the person to the specified destination.

Parameters:
destination - Where the person moves to.

waitForDoorOpen

private void waitForDoorOpen(Door arrivalDoor)

getPercentMoved

public int getPercentMoved()