|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectRoom
public class Room
Represents a room in the game
Constructor Summary | |
---|---|
Room(String description)
Constructor for objects of type Room |
Method Summary | |
---|---|
void |
addItem(Item newItem)
Adds a new item to the room |
String |
getDescription()
Returns the description of the room |
Room |
getExit(String direction)
Return the room that is reached if we go from this room in direction "direction". |
Item |
getItem(String description)
Returns the item with a specified description |
ArrayList<Item> |
getItems()
Returns the items in the room |
void |
removeItem(String description)
Removes the specified item from the room |
void |
setExit(String direction,
Room neighbor)
Define an exit from this room. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Room(String description)
description
- a description of the roomMethod Detail |
---|
public void addItem(Item newItem)
newItem
- the item to addpublic String getDescription()
public Room getExit(String direction)
direction
- The exit's direction.
public Item getItem(String description)
description
- the description of the specified item
public ArrayList<Item> getItems()
public void removeItem(String description)
description
- the description of the specified itempublic void setExit(String direction, Room neighbor)
direction
- The direction of the exit.neighbor
- The room to which the exit leads.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |