public class GuiceCommunicationModule<PARAMS extends IAgentParameters> extends GuiceAgentModule<PARAMS>
Mapped class | Target | Description | |
---|---|---|---|
IWorldReaderProvider | -> | Reader of the world's information. | |
IWorldWriterProvider | -> | Writer that sends commands to the agent's body in the world. | |
ICommandSerializer | -> | StringCommandSerializer | Serializes commands using .toString() method. |
IWorldChangeEventOutput | -> | WorldMessageTranslator | Translator of InfoMessage s into IWorldChangeEvent s. Relies on the wrapped (world-dependent) implementation of IWorldMessageTranslator |
IMediator | -> | Mediator | Thread-wrapper, reader of IWorldChangeEventOutput that passes IWorldChangeEvent into IWorldChangeEventInput . |
IWorldChangeEventInput | -> | IWorldView | Consumer of IWorldChangeEvent s. |
To have successful module the descendant must specify these missing bindings:
Mapped class | Description |
---|---|
IAgent | Agent that should be instantiated |
IWorldConnection | Connection to the agent's world. |
IWorldMessageParser | Line oriented parser based on Yylex. |
IYylex | World message parser implementation. |
IYylexObserver | Yylex observer reporting errors. |
IWorldMessageTranslator | World-dependent implementation of InfoMessage s translator into IWorldChangeEvent that can be consumed by IWorldView . |
IWorldView | World view processing {@link IWorldChangeEvent}s into {@link IWorldEvent}s that should be consumed by {@link IAgent} implementation. |
... don't forget to call super.configureModules() in the subclasses. ;-)
If you want to bind custom (your own) class to one of the interface that is already binded (meaning you need to alter GaviaLib), do it this way:
Constructor and Description |
---|
GuiceCommunicationModule() |
Modifier and Type | Method and Description |
---|---|
protected void |
configureModules()
Override to create new module with your own bindings adding it into
GuiceAgentModule.modules using GuiceCommunicationModule#addModule(Module) . |
addModule, configure, createAgentScope, createAgentTeamScope, getAgentIdProvider, getAgentParamsProvider, getAgentScope, getAgentTeamScope, prepareNewAgent
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
protected void configureModules()
GuiceAgentModule.modules
using GuiceCommunicationModule#addModule(Module)
.
See configureModules()
source code for the example (utilizes anonymous class, instantiating AbstractModule
).
configureModules
in class GuiceAgentModule<PARAMS extends IAgentParameters>
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.