|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
org.jogre.common.User
Transmittable user data object. Contains the username, score, number of wins/loses and draws.
Field Summary | |
protected int |
draws
Score rating of User. |
protected int |
loses
Score rating of User. |
protected int |
rating
Score rating of User. |
protected int |
streak
Score rating of User. |
protected String |
username
Username of User. |
protected int |
wins
Score rating of User. |
Constructor Summary | |
User(String username,
int rating,
int wins,
int loses,
int draws,
int streak)
User constructor which takes a username, rating, number of wins, loses, draws and a user streak. |
|
User(XMLElement message)
Constructor which creates a User object from the flatten () method of another User object. |
Method Summary | |
boolean |
equals(Object obj)
Customer equals method to compare User objects |
XMLElement |
flatten()
Flatten the User object for transmission. |
int |
getDraws()
Return the number of draws a user has had. |
int |
getGamesPlayed()
Return the number of games this player has played. |
int |
getLosses()
Return the number of losses a user has had. |
int |
getRating()
Returns the rating of this particular user (currently not implemented). |
int |
getStreak()
Return the user streak. |
String |
getUsername()
Return the username of this user. |
int |
getWins()
Return the number of wins a user has had. |
boolean |
isProvisional()
Return true if a user is still provisional. |
void |
update(int resultType,
int newRating)
Update a user depending on a result type and their new rating. |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String username
protected int rating
protected int wins
protected int draws
protected int loses
protected int streak
Constructor Detail |
public User(String username, int rating, int wins, int loses, int draws, int streak)
username
- Username of user.rating
- User rating.wins
- Number of user wins.loses
- Number of users loses.draws
- Number of user draws.streak
- Streak of user.public User(XMLElement message) throws TransmissionException
message
- XMLElement communication object.
TransmissionException
- Thrown if there is a problem in transmission.Method Detail |
public String getUsername()
public int getRating()
public int getDraws()
public int getLosses()
public int getWins()
public int getStreak()
public int getGamesPlayed()
public boolean isProvisional()
public void update(int resultType, int newRating)
resultType
- Result type - e.g. win, lose or drawnewRating
- New ratingpublic XMLElement flatten()
flatten
in interface ITransmittable
ITransmittable.flatten()
public boolean equals(Object obj)
Object.equals(java.lang.Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |