cz.cuni.amis.pogamut.ut2004.tournament.match
Class UT2004MatchConfig

Package class diagram package UT2004MatchConfig
java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.tournament.match.UT2004MatchConfig
Direct Known Subclasses:
UT2004CaptureTheFlagConfig, UT2004DeathMatchConfig

public class UT2004MatchConfig
extends Object

Base configuration of the UT2004 match, you have to specify:

  1. Match id
  2. Concrete GB2004Ini file to be used via GameBots2004Ini
  3. Concrete UCC to run via UCCWrapperConf
  4. Concrete list of bots to be used via UT2004BotConfig
Guess what... everything is preinitialized... but you should at least adjust uccConf.

Author:
Jimmy

Field Summary
protected  Map<cz.cuni.amis.utils.token.IToken,UT2004BotConfig> bots
           
protected  GameBots2004Ini gb2004Ini
           
protected  cz.cuni.amis.utils.token.IToken matchId
           
protected  Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> nativeBots
           
protected  File outputDirectory
           
protected  UCCWrapperConf uccConf
           
protected  StringBuffer validationBuffer
           
protected  boolean validationError
           
 
Constructor Summary
UT2004MatchConfig()
           
UT2004MatchConfig(UT2004MatchConfig orig)
          Copy-constructor.
 
Method Summary
 UT2004MatchConfig addBot(UT2004BotConfig... bots)
          Adds NEW bot configuration into the object, checks whether there is no BotId clash (if so, throws an exception).
 UT2004MatchConfig addNativeBot(UT2004NativeBotConfig... bots)
          Adds NEW native bot configuration into the object, checks whether there is no BotId clash (if so, throws an exception).
 UT2004MatchConfig clearBots()
           
 UT2004MatchConfig clearNativeBots()
           
 boolean equals(Object obj)
           
 List<cz.cuni.amis.utils.token.IToken> getAllBotIds()
          Ids are sorted: 1) custom bots, 2) native bots.
 Map<cz.cuni.amis.utils.token.IToken,UT2004BotConfig> getBots()
           
 GameBots2004Ini getGb2004Ini()
          Preinitialized automatically.
 cz.cuni.amis.utils.token.IToken getMatchId()
           
 Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> getNativeBots()
           
 File getOutputDirectory()
           
 UCCWrapperConf getUccConf()
           
 int hashCode()
           
 boolean isHumanLikeLogEnabled()
           
 boolean isNativeBot(cz.cuni.amis.utils.token.IToken botId)
           
 UT2004MatchConfig setBot(UT2004BotConfig... bots)
          Sets bot configuration into the object, does not checks whether there is BotId clash.
 UT2004MatchConfig setBots(Map<cz.cuni.amis.utils.token.IToken,UT2004BotConfig> bots)
           
 UT2004MatchConfig setGb2004Ini(GameBots2004Ini gb2004Ini)
          No need to call, preinitialized automatically.
 UT2004MatchConfig setHumanLikeLogEnabled(boolean humanLikeLog)
           
 void setMatchId(cz.cuni.amis.utils.token.IToken matchId)
           
 void setMatchId(String matchId)
           
 UT2004MatchConfig setNativeBot(UT2004NativeBotConfig... bots)
          Sets native bot configuration into the object, does not checks whether there is BotId clash.
 UT2004MatchConfig setNativeBots(Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> nativeBots)
           
 UT2004MatchConfig setOutputDirectory(File outputDirectory)
           
 UT2004MatchConfig setUccConf(UCCWrapperConf uccConf)
           
 void validate()
          Checks the contents, whether everything is set-up correctly, if not, raises an exception with explanation.
protected  void validateInner()
          Performs validation of the match configuration: Checks whether the match id is non-null. Checks whether all (custom+native) bots have path-to-jar configured + the file exists. UccWrapper is not null and its directory exists. Presence of GameBots2004.u as a new game type inside UT2004. GameBots2004Ini is not null. Whether there are at least 2 bots defined for the match.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputDirectory

protected File outputDirectory

matchId

