Class AdvObject

Object
  extended by AdvObjectMagicSuperclass
      extended by AdvObject

public class AdvObject
extends AdvObjectMagicSuperclass

This class defines an object in the Adventure game. An object is characterized by the following properties:

The external format of the objects file is described in the assignment handout.


Method Summary
 String getDescription()
          Returns the one-line description of the object.
 int getInitialLocation()
          Returns the initial location of the object.
 String getName()
          Returns the object name, which is the word used to refer to it.
static AdvObject readObject(BufferedReader rd)
          Creates a new object by reading its data from the specified reader.
 
Methods inherited from class AdvObjectMagicSuperclass
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public String getName()
Returns the object name, which is the word used to refer to it.

Overrides:
getName in class AdvObjectMagicSuperclass
Returns:
The name of the object

getDescription

public String getDescription()
Returns the one-line description of the object. This description should start with an article, as in "a set of keys" or "an emerald the size of a plover's egg."

Overrides:
getDescription in class AdvObjectMagicSuperclass
Returns:
The description of the object

getInitialLocation

public int getInitialLocation()
Returns the initial location of the object.

Overrides:
getInitialLocation in class AdvObjectMagicSuperclass
Returns:
The room number in which the object initially resides

readObject

public static AdvObject readObject(BufferedReader rd)
Creates a new object by reading its data from the specified reader. If no data is left in the reader, this method returns null instead of an AdvObject value. Note that this is a static method, which means that you need to call

     AdvObject.readObject(rd)

Parameters:
rd - The reader from which the object data is read