de.hattrickorganizer.logik
Class TrainingsManager

java.lang.Object
  extended by de.hattrickorganizer.logik.TrainingsManager
All Implemented Interfaces:
ITrainingsManager

public class TrainingsManager
extends java.lang.Object
implements ITrainingsManager

Class that extract data from Database and calculates TrainingWeek and TrainingPoints earned from players

Author:
humorlos, Dragettho, thetom

Field Summary
 
Fields inherited from interface plugins.ITrainingsManager
PLAYERSTATUS_NO_MATCHDATA, PLAYERSTATUS_NO_MATCHDETAILS, PLAYERSTATUS_NOT_IN_LINEUP, PLAYERSTATUS_OK, PLAYERSTATUS_RED_CARD
 
Method Summary
 ITrainingPerPlayer calculateFullTrainingForPlayer(ISpieler inputSpieler, java.util.Vector inputTrainings, java.sql.Timestamp timestamp)
          liefert die komplette Trainings in jedem skill eines Spielers calculates TRaining for given Player for each skill
 java.util.Vector calculateTrainings(java.util.Vector inputTrainings)
          TODO Missing Method Documentation
 ITrainingPerPlayer calculateWeeklyTrainingForPlayer(ISpieler inputSpieler, ITrainingWeek train)
           
 ITrainingPerPlayer calculateWeeklyTrainingForPlayer(ISpieler inputSpieler, ITrainingWeek train, java.sql.Timestamp timestamp)
          liefert die komplette Trainings in jedem skill eines Spielers calculates Training for given Player for each skill
 double getBasePoints(int trainType, int position)
          Returns the base points a player gets for this training type in a full match at this position
 ITrainingWeek getLastTrainingWeek(int hrfId)
          TODO Missing Method Documentation
 java.util.List getMatchesForTraining(java.util.Calendar trainingDate)
          Creates a list of matches for the specified training
 int getMatchPosition(int matchId, int playerId)
          Returns the positionId for a player in a specific match If he is not in the lineup, return the player status (PLAYERSTATUS_*)
 int getMinutesPlayed(int matchId, int playerId)
          Calculates how long the player was on the field in the specified match
 int getPlayerStatus(int matchId, int playerId)
          Returns the player status (PLAYERSTATUS_*) for a player in a specific match
 ITrainingPerPlayer getTrainingPerPlayer()
          returns an empty ITrainingPerPlayer instance
 ITrainingPerPlayer getTrainingPerPlayer(ISpieler player)
          returns a ITrainingPerPlayer instance for a specific player
 ITrainingPoint getTrainingPoint()
          get a new training point instance
 ITrainingPoint getTrainingPoint(int year, int week, int type, int intensity, int staminaTrainingPart)
          get a new training point instance initialized with a new ITrainingWeek created by the arguments
 ITrainingPoint getTrainingPoint(ITrainingWeek trainWeek)
          get a new training point instance initialized with existing ITrainingWeek
 java.util.Vector getTrainingsVector()
          returns current TrainingVector calculates new vector if current is null
static TrainingsManager instance()
          liefert instance vom Trainingsmanager vor der ersten Nutzun noch fillWithData( vorgabeTrainings ) aufrufen
 void recalcSubskills(boolean showBar)
          Recalculates all sub skills for all players
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static TrainingsManager instance()
liefert instance vom Trainingsmanager vor der ersten Nutzun noch fillWithData( vorgabeTrainings ) aufrufen

Returns:
instance of NewTrainingManager

getTrainingPerPlayer

public ITrainingPerPlayer getTrainingPerPlayer()
returns an empty ITrainingPerPlayer instance

Specified by:
getTrainingPerPlayer in interface ITrainingsManager

getTrainingPerPlayer

public ITrainingPerPlayer getTrainingPerPlayer(ISpieler player)
returns a ITrainingPerPlayer instance for a specific player

Specified by:
getTrainingPerPlayer in interface ITrainingsManager

getLastTrainingWeek

public ITrainingWeek getLastTrainingWeek(int hrfId)
TODO Missing Method Documentation

Parameters:
hrfId - TODO Missing Method Parameter Documentation
Returns:
TODO Missing Return Method Documentation

getTrainingPoint

