edu.lmu.liftor
Class Traveller.FloorTraveller

java.lang.Object
  |
  +--edu.lmu.liftor.Traveller
        |
        +--edu.lmu.liftor.Traveller.FloorTraveller
All Implemented Interfaces:
Person.Personality
Direct Known Subclasses:
Traveller.RandomFloorTraveller
Enclosing class:
Traveller

public abstract static class Traveller.FloorTraveller
extends Traveller

A floor traveller is a traveller that moves about the building with a sense of direction. Through repated calls to the pickFloor() and doFloor() methods these types of travellers actively choose where they want to go and then set about making it there. Albeit with some signifigant limitations.


Nested Class Summary
 
Nested classes inherited from class edu.lmu.liftor.Traveller
Traveller.FloorTraveller, Traveller.RandomFloorTraveller, Traveller.VagrantTraveller
 
Field Summary
protected  Floor destination
           
 
Fields inherited from class edu.lmu.liftor.Traveller
journeyStart, travelReports, travelTime, VAGRANT
 
Constructor Summary
protected Traveller.FloorTraveller()
           
 
Method Summary
protected abstract  int doFloor(Person p)
          This method is called when the Traveller is not in an elevator.
 java.lang.String getName()
          Returns the name of this personality.
protected  boolean leaveFloor(Person p)
          Called to see if the traveller wants to leave the floor.
 int motivate(Person p)
          Motivate this person.
protected abstract  Floor pickFloor(Person p)
          This method must return the floor that this traveller wants to go to.
 
Methods inherited from class edu.lmu.liftor.Traveller
beginJourney, endJourney, getLastJourneyTime, inTransit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

destination

protected Floor destination
Constructor Detail

Traveller.FloorTraveller

protected Traveller.FloorTraveller()
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Person.Personality
Returns the name of this personality. Preferably an adverb.

Specified by:
getName in interface Person.Personality
Overrides:
getName in class Traveller

pickFloor

protected abstract Floor pickFloor(Person p)
This method must return the floor that this traveller wants to go to. It is free to take as long as it wants, but it has to eventually give a valid floor to travel to.


doFloor

protected abstract int doFloor(Person p)
This method is called when the Traveller is not in an elevator. The number returned is the delay until this traveller needs to be processed again.


leaveFloor

protected boolean leaveFloor(Person p)
Called to see if the traveller wants to leave the floor.


motivate

public int motivate(Person p)
Description copied from interface: Person.Personality
Motivate this person. This method is repeatedly called so long as this is the given Person's dominant personality. In essence, it should decide upon a goal, execute that goal, then return so that it may be called again to repeat the goal selection and execution process. A personality may take as little or as long as it wants to complete its objective, it may even decide to store state and return knowing it will (most likely) be called again. The number that is returned is the number of milliseconds that the Personality is willing to wait for another chance to execute. While there is no guarantee that motivate() will be called again within that time, it allows the use of a thread pool to move persons around in the game. If the quantity returned is negative, that is the maximum amount of time that the Personality would like to have elapse before the next call. If it is a postive number, that is the minimum amount of time and the Personality is willing to allow more time to elapse if necessary.