public class MultipleUT2004BotRunner<BOT extends UT2004Bot,PARAMS extends UT2004BotParameters,MODULE extends UT2004BotModule> extends MultipleAgentRunner<BOT,PARAMS,MODULE>
Designed especially for the usage inside NetBeans projects.
NOTE: by default, all bots get paused after they start and they are resumed after all bots are present in UT2004. To
change this behaviour pass 'false' through MultipleAgentRunner.setPausing(boolean)
.
NOTE: It's not even meant to be instantiated twice for two different batch of bots and consequently executed in two different threads! Single-purpose class only ;-)
NOTE: It might be very interesting for you to check out the source of method MultipleUT2004BotRunner#startAgent()
to
see how the agent should be instantiated via UT2004BotFactory
using UT2004BotModule
.
Modifier and Type | Field and Description |
---|---|
protected String |
host
Default host where the instances are going to be connected as defaults, see
IAgentParameters.assignDefaults(IAgentParameters) . |
protected String |
name
Default name that will serve as a basis for
IAgentId , see IAgentParameters.assignDefaults(IAgentParameters) . |
protected int |
port
Default port where the instances are going to be connected as defaults, see
IAgentParameters.assignDefaults(IAgentParameters) . |
agents, consoleLogging, defaultLogLevel, killed, latch, listener, log, main, mutex
Constructor and Description |
---|
MultipleUT2004BotRunner(String name)
Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.
|
MultipleUT2004BotRunner(String name,
String host,
int port)
Construct the runner + specify all defaults.
|
Modifier and Type | Method and Description |
---|---|
String |
getHost()
Returns host, where newly launched bots will be connected to.
|
String |
getName()
Returns name that is going to be used to form new
IAgentId of the bots. |
int |
getPort()
Returns port, where newly launched bots will be connected to.
|
protected IAgentFactory |
newAgentFactory(MODULE agentModule)
Uses
UT2004BotFactory for agent construction. |
protected IAgentParameters |
newDefaultAgentParameters()
Provides default parameters that is,
IAgentId using name and SocketConnectionAddress
using host and port . |
protected void |
preStartHook(BOT agent)
We're setting the logging level to
Level.WARNING here so the bot won't log much. |
MultipleUT2004BotRunner<BOT,PARAMS,MODULE> |
setHost(String host)
Sets host, where newly launched bots will be connected to.
|
MultipleUT2004BotRunner<BOT,PARAMS,MODULE> |
setName(String name)
Sets name that is going to be used to form new
IAgentId of the bots. |
MultipleUT2004BotRunner<BOT,PARAMS,MODULE> |
setPort(int port)
Sets port, where newly launched bots will be connected to.
|
List<BOT> |
startAgents(IAgentDescriptor<PARAMS,MODULE>... agentDescriptors) |
createAgentWithParams, getAgentCount, getLog, isMain, isPausing, killAgent, killAgents, newAgentId, postStartedHook, postStartHook, preInitHook, preResumeHook, setConsoleLogging, setLog, setLogLevel, setMain, setPausing, startAgent, startAgentsMain, startAgentsMain, startAgentsStandard, startAgentsStandard
protected String host
IAgentParameters.assignDefaults(IAgentParameters)
.protected int port
IAgentParameters.assignDefaults(IAgentParameters)
.protected String name
IAgentId
, see IAgentParameters.assignDefaults(IAgentParameters)
.public MultipleUT2004BotRunner(String name, String host, int port)
name
- default name that serve as a basis for IAgentId
host
- default host where the instances are going to be connectedport
- default port where the instances are going to be connectedpublic String getName()
IAgentId
of the bots.public MultipleUT2004BotRunner<BOT,PARAMS,MODULE> setName(String name)
IAgentId
of the bots.
If null is passed, generic "UT2004Bot" will be set.
name
- name used for the newly started botspublic String getHost()
public MultipleUT2004BotRunner<BOT,PARAMS,MODULE> setHost(String host)
host
- host running GB2004 server (can't be null)public int getPort()
public MultipleUT2004BotRunner<BOT,PARAMS,MODULE> setPort(int port)
port
- at the host where GB2004 server is listening for bot connectionsprotected void preStartHook(BOT agent) throws cz.cuni.amis.utils.exception.PogamutException
Level.WARNING
here so the bot won't log much.preStartHook
in class MultipleAgentRunner<BOT extends UT2004Bot,PARAMS extends UT2004BotParameters,MODULE extends UT2004BotModule>
cz.cuni.amis.utils.exception.PogamutException
protected IAgentParameters newDefaultAgentParameters()
IAgentId
using name
and SocketConnectionAddress
using host
and port
.newDefaultAgentParameters
in class MultipleAgentRunner<BOT extends UT2004Bot,PARAMS extends UT2004BotParameters,MODULE extends UT2004BotModule>
protected IAgentFactory newAgentFactory(MODULE agentModule)
UT2004BotFactory
for agent construction.newAgentFactory
in class MultipleAgentRunner<BOT extends UT2004Bot,PARAMS extends UT2004BotParameters,MODULE extends UT2004BotModule>
public List<BOT> startAgents(IAgentDescriptor<PARAMS,MODULE>... agentDescriptors)
startAgents
in interface IMultipleAgentRunner<BOT extends UT2004Bot,PARAMS extends UT2004BotParameters,MODULE extends UT2004BotModule>
startAgents
in class MultipleAgentRunner<BOT extends UT2004Bot,PARAMS extends UT2004BotParameters,MODULE extends UT2004BotModule>
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.