edu.cmu.mse17654.Casino
Class BankImpl

java.lang.Object
  |
  +--org.omg.PortableServer.Servant
        |
        +--edu.cmu.mse17654.Casino.BankPOA
              |
              +--edu.cmu.mse17654.Casino.BankImpl
All Implemented Interfaces:
edu.cmu.mse17654.Casino.BankOperations, org.omg.CORBA.portable.InvokeHandler

public class BankImpl
extends edu.cmu.mse17654.Casino.BankPOA

The Implementation of the idl Banking interface.


Constructor Summary
BankImpl(edu.cmu.mse17654.Casino.BankDB bdb)
          This constructor method will read the credit card information from the data file.
 
Method Summary
 void buyChips(int playerID, int quantity)
          This method is to add the chips to the databse for the specified player ID.
 int getChipBalance(int playerID)
          This method is to get the current chip balance of the specified player from the database.
 void sellAllChips(int playerID)
          This method is to cash the chips of the specified player from the bank.
 void sellChips(int playerID, int quantity)
          This method is to sell some of the chips of the specified player from the bank.
 
Methods inherited from class edu.cmu.mse17654.Casino.BankPOA
_all_interfaces, _invoke, _this, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BankImpl

public BankImpl(edu.cmu.mse17654.Casino.BankDB bdb)
This constructor method will read the credit card information from the data file.

Parameters:
bdb - The bank database reference
Method Detail

buyChips

public void buyChips(int playerID,
                     int quantity)
              throws edu.cmu.mse17654.Casino.InvalidPlayerID
This method is to add the chips to the databse for the specified player ID. It is assumed that the bank will allow player to buy any chips.

Parameters:
playerID - The player ID
quantity - The chip quantity that player wants to buy
Returns:
void
Throws:
It - raises the exception when the player ID is invalid.
edu.cmu.mse17654.Casino.InvalidPlayerID

sellChips

public void sellChips(int playerID,
                      int quantity)
               throws edu.cmu.mse17654.Casino.InvalidPlayerID
This method is to sell some of the chips of the specified player from the bank. The result is to subtract from the chip balance of the player from the bank.

Parameters:
playerID - The player ID
quantity - The chip quantity that player wants to buy
Returns:
void
Throws:
It - raises exception when the player ID is invalid.
edu.cmu.mse17654.Casino.InvalidPlayerID

sellAllChips

public void sellAllChips(int playerID)
                  throws edu.cmu.mse17654.Casino.InvalidPlayerID
This method is to cash the chips of the specified player from the bank. The result is to remove the chip balance of the player from the bank.

Parameters:
playerID - The player ID
Returns:
void
Throws:
It - raises exception when the player ID is invalid.
edu.cmu.mse17654.Casino.InvalidPlayerID

getChipBalance

public int getChipBalance(int playerID)
This method is to get the current chip balance of the specified player from the database.

Parameters:
playerID - The player ID
Returns:
It returns the player's current chip balance.