net.curre.prefcount.bean
Class PlayerStatistics

java.lang.Object
  extended by net.curre.prefcount.bean.PlayerStatistics

public class PlayerStatistics
extends java.lang.Object

Object of this class represents various game scores/data for a player.

Created date: Apr 6, 2007

Author:
Yevgeny Nyden

Constructor Summary
PlayerStatistics(GameResultBean resultBean, Place playerPlace)
          Constructor with a result bean argument.
 
Method Summary
 int getFinalMountainInWhists()
          Returns the "final" computed mountain value in whists (x10), which is = (averageMountain - (mountain + mountFix - minMountain)) x 10.
 int getFinalScoreInWhists()
          Returns computed final score (balance) in whists.
 int getMinMountain()
          Returns the minimum mountain in the game.
 java.lang.Integer getMountain()
          Getter for the player's mountain.
 java.lang.Integer getMountFix()
          Getter for property 'mountFix'.
 int getNewMountain()
          Returns the new computed mountain value according to the current maxPool value and the type of pref (Leningradka or other).
 java.lang.String getPlayerName()
          Getter for the player's name.
 java.lang.String getPlayerNameLetter()
          Getter for the first letter of the player's name (returned capitalized).
 Place getPlayerPlace()
          Gets player's place.
 java.lang.Integer getPool()
          Getter for the player's pool value.
 java.lang.Integer getWhistFixAgainstPlayer(Place place)
          Gets whist fix against the given player.
 java.util.Map<Place,java.lang.Integer> getWhistFixesMap()
          Gets the map that holds whist fixes that this player has against other players (key = player place, value = whist fix).
 java.lang.Integer getWhistsAgainstPlayer(Place place)
          Returns whist that the current player has against the given player.
 java.lang.Integer getWhistSaldoAgainstPlayer(Place place)
          Gets whist saldo against the given player.
 java.util.Map<Place,java.lang.Integer> getWhistSaldoMap()
          Gets the map that holds whist saldo/balances that this player has against other players; the keys in this map are the other players places and the values are the corresponding whist saldo values;

total player's whist saldo/balance is stored under the same (as the player's place) key.
 java.lang.String getWhistsStringForPlayer(Place place)
          Returns whists for the given player (refered by its index); value is returned as a string terminated with a period.
 void setMountain(java.lang.Integer mountain)
          Setter for the player's mountain.
 void setMountainFromField(javax.swing.JTextField field)
          Setter for the player's mounatain that is fetched from the passed JTextField argument.
 void setMountFix(java.lang.Integer mountFix)
          Setter for property 'mountFix'.
 void setPlayerName(java.lang.String playerName)
          Setter for the player's name.
 void setPool(java.lang.Integer pool)
          Setter for the player's pool value.
 void setPoolFromField(javax.swing.JTextField field)
          Setter for the player's pool that is fetched from the passed JTextField argument.
 java.lang.Integer setWhistsForPlayerFromField(Place place, javax.swing.JTextField field)
          Setter for the player's whists that this player has against the player refered by its index argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlayerStatistics

public PlayerStatistics(GameResultBean resultBean,
                        Place playerPlace)
Constructor with a result bean argument.

Parameters:
resultBean - Reference to the result bean.
playerPlace - Player's place.
Method Detail

getPlayerName

public java.lang.String getPlayerName()
Getter for the player's name.

Returns:
Player's name.

getPlayerPlace

public Place getPlayerPlace()
Gets player's place.

Returns:
player's place.

getPlayerNameLetter

public java.lang.String getPlayerNameLetter()
Getter for the first letter of the player's name (returned capitalized).

Returns:
Capitalized first letter of the player's name or an empty string if player's name is blank.

setPlayerName

public void setPlayerName(java.lang.String playerName)
Setter for the player's name.

Parameters:
playerName - Player's name to set.

getMountain

public java.lang.Integer getMountain()
Getter for the player's mountain.

Returns:
Player's mountain value.

setMountain

