public class Room
extends java.lang.Object
Constructor and Description |
---|
Room(java.lang.String description)
Constructor for objects of type Room
|
Modifier and Type | Method and Description |
---|---|
void |
addItem(Item newItem)
Adds a new item to the room
|
java.lang.String |
getDescription()
Returns the description of the room
|
Room |
getExit(java.lang.String direction)
Return the room that is reached if we go from this room in direction
"direction".
|
Item |
getItem(java.lang.String description)
Returns the item with a specified description
|
Item[] |
getItems()
Returns the items in the room
|
void |
removeItem(java.lang.String description)
Removes the specified item from the room
|
void |
setExit(java.lang.String direction,
Room neighbor)
Define an exit from this room.
|
public Room(java.lang.String description)
description
- a description of the roompublic java.lang.String getDescription()
public void addItem(Item newItem)
newItem
- the item to addpublic Item[] getItems()
public Item getItem(java.lang.String description)
description
- the description of the specified itempublic void setExit(java.lang.String direction, Room neighbor)
direction
- The direction of the exit.neighbor
- The room to which the exit leads.public Room getExit(java.lang.String direction)
direction
- The exit's direction.public void removeItem(java.lang.String description)
description
- the description of the specified item