| java.util.Vector poker.business.GameList
GameList | public class GameList extends Vector implements java.io.Serializable(Code) | | EnhyDraw!, beta 4, 5/21/99
Copyright 1999, Larry Wolcot & Daryl Tempesta
ALL rights reserved. Not for commercial use
without written permission from both authors.
This is the GameList object that does all of the database dirtywork.
The GameManager class started off just using a Vector to keep a list
of all active PokerGame classes. It's not the most direct way of doing
things, but by far the easiest way to illustrate how the DODS Objects
can easily be used within a standard application.
In the GameManager, I just changed the gameList to extend this object
instead of a Vector. Now, we can simply divert some of the Vector's
methods and use it more like a standard database adapter. Otherwise,
if the useDB flag is set to false, we can just do a pass-through to
the Super Object (Vector).
|
Constructor Summary | |
public | GameList(int n) |
GameList | public GameList(int n)(Code) | | Public Constructor
|
addGame | public synchronized void addGame(PokerGame thisGame)(Code) | | Send to the Vector() or the DB depending on the useDB flag
This is where we hook into the DODS_GameData Object
|
addGameToDB | public synchronized void addGameToDB(PokerGame newGame) throws Exception(Code) | | This is a private method that maps the PokerGame to
a GameDataDO Object so it can be inserted into the database.
|
authenticate | public boolean authenticate(String name, String pw)(Code) | | This method ddtermines which storage medium is ised, then
doles the authenticate request to the right place.
|
authenticateInDB | public synchronized boolean authenticateInDB(String name, String pw)(Code) | | Authenticate user in DB
|
authenticateInMemory | public synchronized boolean authenticateInMemory(String name, String pw)(Code) | | Authenticate user in memory
|
getCopy | protected GameList getCopy()(Code) | | This method returns a copy of the gameList object.
|
getCount | public int getCount()(Code) | | This method returns the total players registered in the
DB or Vector
|
getGame | public PokerGame getGame(String name)(Code) | | This method ddtermines which storage medium is ised, then
doles the getGameByName request to the right place.
|
getGameInMemory | public synchronized PokerGame getGameInMemory(String name)(Code) | | Return the game that belongs to user name
from the Vector in memory
|
getIsNameUsed | public boolean getIsNameUsed(String name)(Code) | | This method ddtermines which storage medium is ised, then
doles the getIsNameUsed request to the right place.
|
getIsNameUsedInDB | public synchronized boolean getIsNameUsedInDB(String name)(Code) | | Check to see if this name has been used in the DB
|
getIsNameUsedInMemory | public synchronized boolean getIsNameUsedInMemory(String name)(Code) | | Check to see if this name has been used in Memory
|
getRank | public synchronized int getRank(int cash)(Code) | | get rank of current dollars compared to the gameList
|
getTopTen | public Vector getTopTen()(Code) | | This method ddtermines which storage medium is ised, then
doles the getTopTen method to the right place.
|
getTopTenInDB | public Vector getTopTenInDB()(Code) | | This method queries the database for all games sorted
by score, then returns a vector with the top 10
|
getTopTenInMemory | public synchronized Vector getTopTenInMemory()(Code) | | return the top ten players ranked by cash won
|
removeDBGame | public synchronized void removeDBGame(String name) throws Exception(Code) | | This method removes thisGame's record from the DB
|
removeGame | public synchronized void removeGame(String thisName)(Code) | | This method detremines the storage medium, then dishes
the removeGame call out to the proper method
|
removeMemoryGame | public void removeMemoryGame(String name)(Code) | | This method removes the thisGame object from the Vector
|
setUseDB | public void setUseDB(boolean useDB) throws Exception(Code) | | Here is where we determine how to store our data.. db or memory.
|
updateGame | public synchronized void updateGame(PokerGame thisGame)(Code) | | Check to see if the DO changes need to be updated to the DB
|
|
|