|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
maze.structure.Maze
Describes the maze as a grid of cells with a given geometry and filling algorithm. There are two principle interfaces to this class: construction of the maze (used by a filler), drawing the maze (used by a canvas).
| Field Summary | |
protected java.awt.Rectangle |
canvasRect
The Rectangle in graphics coordinates in which to draw the Maze. |
protected java.util.Observer |
theCellObserver
An Observer of the Maze who will redraw it as it changes. |
protected MazeCell[][] |
theCells
The Cells of the Maze. |
protected MazeFiller |
theFillStrategy
The MazeFiller algorithm used to fill the Maze. |
MazeGeometry |
theGeometry
The underlying MazeGeometry of the Maze. |
| Constructor Summary | |
Maze(int h,
int v)
Constructs a new, empty Maze. |
|
Maze(MazeGeometry g)
Constructs a new, empty maze using the given MazeGeometry to specify both the geometry as well as the size of the Maze. |
|
| Method Summary | |
void |
addCellObserver(java.util.Observer o)
Sets an Observer for each Cell of the Maze. |
MazeCell |
at(Coordinate c)
Returns the Cell at the given Coordinates. |
void |
clear()
Sets all Cells to Empty. |
void |
draw(java.awt.Graphics g)
Draws the Maze with the given Graphics context. |
void |
draw(java.awt.Graphics g,
MazeCell cell)
Draws the given Maze Cell with the given Graphics context. |
void |
fill()
Fills the Maze. |
void |
makeCellWall(Coordinate c)
Makes a CellWall instance at a given set of coordinates. |
void |
makeCellWall(Coordinate c,
int d1)
Makes a CellWall instance at a given set of coordinates. |
void |
makeCellWall(Coordinate c,
int d1,
int d2)
Makes a CellWall instance at a given set of coordinates. |
void |
makeCellWall(Coordinate c,
int d1,
int d2,
int d3)
Makes a CellWall instance at a given set of coordinates. |
void |
makeCellWallExcept(Coordinate c,
int d1,
int d2)
Makes a CellWall instance at a given set of coordinates. |
void |
makeCellWallExcept(Coordinate c,
int d1,
int d2,
int d3)
Makes a CellWall instance at a given set of coordinates. |
void |
setCellRect(java.awt.Rectangle r)
Sets the graphics Rectangle for a given Cell. |
void |
setFiller(MazeFiller f)
Sets the MazeFiller algorithm for this Maze. |
| Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected MazeCell[][] theCells
public MazeGeometry theGeometry
protected MazeFiller theFillStrategy
protected java.util.Observer theCellObserver
protected java.awt.Rectangle canvasRect
| Constructor Detail |
public Maze(int h,
int v)
h - int horizontal size of the Maze.v - int vertical size of the Maze.public Maze(MazeGeometry g)
g - MazeGeometry for this Maze.| Method Detail |
public void clear()
public void setFiller(MazeFiller f)
f - MazeFiller to use when filling this Maze.public void addCellObserver(java.util.Observer o)
o - Observer for each Cell of the Maze.public void setCellRect(java.awt.Rectangle r)
r - Rectangle with the extent of this Cell.public void fill()
public void draw(java.awt.Graphics g)
g - Graphics used to draw the Maze.
public void draw(java.awt.Graphics g,
MazeCell cell)
g - Graphics used to draw the Cellcell - Cell to be drawn.public MazeCell at(Coordinate c)
c - Coordinates of a Cell.
public void makeCellWall(Coordinate c)
c - Coordinates for the new CellWall.
public void makeCellWall(Coordinate c,
int d1)
c - Coordinates for the new CellWall.d1 - int direction for a wall.
public void makeCellWall(Coordinate c,
int d1,
int d2)
c - Coordinates for the new CellWall.d1 - int direction for a wall.d2 - int direction for a wall.
public void makeCellWall(Coordinate c,
int d1,
int d2,
int d3)
c - Coordinates for the new CellWall.d1 - int direction for a wall.d2 - int direction for a wall.d3 - int direction for a wall.
public void makeCellWallExcept(Coordinate c,
int d1,
int d2)
c - Coordinates for the new CellWall.d1 - int direction for a wall.d2 - int direction for a wall.
public void makeCellWallExcept(Coordinate c,
int d1,
int d2,
int d3)
c - Coordinates for the new CellWall.d1 - int direction for a wall.d2 - int direction for a wall.d3 - int direction for a wall.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||