edu.lmu.liftor
Class Place.PlaceImpl

java.lang.Object
  |
  +--edu.lmu.liftor.Place.PlaceImpl
All Implemented Interfaces:
Place
Direct Known Subclasses:
Building, Elevator, Floor
Enclosing class:
Place

public static class Place.PlaceImpl
extends java.lang.Object
implements Place

A simple implementation of a Place that tracks and dispatches entrys and exits.


Nested Class Summary
 
Nested classes inherited from class edu.lmu.liftor.Place
Place.PlaceFullException, Place.PlaceImpl
 
Field Summary
 
Fields inherited from interface edu.lmu.liftor.Place
LIMBO
 
Constructor Summary
Place.PlaceImpl(java.lang.String name)
           
Place.PlaceImpl(java.lang.String name, int capacity)
           
 
Method Summary
 void enter(Visitor visitor)
          Add the visitor to this place.
 void exit(Visitor visitor)
          The given visitor wishes to exit the place.
 int getPlaceCapacity()
          Returns the maximum number of Visitors that can be in this place.
 java.lang.String getPlaceName()
           
 int getVisitorCount()
          Returns the number of Visitors that are currently in this place.
 boolean isFull()
          Returns whether this place is full right now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Place.PlaceImpl

public Place.PlaceImpl(java.lang.String name,
                       int capacity)

Place.PlaceImpl

public Place.PlaceImpl(java.lang.String name)
Method Detail

getPlaceName

public java.lang.String getPlaceName()
Specified by:
getPlaceName in interface Place

getPlaceCapacity

public int getPlaceCapacity()
Description copied from interface: Place
Returns the maximum number of Visitors that can be in this place.

Specified by:
getPlaceCapacity in interface Place

isFull

public boolean isFull()
Description copied from interface: Place
Returns whether this place is full right now. Note that subsequent calls to enter() may still throw a PlaceFullException if someone beats you to the punch.

Specified by:
isFull in interface Place

getVisitorCount

public int getVisitorCount()
Description copied from interface: Place
Returns the number of Visitors that are currently in this place.

Specified by:
getVisitorCount in interface Place

enter

public void enter(Visitor visitor)
           throws Place.PlaceFullException
Description copied from interface: Place
Add the visitor to this place. Upon success, it will notify new visitors that they are here.

Specified by:
enter in interface Place
Place.PlaceFullException

exit

public void exit(Visitor visitor)
Description copied from interface: Place
The given visitor wishes to exit the place.

Specified by:
exit in interface Place