|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMazeCell
public class MazeCell
The MazeCell
class stores information about each individual cell
in the maze. The boolean values north
, east
,
west
, and south
store which walls are up; e.g., if
north
is true
, then the north wall is up.
Each cell also has pointer to its four MazeCell
neighbors,
neighborN
, neighborE
, neighborS
, and
neighborW
. If any of these values are null, it means this cell
is on the border of the maze.
Constructor Summary | |
---|---|
MazeCell()
Sets all the walls to true and initializes
the random number generator. |
Method Summary | |
---|---|
boolean |
east()
Returns whether or not this cell has its east wall up. |
void |
examine()
Sets the examined flag to true . |
boolean |
examined()
Returns whether or not this cell has been examined. |
MazeCell[] |
getNeighbors()
Gets the neighbors of this cell. |
boolean |
hasAllWalls()
Returns whether or not this cell has all its walls up. |
boolean |
north()
Returns whether or not this cell has its north wall up. |
void |
setNeighbors(MazeCell n,
MazeCell e,
MazeCell s,
MazeCell w)
Sets the pointers to the neighbors of this cell. |
void |
setWalls(boolean north,
boolean east,
boolean south,
boolean west)
Sets whether or not there are walls up to the north, east, south, and west of this cell. |
boolean |
south()
Returns whether or not this cell has its south wall up. |
void |
visit()
Sets the visited flag to true . |
boolean |
visited()
Returns whether or not this cell has been visited. |
boolean |
west()
Returns whether or not this cell has its west wall up. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MazeCell()
true
and initializes
the random number generator.
Method Detail |
---|
public void visit()
true
.
public boolean visited()
true
if the cell has been visited.public void examine()
true
.
public boolean examined()
true
if the cell has been examined.public void setNeighbors(MazeCell n, MazeCell e, MazeCell s, MazeCell w)
n
- The north neighbor of this cell.e
- The east neighbor of this cell.s
- The south neighbor of this cell.w
- The west neighbor of this cell.public void setWalls(boolean north, boolean east, boolean south, boolean west)
north
- true
if there's a wall on the north side of the cell.east
- true
if there's a wall on the east side of the cell.south
- true
if there's a wall on the south side of the cell.west
- true
if there's a wall on the west side of the cell.public boolean hasAllWalls()
true
if all walls are up.public boolean north()
true
if the cell's north wall is up.public boolean south()
true
if the cell's south wall is up.public boolean east()
true
if the cell's east wall is up.public boolean west()
true
if the cell's west wall is up.public MazeCell[] getNeighbors()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |