PARAMS - MODULE - public class AgentDescriptor<PARAMS extends IAgentParameters,MODULE extends GuiceAgentModule> extends Object implements IAgentDescriptor<PARAMS,MODULE>
IAgentDescriptor. It specify which agents and how many should
be instantiated and which parameters they should be given.
See the interface (IAgentDescriptor) for more info.
Have checked the javadoc for IAgentDescriptor? Good. Now you might be wondering, about number
of agents that are going to be instantiated. Here are the scenarios again:
setCount(int) - in this case, the IMultipleAgentRunner
will instantiate specified number of agents with default parameterssetAgentParameters(IAgentParameters[]) or addParams(IAgentParameters...) -
in this case, the IMultipleAgentRunner will instantiate the same number of agents as there are parameters
If count > number of parameters - the IMultipleAgentRunner will instantiate 'count' of agents and first 'number of parameters' will have custom params as specified, rest will have defaults
If count == number of parameters - same as the case 2
If count < number of parameters - the IMultipleAgentRunner will instancitate 'count' of agents using first 'count' of 'parameters' passed
getCount() that
not necessarily match the number you will pass into it through setCount(int) because of described
possibilities.| Constructor and Description |
|---|
AgentDescriptor() |
| Modifier and Type | Method and Description |
|---|---|
AgentDescriptor<PARAMS,MODULE> |
addParams(PARAMS... params)
Adds parameters for another agents.
|
MODULE |
getAgentModule()
Agent module that contains bindings for the classes, used by
GuiceAgentFactory (or concretely by the Guice)
to instantiate the agent. |
PARAMS[] |
getAgentParameters()
Respective parameters of the agents.
|
int |
getCount()
Returns number of agents to be instantiated using current
getAgentModule(). |
AgentDescriptor<PARAMS,MODULE> |
setAgentModule(MODULE module)
Sets agent module to be used for the instantiation of the agent.
|
AgentDescriptor<PARAMS,MODULE> |
setAgentParameters(PARAMS[] params)
Clears all the params stored within
AgentDescriptor and assigns 'params'. |
AgentDescriptor<PARAMS,MODULE> |
setCount(int count)
Set number of agents to be instantiated.
|
public MODULE getAgentModule()
IAgentDescriptorGuiceAgentFactory (or concretely by the Guice)
to instantiate the agent.getAgentModule in interface IAgentDescriptor<PARAMS extends IAgentParameters,MODULE extends GuiceAgentModule>public AgentDescriptor<PARAMS,MODULE> setAgentModule(MODULE module)
For more info see IAgentDescriptor.getAgentModule().
module - public PARAMS[] getAgentParameters()
IAgentDescriptorIAgentDescriptor.getCount(), i.e.,
there must be a separate parameter instance for every agent).
Note that some parameters may be null as IMultipleAgentRunner implementation can provide
default parameters for agents (usually).
getAgentParameters in interface IAgentDescriptor<PARAMS extends IAgentParameters,MODULE extends GuiceAgentModule>public AgentDescriptor<PARAMS,MODULE> setAgentParameters(PARAMS[] params)
AgentDescriptor and assigns 'params'.
For more info see IAgentDescriptor.getAgentParameters().
params - public AgentDescriptor<PARAMS,MODULE> addParams(PARAMS... params)
setCount(int).
For more info see IAgentDescriptor.getAgentParameters().
params - public int getCount()
getAgentModule().
If setCount(int) is called with positive int param, that this will return the passed
count. Otherwise it returns the params.size(). I.e. the number of parameters you've added via AgentDescriptor#addParams(IAgentParameters) or set
via setAgentParameters(IAgentParameters[]).
For more info see IAgentDescriptor.getCount() and javadoc for IAgentDescriptor and AgentDescriptor.
getCount in interface IAgentDescriptor<PARAMS extends IAgentParameters,MODULE extends GuiceAgentModule>public AgentDescriptor<PARAMS,MODULE> setCount(int count)
For more info see IAgentDescriptor.getCount().
count - Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.