game.gamestorage.texas.db
Class SetterDBProjector

java.lang.Object
  extended by game.gamestorage.texas.db.DBProjector
      extended by game.gamestorage.texas.db.SetterDBProjector

public class SetterDBProjector
extends DBProjector

This class is the "middle" part of the mapping form Java to database
Responsable for writing to db the annotation "@category" is used to group methods to higher level methods in
game.gamestorage.IF_SetGameStorage and
game.gamestorage.texas.IF_SetGameStorageTH

Author:
Witthold/Korol

Field Summary
private  int hand_id
          hand depending fields
private  int[] hand_player_map_ids
           
private  int round_id
           
 
Fields inherited from class game.gamestorage.texas.db.DBProjector
competition_id, gamedef_id, player_ids, player_names
 
Constructor Summary
SetterDBProjector()
           
 
Method Summary
 boolean connectionSuccess()
           
 int getHand_id()
           
 int[] getHandPlayerMap_ids()
           
 boolean setBetHistory(long timestamp, java.util.ArrayList<Action> betHistory)
           
 boolean setCardOfPlayer(Card[] holeCards)
           
 boolean setCashDeltas(int[] cash_delta)
           
 boolean setCommonCards(Card[] revealedBoardCards)
           
 boolean setCompetition()
          writes competition
 boolean setCompetitionPlayerMap(int[] cash_init)
          writes competition_player_map
 boolean setFinalPot(int finalpot)
           
 boolean setGameDef(int limited, int minBet, int maxBet, int numPlayers, int style, int buyin)
          writes gamedef
 boolean setHand(int sb, int bb, int ante)
          writes hand
 boolean setHandPlayerMap(int[] position, int[] cash_init)
          writes hand_player_map
 boolean setHoleCards(Card[][] enemyCards)
           
 boolean setPlayers(java.lang.String[] player_names)
          writes player - if not already existing
 boolean setRankings(int[] ranking)
           
 
Methods inherited from class game.gamestorage.texas.db.DBProjector
getGamedef_id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hand_id

private int hand_id
hand depending fields


round_id

private int round_id

hand_player_map_ids

private int[] hand_player_map_ids
Constructor Detail

SetterDBProjector

public SetterDBProjector()
Method Detail

setGameDef

public boolean setGameDef(int limited,
                          int minBet,
                          int maxBet,
                          int numPlayers,
                          int style,
                          int buyin)
writes gamedef

Parameters:
limited - - limited:1; pot-limit:0; no-limit: -1
minBet - - only int possible
maxBet - - only int possible
numPlayers - - amount of participating players
style - - cashgame:1; tournament:2; doyle:3;
buyin - - only int possible
Returns:
true, if writing to db succeeded

setCompetition

public boolean setCompetition()
writes competition

Returns:
true, if writing to db succeeded

setPlayers

public boolean setPlayers(java.lang.String[] player_names)
writes player - if not already existing

Parameters:
player_names - - all participants as String[] -
Returns:
true, if writing to db succeeded

setCompetitionPlayerMap

public boolean setCompetitionPlayerMap(int[] cash_init)
writes competition_player_map

Parameters:
cash_init - - with how much credits do the players start this? -
Returns:
true, if writing to db succeeded

setHand

public boolean setHand(int sb,
                       int bb,
                       int ante)
writes hand

Parameters:
sb - - smallblind
bb - - bigblind
ante - - forced bet for all players
Returns:
true, if writing to db succeeded

setHandPlayerMap

public boolean setHandPlayerMap(int[] position,
                                int[] cash_init)
writes hand_player_map

Parameters:
position - Position of the player in this hand (0: first player behind the button; 1: second player behind the button; ...)
cash_init - - with how much credits do the players start this? - starting credits of every player
Returns:
true, if writing to db succeeded

setCardOfPlayer

public boolean setCardOfPlayer(Card[] holeCards)
Parameters:
holeCards - - players holeCards as Card[]
Returns:
true, if writing to db succeeded

setBetHistory

public boolean setBetHistory(long timestamp,
                             java.util.ArrayList<Action> betHistory)
Parameters:
timestamp - as unix timestamp
betHistory - - all bets of this round
Returns:
true, if writing to db succeeded

setCommonCards

public boolean setCommonCards(Card[] revealedBoardCards)
Parameters:
revealedBoardCards - (if revealed)
Returns:
true, if writing to db succeeded

setHoleCards

public boolean setHoleCards(Card[][] enemyCards)
Parameters:
enemyCards - - if cards were shown
Returns:
true, if writing to db succeeded

setFinalPot

public boolean setFinalPot(int finalpot)
Parameters:
finalpot - - total at the end of the hand
Returns:
true, if writing to db succeeded

setCashDeltas

public boolean setCashDeltas(int[] cash_delta)
Parameters:
cash_delta - - diff between before and after played hand
Returns:
true, if writing to db succeeded

setRankings

public boolean setRankings(int[] ranking)
Parameters:
ranking - of all participants
Returns:
true, if writing to db succeeded

getHand_id

public int getHand_id()
Returns:
the hand_id generated by db

getHandPlayerMap_ids

public int[] getHandPlayerMap_ids()
Returns:
the hand_player_map_ids generated by db

connectionSuccess

public boolean connectionSuccess()
Returns:
true, if there is at least one connection to the db