amazeproject
Class Cell

java.lang.Object
  extended by amazeproject.Cell

public class Cell
extends java.lang.Object

Cell Representation Class


Field Summary
static int cellSize
           
 int col
           
 boolean isEnd
           
 boolean isStart
           
static int padding
           
 int row
           
 boolean visited
           
 int[] walls
           
 int weight
           
 
Constructor Summary
Cell(Maze parent)
          Constructor
 
Method Summary
 int findAdjacentWall(Cell cell)
          Return index of adjacent wall
 java.util.Vector findPath()
          Find all possible directions from current cell
 int getRandomWall()
          Return index of random wall
 boolean hasAllWalls()
          Check if a given cell has all wals
 void knockDownWall(Cell cell)
          Destroy wall between this and given cell
 void knockDownWall(int wall)
          Destroy given wall
 void paint(java.awt.Graphics g)
          Paint cell
 java.lang.String toString()
          Function used for getting a string representation of object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cellSize

public static int cellSize

padding

public static int padding

walls

public int[] walls

row

public int row

col

public int col

weight

public int weight

visited

public boolean visited

isStart

public boolean isStart

isEnd

public boolean isEnd
Constructor Detail

Cell

public Cell(Maze parent)
Constructor

Parameters:
Maze - Reference to parent object
Method Detail

hasAllWalls

public boolean hasAllWalls()
Check if a given cell has all wals

Returns:
boolean True if cell has all 4 walls

knockDownWall

public void knockDownWall(int wall)
Destroy given wall

Parameters:
int - Wall to be destroyed

knockDownWall

public void knockDownWall(Cell cell)
Destroy wall between this and given cell

Parameters:
Cell - Reference to cell object

findAdjacentWall

public int findAdjacentWall(Cell cell)
Return index of adjacent wall

Parameters:
Cell - Reference to cell object
Returns:
int Index of adjacent cell

findPath

public java.util.Vector findPath()
Find all possible directions from current cell

Returns:
Vector Vector of cells that are connected to this cell

getRandomWall

public int getRandomWall()
Return index of random wall

Returns:
int Index of random wall

paint

public void paint(java.awt.Graphics g)
Paint cell

Parameters:
Graphics - Graphics object

toString

public java.lang.String toString()
Function used for getting a string representation of object

Overrides:
toString in class java.lang.Object
Returns:
String String representation of object