com.asdf.server
Class Account

java.lang.Object
  extended by com.asdf.server.Account

public class Account
extends java.lang.Object

Stores account details like name and type. List of associated sessions is also stored.


Field Summary
 Statistics scores
           
 
Constructor Summary
Account(java.lang.String name, AccountType type)
          Constructor.
 
Method Summary
 double getBalance()
           
 java.lang.String getName()
          Getter for account name
 Game getSession(java.lang.Long id)
          Getter for game instance.
 AccountType getType()
          Return the type of the user
 void insertSession(Game game)
          Creates a new session for this account.
 boolean insertSession(java.lang.Long id, Game game)
          Creates a new session for this account
 void removeSession(java.lang.Long id)
          Removes a session from the account.
 void setBalance(double balance)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scores

public Statistics scores
Constructor Detail

Account

public Account(java.lang.String name,
               AccountType type)
Constructor. Creates a new account with a given account name.

Parameters:
name - Account name
Method Detail

getName

public java.lang.String getName()
Getter for account name

Returns:
Name of the account

getType

public AccountType getType()
Return the type of the user

Returns:
Type as short

insertSession

public boolean insertSession(java.lang.Long id,
                             Game game)
Creates a new session for this account

Parameters:
id - Session ID
game - Game with which this session is associated with
Returns:
returns true on successful operation, false otherwise.

insertSession

public void insertSession(Game game)
Creates a new session for this account. Success is guaranteed but time consumption is a stochastic random variable.

Parameters:
game - Game with which this session is associated with

removeSession

public void removeSession(java.lang.Long id)
Removes a session from the account.

Parameters:
id - ID of the session to be removed.

getSession

public Game getSession(java.lang.Long id)
Getter for game instance.

Parameters:
id - Session ID associated with the game that we want to get.
Returns:
Game associated with the given session ID. If there exists no such game, null is returned.

getBalance

public double getBalance()
Returns:
the balance

setBalance

public void setBalance(double balance)
Parameters:
balance - the balance to set