|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.jetrix.winlist.SimpleWinlist
public class SimpleWinlist
A standard winlist using the same scoring as the original TetriNET : the winner gets 3 points if there was 3 or more players (or different teams) involved in the game, 2 points otherwise; the second gets 1 point if there was 5 or more players in the game. The winlist is saved in a xxxx.winlist file.
| Field Summary | |
|---|---|
protected WinlistConfig |
config
|
protected boolean |
initialized
|
protected Logger |
log
|
protected boolean |
persistent
|
protected List<Score> |
scores
|
| Constructor Summary | |
|---|---|
SimpleWinlist()
|
|
| Method Summary | |
|---|---|
void |
clear()
Remove all entries in the winlist |
WinlistConfig |
getConfig()
Return the configuration necessary to create the same winlist |
protected PlineMessage |
getGainMessage(Score score,
long previousScore,
long previousRank)
Build a message displaying the new score and rank of a winner. |
String |
getId()
Return the id for this winlist. |
Score |
getScore(String name,
int type)
Return the score of the specified player or team |
List<Score> |
getScores(long offset,
long length)
Return the score list in the specified range. |
void |
init(WinlistConfig config)
Initialize the winlist. |
boolean |
isPersistent()
|
protected void |
load()
Load the winlist from a file. |
protected void |
save()
Save the winlist to a file. |
void |
saveGameResult(GameResult result)
Update the winlist with the specified game result. |
void |
setId(String id)
Set the id for this winlist. |
void |
setPersistent(boolean persistent)
|
int |
size()
Return the number of entries in the winlist |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected List<Score> scores
protected boolean initialized
protected boolean persistent
protected Logger log
protected WinlistConfig config
| Constructor Detail |
|---|
public SimpleWinlist()
| Method Detail |
|---|
public String getId()
Winlist
getId in interface Winlistpublic void setId(String id)
Winlist
setId in interface Winlistpublic void init(WinlistConfig config)
Winlist
init in interface Winlistconfig - the winlist configurationpublic WinlistConfig getConfig()
Winlist
getConfig in interface Winlistpublic boolean isPersistent()
public void setPersistent(boolean persistent)
public Score getScore(String name,
int type)
Winlist
getScore in interface Winlistname - the name of the player or teamtype - the score type (0: player, 1: team)
public List<Score> getScores(long offset,
long length)
Winlist
getScores in interface Winlistoffset - the beginning of the rangelength - the length of the rangepublic void saveGameResult(GameResult result)
Winlist
saveGameResult in interface Winlistpublic void clear()
Winlist
clear in interface Winlistpublic int size()
Winlist
size in interface Winlistprotected void load()
protected void save()
protected PlineMessage getGainMessage(Score score,
long previousScore,
long previousRank)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||