|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbluegammon.GameRecord
A game record represents one or multiple games between an opponent, keeping
track of scores and such. GameRecord
s are stored in the rms.
The static interface of this class gives hash table like functionality
and also contains logic for keeping the limit of maximum allowed game
records.
Method Summary | |
static int |
countRecords()
Returns number of records saved in the rms. |
static java.util.Vector |
getAllRecords()
Returns a vector of GameRecord s, containing
all stored game records. |
int |
getGameCount()
Returns number of games played agains opponent represented in this record. |
int |
getIndex()
Returns the index in rms that this record occupies. |
int |
getOpponentId()
Returns the id of the opponent represented in this record. |
char[] |
getOpponentName()
Returns the name of the opponent represented in this record. |
int |
getOpponentScore()
Returns the score of the opponent represented in this record. |
int |
getPlayerScore()
Returns the score of the player represented in this record. |
static GameRecord |
getRecord(Player opponent)
Returns record for a specific opponent. |
static byte[] |
getSavedGame(int id)
Returns the data of a saved game. |
long |
getTimestamp()
Returns the time of the latest change to this record. |
static void |
saveGame(Player opponent,
byte[] savedGame)
Saves the state of an ongoing game against specified opponents. |
static void |
updateGameResult(Player opponent,
boolean localWinner,
int score)
Updates the game results with a new game. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public long getTimestamp()
public int getOpponentId()
public char[] getOpponentName()
public int getOpponentScore()
public int getPlayerScore()
public int getGameCount()
public int getIndex()
public static byte[] getSavedGame(int id)
id
- The opponent id.
public static void saveGame(Player opponent, byte[] savedGame)
opponent
- The opponent player.savedGame
- The saved game data.public static int countRecords()
public static java.util.Vector getAllRecords()
GameRecord
s, containing
all stored game records.
public static GameRecord getRecord(Player opponent)
opponent
- The opponent.
GameRecord
for this opponent, or null
if it does not exist.public static void updateGameResult(Player opponent, boolean localWinner, int score)
opponent
- The opponent player.localWinner
- If this game was won by local player.score
- The score.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |