|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.util.GameRecord
This class stores a record of a game of Go. It stores some descriptive information, such as the date the game was played, the location, and the player. In addition, it stores some redundant information, such as prisoners captured and any kos that arise to make replay simpler.
Field Summary | |
private String |
black
|
static short |
BLACKTOMOVE
constant which indicates that it is blacks turn. |
private long |
date
|
private String |
gameId
|
static short |
GAMEOVER
constant which indicates that the game has been completed. |
private Handicap |
handicap
|
private float |
komi
|
private ArrayList |
kos
Each element is a NumberedStone object. |
private String |
location
|
private ArrayList |
moves
Each element is a Move object. |
private ArrayList |
prisoners
Each element is a NumberedStone object. |
private Rules |
rules
|
private short |
status
|
private String |
white
|
static short |
WHITETOMOVE
constant which indicates that it is whites turn. |
Constructor Summary | |
GameRecord(Handicap h,
String b,
String w,
Rules r,
float k)
Create a new GameRecord object. |
Method Summary | |
void |
addBlackPlayer(String p)
Add the name of the black player to the record. |
void |
addDate(long d)
The date that the game was played. |
void |
addId(String id)
Set the id of the game. |
void |
addKo(NumberedStone stone)
Add a ko to the game record. |
void |
addLocation(String loc)
Add the location where the game was played to the record. |
void |
addMove(Move move)
Add a move to the game record. |
void |
addPrisoner(NumberedStone prisoner)
Add a prisoner to the game record. |
void |
addWhitePlayer(String p)
Add the name of the white player to the record. |
String |
getBlackPlayer()
Get the name of the black player. |
String |
getClientLocation()
Get the location where the game was played. |
long |
getDate()
Get the date that the game was played. |
Stone[] |
getHandicapStones()
Return the handicap stones. |
String |
getId()
Return the game id. |
NumberedStone[] |
getKos()
Return all kos that occurred in the game. |
Move |
getLastMove()
Get the last move from the game. |
Move[] |
getMoves()
Return the moves from the game. |
NumberedStone[] |
getPrisoners()
Return the prisoners from the game. |
int |
getStatus()
Return the status variable. |
String |
getWhitePlayer()
Get the name of the white player. |
void |
setStatus(short s)
Set the status of the game. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final short BLACKTOMOVE
public static final short WHITETOMOVE
public static final short GAMEOVER
private Handicap handicap
private Rules rules
private float komi
private String location
private String black
private String white
private long date
private String gameId
private short status
private ArrayList kos
private ArrayList prisoners
private ArrayList moves
Constructor Detail |
public GameRecord(Handicap h, String b, String w, Rules r, float k)
h
- The handicap stones.b
- The name of the black playerw
- The name of the white playerr
- The rule set, e.g, Japanese.k
- The value of the komi.Method Detail |
public void addLocation(String loc)
loc
- The location where the game was played.public void addBlackPlayer(String p)
p
- The client player.public void addWhitePlayer(String p)
p
- The client player.public void addDate(long d)
d
- The date that the game was played.public void addId(String id)
id
- The game id.public void addKo(NumberedStone stone)
stone
- The move that would illegally retake the ko.public void addMove(Move move)
move
- The move to add to the record.public void addPrisoner(NumberedStone prisoner)
prisoner
- The stone that was captured.public String getClientLocation()
public String getBlackPlayer()
public String getWhitePlayer()
public long getDate()
public Stone[] getHandicapStones()
public String getId()
public NumberedStone[] getKos()
public Move[] getMoves()
public NumberedStone[] getPrisoners()
public void setStatus(short s) throws IllegalArgumentException
IllegalArgumentException
- Thrown if the
status value is out of range.public int getStatus()
public Move getLastMove() throws NoSuchDataException
A
- NoSuchDataException is thrown if no non-handicap moves have been made.
NoSuchDataException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |