de.hattrickorganizer.logik
Class TrainingPoint

java.lang.Object
  extended by de.hattrickorganizer.logik.TrainingPoint
All Implemented Interfaces:
ITrainingPoint

public class TrainingPoint
extends java.lang.Object
implements ITrainingPoint

Class that manages the relation between position and training points It also is manages the calculation of played minutes for a player and its relation to the base points.

Author:
Draghetto HO

Constructor Summary
TrainingPoint()
          Creates a new TrainingPoint object.
TrainingPoint(int year, int week, int type, int intensity, int staminaTrainingPart)
           
TrainingPoint(ITrainingWeek trainWeek)
           
 
Method Summary
 void addTrainingMatch(int minutes, int posId)
          Adds a match to the internal list
 double calcTrainingPoints(boolean ignorePosition)
          Calculate how many points the player gets for this week, using the matches previously added with addTrainingMatch(min, posId) Optimal: 100% position + 90mins -> points = 1.0
 java.lang.Double getTrainingPoint(int trtype, java.lang.Integer playerMatchPosition)
          Mathod that returns the correct training point
 ITrainingWeek getTrainWeek()
          Returns the training week for this training point
 void setTrainWeek(ITrainingWeek trainWeek)
          Sets the training week for this training point
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrainingPoint

public TrainingPoint()
Creates a new TrainingPoint object.


TrainingPoint

public TrainingPoint(ITrainingWeek trainWeek)

TrainingPoint

public TrainingPoint(int year,
                     int week,
                     int type,
                     int intensity,
                     int staminaTrainingPart)
Method Detail

getTrainingPoint

public final java.lang.Double getTrainingPoint(int trtype,
                                               java.lang.Integer playerMatchPosition)
Mathod that returns the correct training point

Specified by:
getTrainingPoint in interface ITrainingPoint
Parameters:
trtype - Training type code
playerMatchPosition - player position code
Returns:
training points earned in that match

addTrainingMatch

public void addTrainingMatch(int minutes,
                             int posId)
Adds a match to the internal list

Specified by:
addTrainingMatch in interface ITrainingPoint
Parameters:
minutes - How long was the player on the field in this match
posId - Position of the player in this match

calcTrainingPoints

public double calcTrainingPoints(boolean ignorePosition)
Calculate how many points the player gets for this week, using the matches previously added with addTrainingMatch(min, posId) Optimal: 100% position + 90mins -> points = 1.0

Specified by:
calcTrainingPoints in interface ITrainingPoint
Parameters:
ignorePosition - Ignore players position, otherwise use only minutes on correct position
Returns:
training points for this player and week

getTrainWeek

public ITrainingWeek getTrainWeek()
Returns the training week for this training point

Specified by:
getTrainWeek in interface ITrainingPoint

setTrainWeek

public void setTrainWeek(ITrainingWeek trainWeek)
Sets the training week for this training point