|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object AdvRoomMagicSuperclass AdvRoom
public class AdvRoom
This class defines a single room in the Adventure game. A room is characterized by the following properties:
Method Summary | |
---|---|
void |
addObject(AdvObject obj)
Adds an object to the list of objects in the room. |
boolean |
containsObject(AdvObject obj)
Checks whether the specified object is in the room. |
String[] |
getDescription()
Returns a string array giving the long description of the room. |
AdvMotionTableEntry[] |
getMotionTable()
Returns the motion table associated with this room, which is an array of directions, room numbers, and key objects stored in an AdvMotionTableEntry . |
String |
getName()
Returns the room name, which is its one-line description. |
AdvObject |
getObject(int index)
Returns the specified element from the list of objects in the room. |
int |
getObjectCount()
Returns the number of objects in the room. |
int |
getRoomNumber()
Returns the room number. |
boolean |
hasBeenVisited()
Returns true if the room has previously been visited. |
static AdvRoom |
readRoom(BufferedReader rd)
Creates a new room by reading its data from the specified reader. |
void |
removeObject(AdvObject obj)
Removes an object from the list of objects in the room. |
void |
setVisited(boolean flag)
Sets a flag indicating whether this room has been visited. |
Methods inherited from class AdvRoomMagicSuperclass |
---|
toString |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public int getRoomNumber()
getRoomNumber
in class AdvRoomMagicSuperclass
public String getName()
getName
in class AdvRoomMagicSuperclass
public void addObject(AdvObject obj)
addObject
in class AdvRoomMagicSuperclass
obj
- The AdvObject
to be addedpublic void removeObject(AdvObject obj)
removeObject
in class AdvRoomMagicSuperclass
obj
- The AdvObject
to be removedpublic boolean containsObject(AdvObject obj)
containsObject
in class AdvRoomMagicSuperclass
obj
- The AdvObject
being tested
true
if the object is in the roompublic int getObjectCount()
getObjectCount
in class AdvRoomMagicSuperclass
public AdvObject getObject(int index)
getObject
in class AdvRoomMagicSuperclass
AdvObject
at the specified index positionpublic String[] getDescription()
getDescription
in class AdvRoomMagicSuperclass
public void setVisited(boolean flag)
setVisited(true)
means that the room has
been visited; calling setVisited(false)
restores
its initial unvisited state.
setVisited
in class AdvRoomMagicSuperclass
flag
- The new state of the "visited" flagpublic boolean hasBeenVisited()
true
if the room has previously been visited.
hasBeenVisited
in class AdvRoomMagicSuperclass
true
if the room has been visitedpublic AdvMotionTableEntry[] getMotionTable()
AdvMotionTableEntry
.
getMotionTable
in class AdvRoomMagicSuperclass
public static AdvRoom readRoom(BufferedReader rd)
null
instead of an AdvRoom
value.
Note that this is a static method, which means that you need
to call
AdvRoom.readRoom(rd)
rd
- The reader from which the room data is read
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |