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, UT2004TeamDeathMatchConfig

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

Nested Class Summary
static class UT2004MatchConfig.BotType
           
 
Field Summary
protected  Map<cz.cuni.amis.utils.token.IToken,UT2004BotConfig> bots
           
protected  GameBots2004Ini gb2004Ini
           
protected  Map<cz.cuni.amis.utils.token.IToken,UT2004HumanConfig> humans
           
protected  cz.cuni.amis.utils.token.IToken matchId
           
protected  Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> nativeBots
           
protected  File outputDirectory
           
protected  cz.cuni.amis.pogamut.ut2004.utils.UCCWrapperConf uccConf
           
protected  UT2004Ini ut2004Ini
           
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 addHuman(UT2004HumanConfig... humans)
          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 clearHumans()
           
 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()
           
 UT2004MatchConfig.BotType getBotType(cz.cuni.amis.utils.token.IToken botId)
           
 GameBots2004Ini getGb2004Ini()
          Preinitialized automatically.
 Map<cz.cuni.amis.utils.token.IToken,UT2004HumanConfig> getHumans()
           
 cz.cuni.amis.utils.token.IToken getMatchId()
           
 Map<cz.cuni.amis.utils.token.IToken,UT2004NativeBotConfig> getNativeBots()
           
 File getOutputDirectory()
           
 cz.cuni.amis.pogamut.ut2004.utils.UCCWrapperConf getUccConf()
           
 UT2004Ini getUT2004Ini()
          Preinitialized automatically.
 int hashCode()
           
 boolean isBot(cz.cuni.amis.utils.token.IToken botId)
           
 boolean isHuman(cz.cuni.amis.utils.token.IToken botId)
           
 boolean isHumanLikeLogEnabled()
           
 boolean isNativeBot(cz.cuni.amis.utils.token.IToken botId)
           
 boolean isStartTCServer()
           
 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 setHuman(UT2004HumanConfig... humans)
          Sets human configuration into the object, does not checks whether there is BotId clash.
 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)
           
 void setStartTCServer(boolean startTCServer)
           
 UT2004MatchConfig setUccConf(cz.cuni.amis.pogamut.ut2004.utils.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.
 
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 cz.cuni.amis.pogamut.ut2004.utils.UCCWrapperConf uccConf

ut2004Ini

protected UT2004Ini ut2004Ini

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

humans

protected Map<cz.cuni.amis.utils.token.IToken,UT2004HumanConfig> humans

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 cz.cuni.amis.pogamut.ut2004.utils.UCCWrapperConf getUccConf()

getGb2004Ini

public GameBots2004Ini getGb2004Ini()
Preinitialized automatically.

Returns:

getUT2004Ini

public UT2004Ini getUT2004Ini()
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()

getHumans

public Map<cz.cuni.amis.utils.token.IToken,UT2004HumanConfig> getHumans()

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(cz.cuni.amis.pogamut.ut2004.utils.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()

clearHumans

public UT2004MatchConfig clearHumans()

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:

addHuman

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

Parameters:
bots -
Returns:

setHuman

public UT2004MatchConfig setHuman(UT2004HumanConfig... humans)
Sets human configuration into the object, does not checks whether there is BotId clash.

Parameters:
humans -
Returns:

isBot

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

isNativeBot

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

isHuman

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

getBotType

public UT2004MatchConfig.BotType getBotType(cz.cuni.amis.utils.token.IToken botId)

isHumanLikeLogEnabled

public boolean isHumanLikeLogEnabled()

setHumanLikeLogEnabled

public UT2004MatchConfig setHumanLikeLogEnabled(boolean humanLikeLog)

isStartTCServer

public boolean isStartTCServer()

setStartTCServer

public void setStartTCServer(boolean startTCServer)

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 © 2016 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.