protected cz.cuni.amis.utils.token.IToken matchId

uccConf

protected UCCWrapperConf uccConf

gb2004Ini

protected GameBots2004Ini gb2004Ini

bots

protected Map<cz.cuni.amis.utils.token.IToken,UT2004BotConfig> bots

nativeBots

protected Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> nativeBots

validationBuffer

protected final StringBuffer validationBuffer

validationError

protected boolean validationError
Constructor Detail

UT2004MatchConfig

public UT2004MatchConfig()

UT2004MatchConfig

public UT2004MatchConfig(UT2004MatchConfig orig)
Copy-constructor.

Parameters:
orig -
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getOutputDirectory

public File getOutputDirectory()

getMatchId

public cz.cuni.amis.utils.token.IToken getMatchId()

setMatchId

public void setMatchId(cz.cuni.amis.utils.token.IToken matchId)

setMatchId

public void setMatchId(String matchId)

getUccConf

public UCCWrapperConf getUccConf()

getGb2004Ini

public GameBots2004Ini getGb2004Ini()
Preinitialized automatically.

Returns:

getBots

public Map<cz.cuni.amis.utils.token.IToken,UT2004BotConfig> getBots()

getNativeBots

public Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> getNativeBots()

getAllBotIds

public List<cz.cuni.amis.utils.token.IToken> getAllBotIds()
Ids are sorted: 1) custom bots, 2) native bots.

WARNING: O(n*log(n)) complexity!

Returns:

setOutputDirectory

public UT2004MatchConfig setOutputDirectory(File outputDirectory)

setUccConf

public UT2004MatchConfig setUccConf(UCCWrapperConf uccConf)

setGb2004Ini

public UT2004MatchConfig setGb2004Ini(GameBots2004Ini gb2004Ini)
No need to call, preinitialized automatically.

Returns:

setBots

public UT2004MatchConfig setBots(Map<cz.cuni.amis.utils.token.IToken,UT2004BotConfig> bots)

setNativeBots

public UT2004MatchConfig setNativeBots(Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> nativeBots)

clearBots

public UT2004MatchConfig clearBots()

clearNativeBots

public UT2004MatchConfig clearNativeBots()

addBot

public UT2004MatchConfig addBot(UT2004BotConfig... bots)
Adds NEW bot configuration into the object, checks whether there is no BotId clash (if so, throws an exception).

Parameters:
bots -
Returns:

setBot

public UT2004MatchConfig setBot(UT2004BotConfig... bots)
Sets bot configuration into the object, does not checks whether there is BotId clash.

Parameters:
bots -
Returns:

addNativeBot

public UT2004MatchConfig addNativeBot(UT2004NativeBotConfig... bots)
Adds NEW native bot configuration into the object, checks whether there is no BotId clash (if so, throws an exception).

Parameters:
bots -
Returns:

setNativeBot

public UT2004MatchConfig setNativeBot(UT2004NativeBotConfig... bots)
Sets native bot configuration into the object, does not checks whether there is BotId clash.

Parameters:
bots -
Returns:

isNativeBot

public boolean isNativeBot(cz.cuni.amis.utils.token.IToken botId)

isHumanLikeLogEnabled

public boolean isHumanLikeLogEnabled()

setHumanLikeLogEnabled

public UT2004MatchConfig setHumanLikeLogEnabled(boolean humanLikeLog)

validateInner

protected void validateInner()
Performs validation of the match configuration:
  1. Checks whether the match id is non-null.
  2. Checks whether all (custom+native) bots have path-to-jar configured + the file exists.
  3. UccWrapper is not null and its directory exists.
  4. Presence of GameBots2004.u as a new game type inside UT2004.
  5. GameBots2004Ini is not null.
  6. Whether there are at least 2 bots defined for the match.

Override to provide/add custom validation (might require copy-paste of the code from this method).


validate

public final void validate()
Checks the contents, whether everything is set-up correctly, if not, raises an exception with explanation.

Recalls validateInner() that should fill validationBuffer with messages and if there is a fatal error in the configuration, it should set true to validationError.



Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.