com.webstersmalley.chessweb.model
Class Square

java.lang.Object
  extended by com.webstersmalley.chessweb.model.Square

public final class Square
extends java.lang.Object

Represents a cell on a chess board.

Author:
Matthew Smalley

Constructor Summary
Square(Position position)
          Construct a new cell.
 
Method Summary
 java.lang.String getColour()
          Returns the cell's colour.
 java.lang.String getHtmlContents()
          Returns the contents as a String suitable for rendering in HTML.
 Piece getPiece()
           
 Position getPosition()
           
 java.lang.String getTeamName()
          Returns the team name of the piece, or null if none.
 boolean hasPiece()
          Returns whether a Piece is in this cell.
 void setPiece(Piece piece)
           
 void setPosition(Position position)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Square

public Square(Position position)
Construct a new cell. Pass in the position so we can work out if it's a black or a white cell.

Parameters:
position - the position
Method Detail

getPosition

public Position getPosition()
Returns:
Returns the position.

setPosition

public void setPosition(Position position)
Parameters:
position - The position to set.

getColour

public java.lang.String getColour()
Returns the cell's colour.

Returns:
the colour

hasPiece

public boolean hasPiece()
Returns whether a Piece is in this cell.

Returns:
whether a Piece is in this cell.

getPiece

public Piece getPiece()
Returns:
Returns the piece.

setPiece

public void setPiece(Piece piece)
Parameters:
piece - The piece to set.

getTeamName

public java.lang.String getTeamName()
Returns the team name of the piece, or null if none.

Returns:
the team name

getHtmlContents

public java.lang.String getHtmlContents()
Returns the contents as a String suitable for rendering in HTML. Useful for views!

Returns:
the string


Copyright © 2005 Webster Smalley. All Rights Reserved.