|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstudent.adventure.Room
public class Room
Represents one location in the scenery of an adventure game. It is connected to other rooms via exits. For each existing exit, the room stores a reference to the neighboring room.
Constructor Summary | |
---|---|
Room(java.lang.String description)
Create a room described "description". |
Method Summary | |
---|---|
Room |
getExit(java.lang.String direction)
Return the room that is reached if we go from this room in direction "direction". |
java.lang.String |
getLongDescription()
Return a long description of this room, including a list of available exits. |
java.lang.String |
getShortDescription()
Return the description of the room (the one that was defined in the constructor). |
void |
setExit(java.lang.String direction,
Room neighbor)
Define an exit from this room. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Room(java.lang.String description)
description
- The room's descriptionMethod Detail |
---|
public void setExit(java.lang.String direction, Room neighbor)
direction
- The direction of the exitneighbor
- The room connected to this one in the given directionpublic java.lang.String getShortDescription()
public java.lang.String getLongDescription()
You are in the kitchen. Exits: north west
getExitString()
.public Room getExit(java.lang.String direction)
direction
- The direction to travel
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |