maze.structure
Class MazeCell

java.lang.Object
  extended byjava.util.Observable
      extended bymaze.structure.MazeCell
Direct Known Subclasses:
MazeCellEmpty, MazeCellWall

public abstract class MazeCell
extends java.util.Observable

A single Cell within the Maze.


Field Summary
static int BLACK
          This cell is Black.
static int BLANK
          This cell has not had a color assigned.
static int RED
          This cell is Red.
 boolean special
          Is this a specially-colored cell?
protected  int theColor
          The color of this cell, either BLANK, RED or BLACK.
 Coordinate theLocation
          The Coordinate location of this Cell.
 
Constructor Summary
MazeCell()
           
 
Method Summary
abstract  void drawFloor(java.awt.Graphics g)
          Draws the floor color of this cell.
abstract  void drawWall(java.awt.Graphics g)
          Draw the bounding walls of this Cell.
 int getColor()
          Gets the Color for this cell.
 void setColor(int c)
          Sets the color for this cell.
 void setCoord(Coordinate c)
          Set the Coordinate for this Cell
 void setGeoCoord(MazeGeometry g, Coordinate c)
          Set the Geometry and the Coordinate.
 void setGeometry(MazeGeometry g)
          Sets the MazeGeometry of this Cell.
 void special()
          Defines this cell as "special".
abstract  java.lang.String toString()
          Returns the String representation for this cell.
abstract  boolean used()
          Returns true if this cell is used.
 
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, wait, wait, wait
 

Field Detail

theLocation

public Coordinate theLocation
The Coordinate location of this Cell.


special

public boolean special
Is this a specially-colored cell?


BLANK

public static final int BLANK
This cell has not had a color assigned.

See Also:
Constant Field Values

RED

public static final int RED
This cell is Red.

See Also:
Constant Field Values

BLACK

public static final int BLACK
This cell is Black.

See Also:
Constant Field Values

theColor

protected int theColor
The color of this cell, either BLANK, RED or BLACK. This is used for a variety of things. MazeFillerRetry, for instance, uses this when trying to retry when the path is blocked by itself.

Constructor Detail

MazeCell

public MazeCell()
Method Detail

drawFloor

public abstract void drawFloor(java.awt.Graphics g)
Draws the floor color of this cell.

Parameters:
g - Graphics context.

drawWall

public abstract void drawWall(java.awt.Graphics g)
Draw the bounding walls of this Cell.

Parameters:
g - Graphics context.

setGeometry

public void setGeometry(MazeGeometry g)
Sets the MazeGeometry of this Cell.

Parameters:
g - A RectGeometry.

setCoord

public void setCoord(Coordinate c)
Set the Coordinate for this Cell

Parameters:
c - Coordinate for this cell.

setGeoCoord

public void setGeoCoord(MazeGeometry g,
                        Coordinate c)
Set the Geometry and the Coordinate.

Parameters:
g - MazeGeometry for this cell.
c - Coordinate for this cell.

special

public void special()
Defines this cell as "special".


used

public abstract boolean used()
Returns true if this cell is used.

Returns:
True if this Cell has been used.

getColor

public int getColor()
Gets the Color for this cell. One of BLANK, RED or BLACK.

Returns:
The color of this cell.

setColor

public void setColor(int c)
Sets the color for this cell. One of BLANK, RED or BLACK.

Parameters:
c - int color code, one of BLANK, RED or BLACK.

toString

public abstract java.lang.String toString()
Returns the String representation for this cell.

Returns:
String description of this cell.