com.anji.tournament
Class DirectTournament

java.lang.Object
  extended by com.anji.tournament.SimpleTournament
      extended by com.anji.tournament.DirectTournament
All Implemented Interfaces:
Tournament, Configurable

public class DirectTournament
extends SimpleTournament
implements Configurable

Each contestant plays 1 game against each opponent.

Author:
Philip Tucker

Nested Class Summary
 
Nested classes/interfaces inherited from class com.anji.tournament.SimpleTournament
SimpleTournament.PlayerPair
 
Field Summary
 
Fields inherited from class com.anji.tournament.SimpleTournament
COMPONENT_GAME_KEY
 
Constructor Summary
DirectTournament()
          default ctor; should be followed by init()
DirectTournament(Game aGame, ScoringWeights aWeights, java.util.Random aRand)
           
 
Method Summary
 void addOpponent(Player opponent)
           
 void addOpponents(java.util.Collection opponents)
          add multiple opponents
protected  void endTournament()
          end tournament
 int getMaxScore()
           
 int getMinScore()
           
 java.util.List getOpponentsAndResults()
           
protected  boolean hasNextPlayerPair()
           
 void init(Properties props)
           
protected  SimpleTournament.PlayerPair nextPlayerPair()
           
protected  void startTournament()
          restart tournament
 
Methods inherited from class com.anji.tournament.SimpleTournament
addContestant, clearContestants, getGame, getResults, getScoringWeights, playMatch, playTournament
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectTournament

public DirectTournament(Game aGame,
                        ScoringWeights aWeights,
                        java.util.Random aRand)
Parameters:
aGame -
aWeights -
aRand - used to shuffle order of opponents

DirectTournament

public DirectTournament()
default ctor; should be followed by init()

Method Detail

init

public void init(Properties props)
          throws java.lang.Exception
Specified by:
init in interface Configurable
Overrides:
init in class SimpleTournament
Parameters:
props - configuration parameters
Throws:
java.lang.Exception
See Also:
Configurable.init(com.anji.util.Properties)

addOpponents

public void addOpponents(java.util.Collection opponents)
add multiple opponents

Parameters:
opponents - Collection contains Player objects

addOpponent

public void addOpponent(Player opponent)
Parameters:
opponent -

hasNextPlayerPair

protected boolean hasNextPlayerPair()
Specified by:
hasNextPlayerPair in class SimpleTournament
Returns:
boolean true if player pairs are stil available
See Also:
SimpleTournament.hasNextPlayerPair()

nextPlayerPair

protected SimpleTournament.PlayerPair nextPlayerPair()
Specified by:
nextPlayerPair in class SimpleTournament
Returns:
next pair of players
See Also:
SimpleTournament.nextPlayerPair()

startTournament

protected void startTournament()
Description copied from class: SimpleTournament
restart tournament

Specified by:
startTournament in class SimpleTournament
See Also:
SimpleTournament.startTournament()

getMaxScore

public int getMaxScore()
Specified by:
getMaxScore in interface Tournament
Returns:
maximum possible score a contestant can achieve in this tournament; this value may change as contestants are added; refers to TournamentPlayerResults.getTournamentScore() not TournamentPlayerResults.getScore()
See Also:
Tournament.getMaxScore()

getOpponentsAndResults

public java.util.List getOpponentsAndResults()
Returns:
List contains opponent PlayerResults objects

getMinScore

public int getMinScore()
Specified by:
getMinScore in interface Tournament
Returns:
minimum possible score a contestant can achieve in this tournament; this value may change as contestants are added; refers to TournamentPlayerResults.getTournamentScore() not TournamentPlayerResults.getScore()
See Also:
Tournament.getMinScore()

endTournament

protected void endTournament()
Description copied from class: SimpleTournament
end tournament

Specified by:
endTournament in class SimpleTournament
See Also:
SimpleTournament.endTournament()