public class Room
extends java.lang.Object
Constructor | Description |
---|---|
Room(java.lang.String description) |
Create a room, given its description.
|
Modifier and Type | Method | Description |
---|---|---|
static java.util.HashMap<java.lang.String,Room> |
createRooms(java.util.Scanner in) |
Create rooms and their interconnections by taking room names, exit data
and descriptions from a file Scanner, and return a map of room names
to rooms.
|
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 description of the room in the form:
You are in the kitchen.
|
java.lang.String |
getShortDescription() |
|
void |
setExit(java.lang.String direction,
Room neighbor) |
Define an exit from this room.
|
public Room(java.lang.String description)
description
- The room's description.public static java.util.HashMap<java.lang.String,Room> createRooms(java.util.Scanner in)
in
- is the Scanner delivering all the room datapublic void setExit(java.lang.String direction, Room neighbor)
direction
- The direction of the exit.neighbor
- The room to which the exit leads.public java.lang.String getShortDescription()
public java.lang.String getLongDescription()
public Room getExit(java.lang.String direction)
direction
- The exit's direction.