com.anji.tournament
Class PlayerStats

java.lang.Object
  extended bycom.anji.tournament.PlayerStats
All Implemented Interfaces:
XmlPersistable

public class PlayerStats
extends java.lang.Object
implements XmlPersistable

Collates win-loss-tie results.

Author:
Philip Tucker

Constructor Summary
PlayerStats()
          New object with 0 wins, losses, or ties.
PlayerStats(int someWins, int someLosses, int someTies)
          New object with specified wins, losses, or ties.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getLosses()
           
 int getRawScore()
           
 int getTies()
           
 int getWins()
           
 java.lang.String getXmld()
           
 java.lang.String getXmlRootTag()
           
 void increment(PlayerStats newResults)
          Increment wins, losses, and ties by counts in newResults.
 void incrementLosses(int newLosses)
          adds newLosses to losses
 void incrementRawScore(int newRawScore)
          adds newRawScore to rawScore
 void incrementTies(int newTies)
          adds newTies to ties
 void incrementWins(int newWins)
          adds newWins to wins
 boolean isWin(java.util.Random rand)
          convert this object to a boolean result; note that this is based on wins, losses, and raw score, not scoring weights
 void set(int aWins, int aLosses, int aTies, int aRawScore)
          set all values
 java.lang.String toString()
           
 java.lang.String toXml()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlayerStats

public PlayerStats()
New object with 0 wins, losses, or ties.


PlayerStats

public PlayerStats(int someWins,
                   int someLosses,
                   int someTies)
New object with specified wins, losses, or ties.

Parameters:
someWins -
someLosses -
someTies -
Method Detail

getLosses

public int getLosses()
Returns:
int number of losses

getTies

public int getTies()
Returns:
int number of ties

getWins

public int getWins()
Returns:
int number of wins

getRawScore

public int getRawScore()
Returns:
int raw score

incrementLosses

public void incrementLosses(int newLosses)
adds newLosses to losses

Parameters:
newLosses -

incrementTies

public void incrementTies(int newTies)
adds newTies to ties

Parameters:
newTies -

incrementWins

public void incrementWins(int newWins)
adds newWins to wins

Parameters:
newWins -

incrementRawScore

public void incrementRawScore(int newRawScore)
adds newRawScore to rawScore

Parameters:
newRawScore -

toString

public java.lang.String toString()
Returns:
String String repesentation of results

toXml

public java.lang.String toXml()
Specified by:
toXml in interface XmlPersistable
Returns:
String XML repesentation of results

increment

public void increment(PlayerStats newResults)
Increment wins, losses, and ties by counts in newResults.

Parameters:
newResults -

equals

public boolean equals(java.lang.Object o)
See Also:
Object.equals(java.lang.Object)

set

public void set(int aWins,
                int aLosses,
                int aTies,
                int aRawScore)
set all values

Parameters:
aWins -
aLosses -
aTies -
aRawScore -

isWin

public boolean isWin(java.util.Random rand)
convert this object to a boolean result; note that this is based on wins, losses, and raw score, not scoring weights

Parameters:
rand -
Returns:
true if wins > losses, false if losses > wins, coin flip otherwise

getXmlRootTag

public java.lang.String getXmlRootTag()
Specified by:
getXmlRootTag in interface XmlPersistable
Returns:
root tag
See Also:
XmlPersistable.getXmlRootTag()

getXmld

public java.lang.String getXmld()
Specified by:
getXmld in interface XmlPersistable
Returns:
id
See Also:
XmlPersistable.getXmld()