Class Cave

java.lang.Object
  extended by Cave

public class Cave
extends java.lang.Object

Class that models a cave in "Hunt the Wumpus"

Version:
3/3/12
Author:
Dave Reed

Constructor Summary
Cave(java.lang.String name, int num, int adj1, int adj2, int adj3)
          Constructs a cave with the specified characteristics.
 
Method Summary
 int getAdjNumber(int tunnel)
          Accesses the number of an adjacent cave.
 java.lang.String getCaveName()
          Accesses the name of the cave.
 int getCaveNumber()
          Accesses the number of the cave.
 CaveContents getContents()
          Accesses the contents of the contents (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT).
 boolean hasBeenVisited()
          Determines whether this cave has been vistied previously.
 void markAsVisited()
          Marks the cave as having been visited.
 void setContents(CaveContents contents)
          Sets the contents of the cave (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cave

public Cave(java.lang.String name,
            int num,
            int adj1,
            int adj2,
            int adj3)
Constructs a cave with the specified characteristics. By default, the cave is unvisited and empty.

Parameters:
name - the name of the cave
num - the cave number
adj1 - the number of the adjacent cave (through tunnel 1)
adj2 - the number of the adjacent cave (through tunnel 2)
adj3 - the number of the adjacent cave (through tunnel 3)
Method Detail

getAdjNumber

public int getAdjNumber(int tunnel)
Accesses the number of an adjacent cave.

Parameters:
tunnel - the tunnel numbers (1-3)
Returns:
the number of the adjacent cave through that tunnel

getCaveName

public java.lang.String getCaveName()
Accesses the name of the cave.

Returns:
the cave name

getCaveNumber

public int getCaveNumber()
Accesses the number of the cave.

Returns:
the cave number

getContents

public CaveContents getContents()
Accesses the contents of the contents (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT).

Returns:
the cave contents

hasBeenVisited

public boolean hasBeenVisited()
Determines whether this cave has been vistied previously.

Returns:
true if it has been visited, otherwise false

markAsVisited

public void markAsVisited()
Marks the cave as having been visited.


setContents

public void setContents(CaveContents contents)
Sets the contents of the cave (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT).

Parameters:
contents - the new contents