Class Passage

java.lang.Object
  |
  +--GameObject
        |
        +--Passage
All Implemented Interfaces:
java.lang.Comparable

class Passage
extends GameObject

Keep track of the connections among rooms. This is the one kind of GameObject that doesn't inherit from RealObject, so it doesn't have much of the functionality you've come to know and love; for example, it can't be inside of or contain other objects.


Inner classes inherited from class GameObject
GameObject.LeaveInfo
 
Field Summary
(package private)  Room.RoomPassage destination
          the other arbitrary endpoint of the passage.
(package private)  Room.RoomPassage origin
          an arbitrary endpoint of the passage
 
Fields inherited from class GameObject
masterGame, name
 
Constructor Summary
(package private) Passage()
           
 
Method Summary
 void doAction()
          Remind the world that we exist and where we go
 void initialize(java.lang.String initializer, GameObject parentObjectArg)
          Initialize a passage.
 Room otherEnd(Room thisEnd)
          What's at our other end? (If you create a subclass with multi-ended Passages, this method needs to be overridden.
 
Methods inherited from class GameObject
announce, compareTo, getMasterGame, kill, listen, newInstance, setMasterGame, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

destination

Room.RoomPassage destination
the other arbitrary endpoint of the passage.

origin

Room.RoomPassage origin
an arbitrary endpoint of the passage
Constructor Detail

Passage

Passage()
Method Detail

doAction

public void doAction()
Remind the world that we exist and where we go
Overrides:
doAction in class GameObject

initialize

public void initialize(java.lang.String initializer,
                       GameObject parentObjectArg)
                throws GameException
Initialize a passage. Will register itself with the Rooms it connects.
Overrides:
initialize in class GameObject
Parameters:
initializer - RoomName1~direction1~RoomName2~direction2
parentObjectArg - must be null for Passages

otherEnd

public Room otherEnd(Room thisEnd)
What's at our other end? (If you create a subclass with multi-ended Passages, this method needs to be overridden. Experiment with deterministic and stochastic ways of finding the other end.)
Parameters:
thisEnd - a Room at one end of this Passage
Returns:
the Room at the other end of this Passage, or null if thisEnd is not one of the ends.