|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.util.GameId
This class encapsulates a String that represents a game. It ensures that ids are unique in that they don't conflict with active games or games in permanent storage.
Field Summary | |
private static HashSet |
active
This is a Set containing the active GameId objects. |
private String |
id
The id of the game. |
private static HashMap |
komi
The key is the GameId object, and the value a Float object. |
Constructor Summary | |
GameId()
Create a new GameId object. |
|
GameId(String str,
boolean unique)
Generate a GameId object with the value of the parameter str. |
Method Summary | |
boolean |
equals(Object o)
|
private boolean |
exists(GameId gid)
|
private boolean |
gameIdExists(GameId id)
|
String |
get()
Return the game id. |
float |
getKomi()
|
private String |
getNext()
|
private String |
getUnsynchronized()
|
int |
hashCode()
|
void |
setKomi(float k)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private String id
private static HashSet active
private static HashMap komi
Constructor Detail |
public GameId()
public GameId(String str, boolean unique) throws IllegalArgumentException
str
- The value of the game id.unique
- If true, then throw an exception if the id is already in use.
IllegalArgumentException
- Thrown if unique is true and the id already exists.Method Detail |
private boolean gameIdExists(GameId id)
private String getNext()
private String getUnsynchronized()
private boolean exists(GameId gid)
public String get()
public void setKomi(float k)
public float getKomi()
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |