Modifier and Type | Field and Description |
---|---|
private String |
emailId
Email id of the gamer.
|
private Object |
id
This variable could be used as a database key.
|
private String |
name
The name of the gamer.
|
private Set<PlayerSession> |
playerSessions
One player can be connected to multiple games at the same time.
|
Constructor and Description |
---|
DefaultPlayer() |
DefaultPlayer(Object id,
String name,
String emailId) |
Modifier and Type | Method and Description |
---|---|
boolean |
addSession(PlayerSession session)
Add a session to a player.
|
boolean |
equals(Object obj) |
String |
getEmailId()
Method used to get the email id of the gamer.
|
Object |
getId()
A unique key representing a gamer.
|
String |
getName()
Method used to get the name of the gamer.
|
Set<PlayerSession> |
getPlayerSessions() |
int |
hashCode() |
void |
logout(PlayerSession session)
When a player logs out, this method can be called.
|
boolean |
removeSession(PlayerSession session)
Remove the players session to a game.
|
void |
setEmailId(String emailId)
Method used to set the email id of the gamer.
|
void |
setId(Object id)
A unique key representing a gamer.
|
void |
setName(String name)
Method used to set the name of the gamer.
|
void |
setPlayerSessions(Set<PlayerSession> playerSessions) |
private Object id
private String name
private String emailId
private Set<PlayerSession> playerSessions
public Object getId()
Player
public void setId(Object id)
Player
public String getName()
Player
public void setName(String name)
Player
public String getEmailId()
Player
getEmailId
in interface Player
public void setEmailId(String emailId)
Player
setEmailId
in interface Player
emailId
- Sets the email id string. strings more than 50 characters long
may be rejected.public boolean addSession(PlayerSession session)
Player
addSession
in interface Player
session
- The session to add.public boolean removeSession(PlayerSession session)
Player
removeSession
in interface Player
session
- The session to remove.public void logout(PlayerSession session)
Player
public Set<PlayerSession> getPlayerSessions()
public void setPlayerSessions(Set<PlayerSession> playerSessions)
Copyright © 2012. All Rights Reserved.