Internet Chess ToolKit
v0.2.0

ictk.boardgame.chess.io
Class SAN

java.lang.Object
  extended byictk.boardgame.chess.io.ChessMoveNotation
      extended byictk.boardgame.chess.io.SAN
All Implemented Interfaces:
MoveNotation

public class SAN
extends ChessMoveNotation

SAN - Standard Algebraic Notation Moves are represented as: Nb7++, gxh8=Q, O-O-O, e4, Rad1#


Field Summary
static long DEBUG
           
 
Fields inherited from class ictk.boardgame.chess.io.ChessMoveNotation
FILE_SETS, PIECE_SETS, RANK_SETS
 
Constructor Summary
SAN()
           
SAN(boolean pawnSpace)
           
SAN(java.util.Locale loc)
          note: different Locales other than the default (English) should only be used for local presentation.
SAN(java.util.Locale loc, boolean pawnSpace)
           
 
Method Summary
 boolean isPawnAsSpace()
           
 java.lang.String moveToString(ChessMove m)
           
 java.lang.String moveToString(Move move)
          calls moveToString(false) and thus only returns the move.
 java.lang.String moveToString(Move move, boolean showSuffix)
          read the string an convert it into an unverified move
 java.lang.String resultToString(Result result)
          converts a result number into a string.
 boolean setLocale(java.util.Locale loc)
          sets the Locale for the ChessMoveNotation to use localised piece representations.
 void setPawnAsSpace(boolean t)
           
 Move stringToMove(Board b, java.lang.String s)
          converts a string into a ChessMove object.
 Result stringToResult(java.lang.String s)
          converts a string into a result number the default return value if the string cannot be read is null
 
Methods inherited from class ictk.boardgame.chess.io.ChessMoveNotation
fileToChar, fileToNum, fileToNum, getLocale, getPieceSet, pieceToChar, pieceToChar, pieceToNum, pieceToNum, rankToChar, rankToNum, setPieceSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final long DEBUG
Constructor Detail

SAN

public SAN()

SAN

public SAN(boolean pawnSpace)

SAN

public SAN(java.util.Locale loc)
note: different Locales other than the default (English) should only be used for local presentation. The archive standard for SAN and PGN is English.


SAN

public SAN(java.util.Locale loc,
           boolean pawnSpace)
Method Detail

setPawnAsSpace

public void setPawnAsSpace(boolean t)

isPawnAsSpace

public boolean isPawnAsSpace()

setLocale

public boolean setLocale(java.util.Locale loc)
Description copied from class: ChessMoveNotation
sets the Locale for the ChessMoveNotation to use localised piece representations. Note: this should be used for local presentation only. The archive standard for SAN and PGN is English (the default). This function uses the ISO 639-2/T language code. (ftp://dkuug.dk/i18n/iso-639-2.txt)

Overrides:
setLocale in class ChessMoveNotation
Returns:
false if no specific pieceset is registered for that locale

stringToMove

public Move stringToMove(Board b,
                         java.lang.String s)
                  throws AmbiguousChessMoveException,
                         IllegalMoveException
converts a string into a ChessMove object. The move will not be played on the board and thus will not be verified as legal.

Returns:
null if there was no move in the string
Throws:
AmbiguousChessMoveException - if the move is not unique
IllegalMoveException - if the move is not legal on the board
java.lang.IllegalArgumentException - if the Board is null

stringToResult

public Result stringToResult(java.lang.String s)
converts a string into a result number the default return value if the string cannot be read is null


moveToString

public java.lang.String moveToString(Move move)
calls moveToString(false) and thus only returns the move.


moveToString

public java.lang.String moveToString(Move move,
                                     boolean showSuffix)
read the string an convert it into an unverified move

Returns:
null if Move is not a ChessMove

moveToString

public java.lang.String moveToString(ChessMove m)

resultToString

public java.lang.String resultToString(Result result)
converts a result number into a string. By default null is returned indicating UNDECIDED


Submit a bug or feature
Visit the Website
Internet Chess ToolKit is licensed under the GPL v2 .