org.jscience.computing.game.chess
Class BoardPosition

java.lang.Object
  extended by org.jscience.computing.game.GameBoardPosition
      extended by org.jscience.computing.game.chess.BoardPosition
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class BoardPosition
extends GameBoardPosition

BoardPosition represents a position on a chess board. This class is also used by other game packages and therefore public.

See Also:
Serialized Form

Constructor Summary
BoardPosition(char file, int rank)
          Creates a new BoardPosition object.
BoardPosition(int pos)
          Creates a new BoardPosition object.
 
Method Summary
protected static int calculateIntPos(char file, int rank)
          DOCUMENT ME!
 java.lang.Object clone()
          DOCUMENT ME!
protected  char getColumn()
          DOCUMENT ME!
 char getFile()
          DOCUMENT ME!
 int getRank()
          DOCUMENT ME!
protected  int getRow()
          DOCUMENT ME!
 int getTileColor()
          DOCUMENT ME!
 BoardPosition relativePosition(int fileAddition, int rankAddition)
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
static boolean validPosition(char file, int rank)
          DOCUMENT ME!
static boolean validPosition(int pos)
          DOCUMENT ME!
 
Methods inherited from class org.jscience.computing.game.GameBoardPosition
asInteger, equals
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoardPosition

public BoardPosition(char file,
                     int rank)
              throws java.lang.IllegalArgumentException
Creates a new BoardPosition object.

Parameters:
file - DOCUMENT ME!
rank - DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

BoardPosition

public BoardPosition(int pos)
              throws java.lang.IllegalArgumentException
Creates a new BoardPosition object.

Parameters:
pos - DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!
Method Detail

getTileColor

public int getTileColor()
DOCUMENT ME!

Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class GameBoardPosition
Returns:
DOCUMENT ME!

getFile

public char getFile()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getRank

public int getRank()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getColumn

protected char getColumn()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getRow

protected int getRow()
DOCUMENT ME!

Returns:
DOCUMENT ME!

validPosition

public static boolean validPosition(char file,
                                    int rank)
DOCUMENT ME!

Parameters:
file - DOCUMENT ME!
rank - DOCUMENT ME!
Returns:
DOCUMENT ME!

validPosition

public static boolean validPosition(int pos)
DOCUMENT ME!

Parameters:
pos - DOCUMENT ME!
Returns:
DOCUMENT ME!

relativePosition

public BoardPosition relativePosition(int fileAddition,
                                      int rankAddition)
DOCUMENT ME!

Parameters:
fileAddition - DOCUMENT ME!
rankAddition - DOCUMENT ME!
Returns:
DOCUMENT ME!

calculateIntPos

protected static int calculateIntPos(char file,
                                     int rank)
                              throws java.lang.IllegalArgumentException
DOCUMENT ME!

Parameters:
file - DOCUMENT ME!
rank - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
DOCUMENT ME!

Overrides:
clone in class java.lang.Object
Returns:
DOCUMENT ME!
Throws:
java.lang.CloneNotSupportedException - DOCUMENT ME!