obj
Class Room

java.lang.Object
  extended by obj.Entity
      extended by obj.Room

public class Room
extends Entity


Constructor Summary
Room()
          Blank constructor.
Room(java.lang.String name)
          Constructor with just a name.
Room(java.lang.String name, java.lang.String desc)
          Constructor with just name and description.
Room(java.lang.String name, java.lang.String desc, Item item)
          Constructor without NPC's, and just one item.
Room(java.lang.String name, java.lang.String desc, Item[] items)
          Constructor missing npcs.
Room(java.lang.String name, java.lang.String desc, Item[] items, NPC[] npcs)
          Full constructor.
Room(java.lang.String name, java.lang.String desc, Item item, NPC npc)
          Full constructor, but takes a single item instead of an array, and a single NPC.
Room(java.lang.String name, java.lang.String desc, NPC npc)
          Constructor without items, and just one npc.
 
Method Summary
 void addItem(Item i)
          Adds a single item to the room.
 void addNPC(NPC npc)
          Adds a single NPC to the room.
 Item getItem(java.lang.String itemIdent)
           
 java.util.ArrayList<Item> getItems()
           
 NPC getNPC(java.lang.String NPCIdentifer)
           
 java.util.ArrayList<NPC> getNPCs()
           
 void removeItem(Item i)
          Removes a single item from the room.
 void removeNPC(NPC npc)
          Removes a single NPC from the room.
 void setItems(Item[] items)
          Sets the items that can be found in the room.
 void setNPCs(NPC[] npcs)
          Sets the NPC's that can be found in the room.
 java.lang.String toString()
          Overrides the generic java toString, so that the Room's description can be printed by a simple Output.println(room);
 
Methods inherited from class obj.Entity
addIdentifier, addIdentifiers, getDesc, getName, getRoomDesc, hasIdentifier, makeInvisible, makeVisible, setDesc, setIdentifiers, setName, setRoomDesc
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Room

public Room(java.lang.String name,
            java.lang.String desc,
            Item[] items,
            NPC[] npcs)
Full constructor.


Room

public Room(java.lang.String name,
            java.lang.String desc,
            Item item,
            NPC npc)
Full constructor, but takes a single item instead of an array, and a single NPC.


Room

public Room(java.lang.String name,
            java.lang.String desc,
            NPC npc)
Constructor without items, and just one npc.


Room

public Room(java.lang.String name,
            java.lang.String desc,
            Item item)
Constructor without NPC's, and just one item.


Room

public Room(java.lang.String name,
            java.lang.String desc,
            Item[] items)
Constructor missing npcs.


Room

public Room(java.lang.String name,
            java.lang.String desc)
Constructor with just name and description.


Room

public Room(java.lang.String name)
Constructor with just a name.


Room

public Room()
Blank constructor. Defaults name to Room.

Method Detail

setItems

public void setItems(Item[] items)
Sets the items that can be found in the room.

Parameters:
Array - of items to set.

getItems

public java.util.ArrayList<Item> getItems()
Returns:
ArrayList of items that are in the room.

addItem

public void addItem(Item i)
Adds a single item to the room.

Parameters:
item - to be added.

removeItem

public void removeItem(Item i)
Removes a single item from the room.


getItem

public Item getItem(java.lang.String itemIdent)
Returns:
Item from the room, if it is contained in the room. Otherwise, returns null.

setNPCs

public void setNPCs(NPC[] npcs)
Sets the NPC's that can be found in the room.

Parameters:
Array - of NPC's to set.

getNPCs

public java.util.ArrayList<NPC> getNPCs()
Returns:
ArrayList of NPC's in the room.

addNPC

public void addNPC(NPC npc)
Adds a single NPC to the room.

Parameters:
NPC - to be added to room.

removeNPC

public void removeNPC(NPC npc)
Removes a single NPC from the room.

Parameters:
NPC - to be removed.

getNPC

public NPC getNPC(java.lang.String NPCIdentifer)
Parameters:
Identifier - for the NPC.
Returns:
An NPC that exists in the room, based on the identifier given. If the NPC can't be found, returns null.

toString

public java.lang.String toString()
Overrides the generic java toString, so that the Room's description can be printed by a simple Output.println(room);

Overrides:
toString in class Entity
Returns:
object's description.