|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--net.sourceforge.foobase.Game
Implements one game of chess.
This class does not depend on the particular database a game was read from or will be written to: it is basically the abstraction this package makes of each game.
Not all features implemented by this class are necessarily supported by all types of databases.
| Field Summary | |
static java.lang.String |
__version
|
protected java.lang.String |
_annotator
Annotator. |
protected boolean |
_blackmoves
Switch indicating black to move first. |
protected java.util.Date |
_date
Date played. |
protected int |
_eco
ECO code. |
protected char |
_ecoletter
ECO letter |
protected int |
_ecosub
ECO sub-code |
protected int |
_elo_black
ELO black. |
protected int |
_elo_white
ELO white. |
protected java.lang.String |
_gamenote
Annotation for game (that is: it is not for any move in particular) |
protected boolean |
_has_initial_setup
Flag indicating if the initial board setup is the initial game setup or not. |
protected java.util.Vector |
_ids
Collection of unique ID's for this game in the different databases. |
protected Board |
_initialboard
Initial board setup. |
protected java.util.Vector |
_moves
Moves in this game. |
protected java.lang.String |
_name_black
Name black player |
protected java.lang.String |
_name_white
Name white player |
protected int |
_nmoves
Number of moves by white in game. |
protected int |
_result
Game result. |
protected java.lang.String |
_round
Round. |
protected java.lang.String |
_tournament
Tournament information. |
static byte |
PC_EMPTY
Code for an empty square in the board structure. |
static byte |
PC_PAWN
Code for a pawn in the board structure. |
static byte |
PC_TYPE_MASK
Mask for just the piece code without color information |
| Constructor Summary | |
Game()
Default public constructor. |
|
| Method Summary | |
void |
addMove(Move m)
Add move to game. |
protected void |
appendMoveStrings(java.lang.StringBuffer sb,
java.util.Vector mvs,
Board brd,
int halfmove)
Recurively traverse a variations tree. |
java.lang.String |
getAnnotataor()
Get name of annotataor |
int |
getBlackELO()
Retrieve ELO of the black player. |
java.lang.String |
getBlackPlayer()
Retrieve name of the black player. |
java.util.Date |
getDate()
Get date game was played. |
int |
getECO()
Get ECO code. |
char |
getECOLetter()
Get ECO letter code. |
java.lang.String |
getGameAnnotation()
Retrieve game annotation. |
java.util.Vector |
getIDs()
Get available game IDs for this game. |
Board |
getInitialPosition()
Retrieve initial board setup. |
java.util.Vector |
getMoves()
Retrieve game moves. |
int |
getNumberMoves()
Get the total number of moves white played in this game. |
int |
getResult()
Get result of game. |
java.lang.String |
getRound()
Get round number. |
int |
getSubECO()
Get ECO sub-code. |
java.lang.String |
getTournament()
Get name of tournament |
int |
getWhiteELO()
Retrieve ELO of the white player. |
java.lang.String |
getWhitePlayer()
Retrieve name of the white player. |
boolean |
hasInitialSetup()
Tests if the game starts from a given initial position. |
boolean |
isBlackToMove()
Get side to move next. |
void |
setAnnotator(java.lang.String txt)
Set name of annotataor |
void |
setBlackELO(int elo)
Set ELO of black player. |
void |
setBlackMoves(boolean black)
Set color to move in the current position. |
void |
setBlackPlayer(java.lang.String txt)
Set name of black player. |
void |
setDate(java.util.Date dat)
Set date game was played. |
void |
setECO(int eco)
Set ECO code |
void |
setECOLetter(char l)
Set ECO letter code |
void |
setGameAnnotation(java.lang.String txt)
Set annotation text at game level. |
void |
setHasInitialBoard(boolean b)
Set flag indicating if the initial board setup is indeed the usual start setup for a new game. |
void |
setID(IsGameID id)
Set/add a new ID for this game. |
void |
setInitialPosition(Board brd)
Set initial board setup. |
void |
setMoves(java.util.Vector moves)
Set entire move list at once. |
void |
setNumberMoves(int n)
Set the total number of moves white played in this game. |
void |
setResult(int res)
Set result of game. |
void |
setRound(java.lang.String r)
Set round number. |
void |
setSubECO(int eco)
Set ECO sub-code |
void |
setTournament(java.lang.String txt)
Set name of tournament |
void |
setWhiteELO(int elo)
Set ELO of white player. |
void |
setWhitePlayer(java.lang.String txt)
Set name of white player. |
java.lang.String |
toString()
Convert game and all its properties to human readable format. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final byte PC_TYPE_MASK
public static final byte PC_EMPTY
public static final byte PC_PAWN
protected java.util.Vector _ids
The elements in this list are of type IsGameID
protected java.lang.String _gamenote
protected java.util.Vector _moves
Elements are of type Move.
protected Board _initialboard
protected boolean _blackmoves
protected java.lang.String _name_white
protected java.lang.String _name_black
protected int _elo_white
protected int _elo_black
protected int _result
protected java.util.Date _date
protected java.lang.String _tournament
protected java.lang.String _round
The datatype String allows for round indications like
"3/6" or "playoffs".
protected java.lang.String _annotator
protected char _ecoletter
protected int _eco
protected int _ecosub
protected int _nmoves
protected boolean _has_initial_setup
public static final java.lang.String __version
| Constructor Detail |
public Game()
| Method Detail |
public void setID(IsGameID id)
id - IsGameID containing the new ID for this game.public java.util.Vector getIDs()
Normally, every database will have its own ID for a game, so one game can have mulitple IDs (if it is present in more than one database)
Vector containing all IsGameID
identification objects for this game, or null if no
IDs are present.public void setHasInitialBoard(boolean b)
b - boolean value true if this game
has a non-standard initial board setup.public boolean hasInitialSetup()
boolean value true if the game
starts from a non-standard initial board setup.public void setGameAnnotation(java.lang.String txt)
txt - String meant for entire game, not just for one
movepublic java.lang.String getGameAnnotation()
String meant for entire game, not just for onepublic void addMove(Move m)
m - Move to add to the list of moves in the gamepublic void setMoves(java.util.Vector moves)
moves - Vector containing the entire movelist for this
gamepublic java.util.Vector getMoves()
Vector containing the entire game and its
registered variations.public void setInitialPosition(Board brd)
brd - Board containing the initial position for
this game (only usefull if the game does not start at the usual
initial board setup)public Board getInitialPosition()
Board containing the initial board setup for this
game or null in case the game starts at the usual initial
position of a game of chess.public void setBlackMoves(boolean black)
black - boolean value true if black is
to move, false if white is to move.public boolean isBlackToMove()
boolean value true if black is to
move next.public void setWhitePlayer(java.lang.String txt)
txt - String containing the name of the white playerpublic java.lang.String getWhitePlayer()
String containing the non-null name of the white
player.public void setBlackPlayer(java.lang.String txt)
txt - String containing the name of the
black playerpublic java.lang.String getBlackPlayer()
String containing the non-null name of the black
player.public void setWhiteELO(int elo)
elo - int containing the ELO of the white playerpublic int getWhiteELO()
int containing the ELO of the white player.public void setBlackELO(int elo)
elo - int containing the ELO of the black playerpublic int getBlackELO()
int containing the ELO of the black player.public void setResult(int res)
res - int containing the result of the game,
according to this table:
public int getResult()
int containing the game result using these values:
public void setDate(java.util.Date dat)
dat - Date when game was played.public java.util.Date getDate()
Date when game was played.public void setTournament(java.lang.String txt)
txt - String containing the name of tournamentpublic java.lang.String getTournament()
String containing the non-null name of tournamentpublic void setAnnotator(java.lang.String txt)
txt - String containing the name of annotataorpublic java.lang.String getAnnotataor()
String containing the non-null name of annotataorpublic void setRound(java.lang.String r)
r - String containing the round within the tournament
that this game was played.public java.lang.String getRound()
String containing the non-null round within the
tournament that this game was played.public void setECOLetter(char l)
eco - char containing the ECO letter codepublic char getECOLetter()
char containing the ECO letter codepublic void setECO(int eco)
eco - int containing the ECO codepublic int getECO()
int containing the ECO codepublic void setSubECO(int eco)
eco - int containing the ECO sub-codepublic int getSubECO()
int containing the ECO sub-codepublic void setNumberMoves(int n)
This is not the same as the number of moves in the moves list (which typically would contain at least about twice this amount due to black putting up a fight as well)
n - int containing the total number of moves white
played in this game.public int getNumberMoves()
This is not the same as the number of moves in the moves list (which typically would contain at least about twice this amount due to black putting up a fight as well)
int containing the total number of moves white
played in this game.public java.lang.String toString()
String containing the game and all its properties
in human readable format.
protected void appendMoveStrings(java.lang.StringBuffer sb,
java.util.Vector mvs,
Board brd,
int halfmove)
sb - StringBuffer to append the notation tomvs - Vector containing the variation to processbrd - Board with setup at beginning of the
variationhalfmove - int containing the number of the halfmove
that is at the start of the variation (first move of the game is
halfmove zero)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||