Class Room


public class Room extends Object
  • Constructor Details

    • Room

      public Room(String pDescription)
      Constructor for the class Room
      Parameters:
      The - description of the created Room
  • Method Details

    • getExits

      public Room getExits(String pDirection)
      If an exit in that direction exists, this method returns that exit
      Parameters:
      pDirection - Is a String representing the direction that the user wants to go to
    • getExitString

      public String getExitString()
      This method returns a string containing all the exits of the room under the format: "exit1 exit2 exit3"
      Returns:
      The string containing all the exits of the current room
    • getDescription

      public String getDescription()
      Is used to access the description of a room
      Returns:
      The description of the current room
    • setExit

      public void setExit(String pDirection, Room pNeighbor)
      Allows to add an exit to a room in any given direction
      Parameters:
      pDirection - A string containing a direction
      pNeighbor - A room that you want to put as a neighbor of another given room
    • getLongDescription

      public String getLongDescription()
      Gives the description and the possible exits of a room
      Returns:
      The String with all of the description of the current Room and its possible exits