public ITrainingPoint getTrainingPoint()
get a new training point instance

Specified by:
getTrainingPoint in interface ITrainingsManager
Returns:
new training point

getTrainingPoint

public ITrainingPoint getTrainingPoint(ITrainingWeek trainWeek)
get a new training point instance initialized with existing ITrainingWeek

Specified by:
getTrainingPoint in interface ITrainingsManager
Returns:
new training point

getTrainingPoint

public ITrainingPoint getTrainingPoint(int year,
                                       int week,
                                       int type,
                                       int intensity,
                                       int staminaTrainingPart)
get a new training point instance initialized with a new ITrainingWeek created by the arguments

Specified by:
getTrainingPoint in interface ITrainingsManager
Returns:
new training point

getTrainingsVector

public java.util.Vector getTrainingsVector()
Description copied from interface: ITrainingsManager
returns current TrainingVector calculates new vector if current is null

Specified by:
getTrainingsVector in interface ITrainingsManager
Returns:
TODO Missing Return Method Documentation

calculateFullTrainingForPlayer

public ITrainingPerPlayer calculateFullTrainingForPlayer(ISpieler inputSpieler,
                                                         java.util.Vector inputTrainings,
                                                         java.sql.Timestamp timestamp)
liefert die komplette Trainings in jedem skill eines Spielers calculates TRaining for given Player for each skill

Parameters:
inputSpieler - Player to use
inputTrainings - preset Trainingweeks
timestamp - calc trainings up to timestamp, null for all
Returns:
TrainingPerPlayer

calculateTrainings

public java.util.Vector calculateTrainings(java.util.Vector inputTrainings)
TODO Missing Method Documentation

Specified by:
calculateTrainings in interface ITrainingsManager
Parameters:
inputTrainings - TODO Missing Method Parameter Documentation
Returns:
TODO Missing Return Method Documentation

calculateWeeklyTrainingForPlayer

public ITrainingPerPlayer calculateWeeklyTrainingForPlayer(ISpieler inputSpieler,
                                                           ITrainingWeek train)

calculateWeeklyTrainingForPlayer

public ITrainingPerPlayer calculateWeeklyTrainingForPlayer(ISpieler inputSpieler,
                                                           ITrainingWeek train,
                                                           java.sql.Timestamp timestamp)
liefert die komplette Trainings in jedem skill eines Spielers calculates Training for given Player for each skill

Parameters:
inputSpieler - Player to use
train - preset Trainingweeks
timestamp - if not null, calculate training for this training date only
Returns:
TrainingPerPlayer

recalcSubskills

public void recalcSubskills(boolean showBar)
Recalculates all sub skills for all players

Specified by:
recalcSubskills in interface ITrainingsManager
Parameters:
showBar - show progress bar

getBasePoints

public double getBasePoints(int trainType,
                            int position)
Returns the base points a player gets for this training type in a full match at this position

Specified by:
getBasePoints in interface ITrainingsManager
Parameters:
trainType - training type
position - player position id
Returns:
base points

getMinutesPlayed

public int getMinutesPlayed(int matchId,
                            int playerId)
Calculates how long the player was on the field in the specified match

Specified by:
getMinutesPlayed in interface ITrainingsManager
Parameters:
matchId - the match to check
playerId - the player to check
Returns:
number of minutes the player was on the field

getMatchesForTraining

public java.util.List getMatchesForTraining(java.util.Calendar trainingDate)
Creates a list of matches for the specified training

Specified by:
getMatchesForTraining in interface ITrainingsManager
Parameters:
trainingDate - use this trainingDate
Returns:
list of matchIds (type Integer)

getPlayerStatus

public int getPlayerStatus(int matchId,
                           int playerId)
Returns the player status (PLAYERSTATUS_*) for a player in a specific match

Specified by:
getPlayerStatus in interface ITrainingsManager
Parameters:
matchId - match id
playerId - player id
Returns:
player status

getMatchPosition

public int getMatchPosition(int matchId,
                            int playerId)
Returns the positionId for a player in a specific match If he is not in the lineup, return the player status (PLAYERSTATUS_*)

Specified by:
getMatchPosition in interface ITrainingsManager
Parameters:
matchId - match id
playerId - player id
Returns:
position id