PrintGame
Class Cell

java.lang.Object
  extended byPrintGame.Cell

public class Cell
extends java.lang.Object

A cell that is used in the labyrinth


Field Summary
protected  int cell_mark_
           
protected static int CONTAINS_DIAMOND
           
protected static int EMPTY
           
protected static int STARTPOINT
           
protected  int status_
          member variable to store the flags in
protected static int WALL
          status flags
protected static int WAY
           
 
Constructor Summary
Cell()
          find out whether the cell is a wall
 
Method Summary
 boolean containsDiamond()
          find out whether the cell contains a diamand
 void convertToStartpoint()
          covert a cell to a startpoint
 void convertToWall()
          covert a way or a empty cell to wall
 void convertToWay()
          covert a cell to a way
 int getCellMark()
           
 boolean isEmpty()
           
 boolean isStartpoint()
          find out whether the cell is a startpoint
 boolean isWall()
          find out whether the cell is a wall
 boolean isWay()
          find out whether the cell is a way
 void removeDiamond()
          remove a diamond
 void removeStartpoint()
          remove a startpoint
 void resetAll()
          resets the cell including status
 void setCellMark(int cell_mark)
           
 void setDiamond()
          set a diamand
 void setEmpty()
           
 java.lang.String toString()
          standard toString method for debugging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WALL

protected static final int WALL
status flags

See Also:
Constant Field Values

WAY

protected static final int WAY
See Also:
Constant Field Values

STARTPOINT

protected static final int STARTPOINT
See Also:
Constant Field Values

CONTAINS_DIAMOND

protected static final int CONTAINS_DIAMOND
See Also:
Constant Field Values

EMPTY

protected static final int EMPTY
See Also:
Constant Field Values

status_

protected int status_
member variable to store the flags in


cell_mark_

protected int cell_mark_
Constructor Detail

Cell

public Cell()
find out whether the cell is a wall

Method Detail

setCellMark

public void setCellMark(int cell_mark)

getCellMark

public int getCellMark()

isWall

public boolean isWall()
find out whether the cell is a wall

Returns:
true if the cell is a wall, false otherwise

convertToWall

public void convertToWall()
                   throws java.lang.IllegalStateException
covert a way or a empty cell to wall

Throws:
java.lang.IllegalStateException - thrown if the cell is allready a wall, the cell contains a diamond or a robot.

isWay

public boolean isWay()
find out whether the cell is a way

Returns:
true if the cell is a way, false otherwise

convertToWay

public void convertToWay()
                  throws java.lang.IllegalStateException
covert a cell to a way

Throws:
java.lang.IllegalStateException - thrown if the cell is allready a way.

isStartpoint

public boolean isStartpoint()
find out whether the cell is a startpoint

Returns:
true if the cell is a startpoint, false otherwise

convertToStartpoint

public void convertToStartpoint()
                         throws java.lang.IllegalStateException
covert a cell to a startpoint

Throws:
java.lang.IllegalStateException - thrown if the cell is allready a startpoint.

removeStartpoint

public void removeStartpoint()
                      throws java.lang.IllegalStateException
remove a startpoint

Throws:
java.lang.IllegalStateException - thrown when trying to remove a startpoint form a cell that doesn't contain a startpoint

containsDiamond

public boolean containsDiamond()
find out whether the cell contains a diamand

Returns:
true if the cell contains a diamand, false otherwise

setDiamond

public void setDiamond()
                throws java.lang.IllegalStateException
set a diamand

Throws:
java.lang.IllegalStateException - thrown when trying to place a diamond in a cell that already contains a diamond

isEmpty

public boolean isEmpty()

removeDiamond

public void removeDiamond()
                   throws java.lang.IllegalStateException
remove a diamond

Throws:
java.lang.IllegalStateException - thrown when trying to remove a diamond form a cell that doesn't contain a diamond

resetAll

public void resetAll()
resets the cell including status


setEmpty

public void setEmpty()
              throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

toString

public java.lang.String toString()
standard toString method for debugging

Returns:
info about the cell in string-format