All pastes #373857 Raw Edit

MikeH

public text v1 · immutable
#373857 ·published 2007-02-27 01:38 UTC
rendered paste body

public class Passageway{
  
  private Room room1;
  private Room room2;
  
  /** Constructor: Creates a passageway "connected" to 2 room objects */
  public Passageway(Room in, Room out){
    room1 = in;
    room2 = out;
  }
  
  /** Query: Returns the room object connected to the passageway that is
   * not the one that is passed to it*/
  public Room otherRoom(Room currentRoom){
    if (room1.equals(currentRoom)) {
      return room2;
    }
    else
      return room1;
  }
}