cz.cvut.agents.rph.reversi
Class PlayerResult

java.lang.Object
  extended by cz.cvut.agents.rph.reversi.PlayerResult
All Implemented Interfaces:
java.lang.Comparable<PlayerResult>

public class PlayerResult
extends java.lang.Object
implements java.lang.Comparable<PlayerResult>

Data Structure representing Reversi result of a player.

Author:
Ondrej Vanek

Nested Class Summary
private static class PlayerResult.PlayerResultComparator
          Compares PlayerResults according to games won, then according to stones gathered.
 
Field Summary
private static java.util.Comparator<PlayerResult> comparator
           
private  java.lang.String playerName
           
private  ReversiScoreEvaluator.ResultType resultType
           
private  int score
           
private  int stonesWon
           
 
Constructor Summary
PlayerResult(java.lang.String playerName, int score, int stonesWon, ReversiScoreEvaluator.ResultType resultType)
           
 
Method Summary
 int compareTo(PlayerResult p2)
           
static java.util.Comparator<PlayerResult> getComparator()
           
 java.lang.String getPlayerName()
           
 ReversiScoreEvaluator.ResultType getResultType()
           
 int getScore()
           
 int getStonesWon()
           
 void recordGameResults(int score, int stonesWon)
          Adds score and stone to the current result.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

playerName

private java.lang.String playerName

score

private int score

stonesWon

private int stonesWon

resultType

private ReversiScoreEvaluator.ResultType resultType

comparator

private static java.util.Comparator<PlayerResult> comparator
Constructor Detail

PlayerResult

public PlayerResult(java.lang.String playerName,
                    int score,
                    int stonesWon,
                    ReversiScoreEvaluator.ResultType resultType)
Method Detail

getPlayerName

public java.lang.String getPlayerName()

getScore

public int getScore()

getStonesWon

public int getStonesWon()

getResultType

public ReversiScoreEvaluator.ResultType getResultType()

recordGameResults

public void recordGameResults(int score,
                              int stonesWon)
Adds score and stone to the current result.

Parameters:
score -
stonesWon -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(PlayerResult p2)
Specified by:
compareTo in interface java.lang.Comparable<PlayerResult>

getComparator

public static java.util.Comparator<PlayerResult> getComparator()
Returns:
Comparator comparing player results.