public void setMountain(java.lang.Integer mountain)
Setter for the player's mountain.

Parameters:
mountain - Player's new mountain value.

getNewMountain

public int getNewMountain()
Returns the new computed mountain value according to the current maxPool value and the type of pref (Leningradka or other).

Returns:
New computed mountain value.

getFinalMountainInWhists

public int getFinalMountainInWhists()
Returns the "final" computed mountain value in whists (x10), which is = (averageMountain - (mountain + mountFix - minMountain)) x 10. If mount divisibility is ignored, mountFix is always 0.

Returns:
Final computed mountain value in whists (x10).

setMountainFromField

public void setMountainFromField(javax.swing.JTextField field)
Setter for the player's mounatain that is fetched from the passed JTextField argument.

Parameters:
field - JTextField to use to fetch the mountain value.

getPool

public java.lang.Integer getPool()
Getter for the player's pool value.

Returns:
Player's pool value.

setPool

public void setPool(java.lang.Integer pool)
Setter for the player's pool value.

Parameters:
pool - Player's new pool value.

getMountFix

public java.lang.Integer getMountFix()
Getter for property 'mountFix'. Player's extra mountain points (when "divisible by N").

Returns:
Value for property 'mountFix'.

setMountFix

public void setMountFix(java.lang.Integer mountFix)
Setter for property 'mountFix'. Player's extra mountain points (when "divisible by N").

Parameters:
mountFix - Value to set for property 'mountFix'.

setPoolFromField

public void setPoolFromField(javax.swing.JTextField field)
Setter for the player's pool that is fetched from the passed JTextField argument.

Parameters:
field - JTextField to use to fetch the pool value.

setWhistsForPlayerFromField

public java.lang.Integer setWhistsForPlayerFromField(Place place,
                                                     javax.swing.JTextField field)
Setter for the player's whists that this player has against the player refered by its index argument.

Parameters:
place - Other player's place that this player has whists against.
field - JTextField to use to fetch the whists value.
Returns:
Fetched whists value as an Integer object.

getWhistsAgainstPlayer

public java.lang.Integer getWhistsAgainstPlayer(Place place)
Returns whist that the current player has against the given player.

Parameters:
place - Player's place to fetch the whists for.
Returns:
whist that this player has agains the other player.

getWhistsStringForPlayer

public java.lang.String getWhistsStringForPlayer(Place place)
Returns whists for the given player (refered by its index); value is returned as a string terminated with a period.

Parameters:
place - Player's place to fetch the whists for.
Returns:
whists value that this player has agains the other player.

getFinalScoreInWhists

public int getFinalScoreInWhists()
Returns computed final score (balance) in whists.

Returns:
Computed final score (balance) in whists.

getWhistSaldoMap

public java.util.Map<Place,java.lang.Integer> getWhistSaldoMap()
Gets the map that holds whist saldo/balances that this player has against other players; the keys in this map are the other players places and the values are the corresponding whist saldo values;

total player's whist saldo/balance is stored under the same (as the player's place) key.

Returns:
Map of whist saldo values that the player has against other playes.

getWhistSaldoAgainstPlayer

public java.lang.Integer getWhistSaldoAgainstPlayer(Place place)
Gets whist saldo against the given player.

Parameters:
place - other player's place.
Returns:
whist saldo against the given player.

getWhistFixesMap

public java.util.Map<Place,java.lang.Integer> getWhistFixesMap()
Gets the map that holds whist fixes that this player has against other players (key = player place, value = whist fix). These values may be generated when applying the "Divisible By N" option.

Returns:
Map that holds whist fixes that this player has against other players.

getWhistFixAgainstPlayer

public java.lang.Integer getWhistFixAgainstPlayer(Place place)
Gets whist fix against the given player.

Parameters:
place - other player's place.
Returns:
whist fix against the given player.

getMinMountain

public int getMinMountain()
Returns the minimum mountain in the game.

Returns:
the minimum mountain in the game;


Copyright © 2008. All Rights Reserved.