Class Trap

java.lang.Object
  |
  +--GameObject
        |
        +--RealObject
              |
              +--Trap
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Spyable

class Trap
extends RealObject

A trap will grab any instances of a particular class and hold them hostage.


Inner classes inherited from class RealObject
RealObject.ContentsMessager, RealObject.DescriptionLineProcessor
 
Inner classes inherited from class GameObject
GameObject.LeaveInfo
 
Field Summary
protected  java.lang.Class trappee
           
 
Fields inherited from class RealObject
contents, longDescription, parentObject, shortDescription, spreadto
 
Fields inherited from class GameObject
masterGame, name
 
Constructor Summary
(package private) Trap()
           
 
Method Summary
 void hello(RealObject enterer)
          Check if the enterer's class is what we're looking for and if so, make us its parent.
 void initialize(java.lang.String initializer, GameObject parentObjectArg)
          The usual initialization
 
Methods inherited from class RealObject
checkLeave, clone, doAction, getLongDescription, getParent, getShortDescription, getSpreadability, goodbye, isPredicate, preClone, register, roomOf, runSpy, setParent, spread, tellAll, unregister, wanderVia
 
Methods inherited from class GameObject
announce, compareTo, getMasterGame, kill, listen, newInstance, setMasterGame, toString
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

trappee

protected java.lang.Class trappee
Constructor Detail

Trap

Trap()
Method Detail

hello

public void hello(RealObject enterer)
Check if the enterer's class is what we're looking for and if so, make us its parent.
Overrides:
hello in class RealObject
Parameters:
enterer - the object that's entering

initialize

public void initialize(java.lang.String initializer,
                       GameObject parentObjectArg)
                throws GameException
The usual initialization
Overrides:
initialize in class RealObject
Parameters:
initializer - The fourth tilde piece is the name of the Class we're trapping.
Throws:
GameException - if the initializer specifies a nonexistent class name. (But you can get away with trapping StringTokenizers and such, however unlikely they are to walk in your door.