game.gamestorage.texas.db.estimation
Class GetterQueryExecution

java.lang.Object
  extended by game.gamestorage.texas.db.estimation.GetterQueryExecution

public class GetterQueryExecution
extends java.lang.Object

This class is the "db-side" part of the mapping form database to Java
Responsable for reading the db

Author:
Witthold/Korol TODO use allTime methods for higher performance - eval that

Field Summary
protected static SQLHandler h
          SQLHandler initializes ConnectionManager
 
Constructor Summary
GetterQueryExecution()
           
 
Method Summary
protected static long[] getBetOfFirstAction(int player_id, int hand_id)
           
static int[] getCompetitionIds(int gamedef_id)
           
static int[] getCompetitionIds(int gamedef_id, long timestamp)
           
static int[] getCompetitionIds(long timestamp)
           
protected static java.util.ArrayList<int[]> getCompetitionPlayerMaps(int competition_id)
           
protected static java.util.ArrayList<long[]> getFirstBetsOfRound(int player_id, int competition_id, int lastEvaledHandId)
           
protected static java.util.ArrayList<long[]> getFirstRounds(int player_id, int competition_id, int lastEvaledHandId)
           
protected static java.util.ArrayList<int[]> getHandPlayerMapCardsClosed(int player_id, int competition_id, int lastEvaledHandId)
           
protected static java.util.ArrayList<int[]> getHandPlayerMapsWhereEnemyCardsOpen(int player_id, int competition_id, int lastEvaledHandId)
           
protected static java.util.ArrayList<int[]> getHandsCC(int player_id, int competition_id, int lastEvaledHandId)
           
protected static java.util.ArrayList<int[]> getHandsCO(int player_id, int competition_id, int lastEvaledHandId)
           
protected static int[] getHoleCards(int hand_player_map_id)
           
static int getLatestCompetitionId()
           
static int getLatestHandId()
           
protected static int getNumActivePlayers(int hand_id)
           
static java.util.HashMap<java.lang.Integer,java.lang.String> getPlayersInCompetition(int competition_id)
           
static java.util.HashMap<java.lang.String,java.lang.Integer> getPlayersInCompetitionSI(int competition_id)
           
protected static long[] getPreviousActions(long round_id, long playersFirstBetId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

h

protected static SQLHandler h
SQLHandler initializes ConnectionManager

Constructor Detail

GetterQueryExecution

public GetterQueryExecution()
Method Detail

getCompetitionIds

public static int[] getCompetitionIds(long timestamp)
Parameters:
timestamp - as unix timestamp
Returns:
int[] of competition_ids newer than timestamp && same gamedef like newest

getCompetitionIds

public static int[] getCompetitionIds(int gamedef_id)
Parameters:
gamedef_id - - already generated by db
Returns:
int[] of competition_ids newer than timestamp && same gamedef like newest

getCompetitionIds

public static int[] getCompetitionIds(int gamedef_id,
                                      long timestamp)
Parameters:
gamedef_id - - already generated by db
timestamp - as unix timestamp
Returns:
int[] of competition_ids newer than timestamp && same gamedef like current

getLatestCompetitionId

public static int getLatestCompetitionId()
Returns:
int competition.id

getLatestHandId

public static int getLatestHandId()
Returns:
int competition.id

getPlayersInCompetition

public static java.util.HashMap<java.lang.Integer,java.lang.String> getPlayersInCompetition(int competition_id)
Parameters:
competition_id - already generated by db
Returns:
HashMap of Integer, String: player.id, player.alias

getPlayersInCompetitionSI

public static java.util.HashMap<java.lang.String,java.lang.Integer> getPlayersInCompetitionSI(int competition_id)
Parameters:
competition_id - already generated by db
Returns:
HashMap of String, Integer: player.alias, player.id

getCompetitionPlayerMaps

protected static java.util.ArrayList<int[]> getCompetitionPlayerMaps(int competition_id)
Parameters:
competition_id - already generated by db
Returns:
ArrayList of int[]: player_id, cash_init, rank

getHandPlayerMapsWhereEnemyCardsOpen

protected static java.util.ArrayList<int[]> getHandPlayerMapsWhereEnemyCardsOpen(int player_id,
                                                                                 int competition_id,
                                                                                 int lastEvaledHandId)
Parameters:
player_id - already generated by db
competition_id - already generated by db
lastEvaledHandId - already generated by db
Returns:
ArrayList of int[]:
hand_player_map for EnemyCardsOpen with:
hand_player_map.id, hand_player_map.position, hand_player_map.cash_init, hand_player_map.cash_delta, hand_player_map.hand_id

getNumActivePlayers

protected static int getNumActivePlayers(int hand_id)
Parameters:
hand_id - already generated by db
Returns:
numActivePlayers at hand

getHoleCards

protected static int[] getHoleCards(int hand_player_map_id)
Parameters:
hand_player_map_id - already generated by db
Returns:
int[] EnemyCards

getBetOfFirstAction

protected static long[] getBetOfFirstAction(int player_id,
                                            int hand_id)
Parameters:
player_id - already generated by db
hand_id - already generated by db
Returns:
long[] BetOfFirstAction with:
id, action, betsize, potsize, timestamp, round_id

getFirstBetsOfRound

protected static java.util.ArrayList<long[]> getFirstBetsOfRound(int player_id,
                                                                 int competition_id,
                                                                 int lastEvaledHandId)
Parameters:
player_id - already generated by db
competition_id - already generated by db
lastEvaledHandId - already generated by db
Returns:
ArrayList of long[] firstBetsOfRound with:
bet.round_id, MIN(bet.id), bet.action, bet.betsize, bet.potsize, bet.timestamp, bet.round_id

getFirstRounds

protected static java.util.ArrayList<long[]> getFirstRounds(int player_id,
                                                            int competition_id,
                                                            int lastEvaledHandId)
Parameters:
player_id - already generated by db
competition_id - already generated by db
lastEvaledHandId - already generated by db
Returns:
ArrayList of long[] rounds with:
round.hand_id, round.id, round.timestamp

getPreviousActions

protected static long[] getPreviousActions(long round_id,
                                           long playersFirstBetId)
Parameters:
round_id - already generated by db
playersFirstBetId - already generated by db
Returns:
long[] PreviousActions with:
action

getHandsCO

protected static java.util.ArrayList<int[]> getHandsCO(int player_id,
                                                       int competition_id,
                                                       int lastEvaledHandId)
Parameters:
player_id - already generated by db
competition_id - already generated by db
lastEvaledHandId - already generated by db
Returns:
ArrayList of int[] Hands with:
hand.id, hand.sb, hand.bb, hand.ante, hand.finalpot

getHandsCC

protected static java.util.ArrayList<int[]> getHandsCC(int player_id,
                                                       int competition_id,
                                                       int lastEvaledHandId)
Parameters:
player_id - already generated by db
competition_id - already generated by db
lastEvaledHandId - already generated by db
Returns:
ArrayList of int[] Hands with:
hand.id, hand.sb, hand.bb, hand.ante, hand.finalpot

getHandPlayerMapCardsClosed

protected static java.util.ArrayList<int[]> getHandPlayerMapCardsClosed(int player_id,
                                                                        int competition_id,
                                                                        int lastEvaledHandId)
Parameters:
player_id - already generated by db
competition_id - already generated by db
lastEvaledHandId - already generated by db
Returns:
ArrayList of int[] Hands with:
hand_player_map for EnemyCardsOpen with:
hand_player_map.id, hand_player_map.position, hand_player_map.cash_init, hand_player_map.cash_delta, hand_player_map.hand_id