|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.anji.tournament.SimpleTournament
public abstract class SimpleTournament
Abstract class that manages a list of Player
contestants, has them play each
other in matches, and packages the results.
Nested Class Summary | |
---|---|
protected class |
SimpleTournament.PlayerPair
Pair of PlayerAndResults for each game. |
Field Summary | |
---|---|
static java.lang.String |
COMPONENT_GAME_KEY
component game |
Constructor Summary | |
---|---|
|
SimpleTournament()
default ctor; should be followwed by init() |
protected |
SimpleTournament(Game aGame,
ScoringWeights aWeights)
|
Method Summary | |
---|---|
void |
addContestant(Player player)
|
void |
clearContestants()
remove all contestants added via addContestant() |
protected abstract void |
endTournament()
end tournament |
protected Game |
getGame()
|
protected java.util.List |
getResults()
Returns all players added via addContestant() thus far and associated results. |
protected ScoringWeights |
getScoringWeights()
|
protected abstract boolean |
hasNextPlayerPair()
|
void |
init(Properties props)
|
protected abstract SimpleTournament.PlayerPair |
nextPlayerPair()
|
protected void |
playMatch(SimpleTournament.PlayerPair pair)
|
java.util.List |
playTournament()
Play full tournament. |
protected abstract void |
startTournament()
restart tournament |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.anji.tournament.Tournament |
---|
getMaxScore, getMinScore |
Field Detail |
---|
public static final java.lang.String COMPONENT_GAME_KEY
Constructor Detail |
---|
protected SimpleTournament(Game aGame, ScoringWeights aWeights)
aGame
- aWeights
- public SimpleTournament()
init()
Method Detail |
---|
public void init(Properties props) throws java.lang.Exception
init
in interface Configurable
props
-
java.lang.Exception
public void clearContestants()
Tournament
addContestant()
clearContestants
in interface Tournament
Tournament.clearContestants()
public void addContestant(Player player)
addContestant
in interface Tournament
player
- Player
to be added.protected java.util.List getResults()
addContestant()
thus far and associated results.
List
contains PlayerAndResults
objectspublic java.util.List playTournament()
Tournament
playTournament
in interface Tournament
List
contains TournamentPlayerResults
objects, sorted
in descending order of scoreTournament.playTournament()
protected void playMatch(SimpleTournament.PlayerPair pair)
pair
- protected abstract void startTournament()
protected abstract void endTournament()
protected abstract SimpleTournament.PlayerPair nextPlayerPair()
protected abstract boolean hasNextPlayerPair()
protected ScoringWeights getScoringWeights()
protected Game getGame()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |