Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
guidelines:adding_gamebots_message_to_pogamut_java [2012/02/07 17:41]
martin.cerny
guidelines:adding_gamebots_message_to_pogamut_java [2012/02/07 17:45]
martin.cerny
Line 299: Line 299:
  
 </code> </code>
 +
 +===== Creating the Guice module =====
 +
 +This is easy, an example (from the SpyVsSpy project) follows:
 +
 +<code java>
 +import cz.cuni.amis.pogamut.spyvsspy.communication.SpyVsSpyYylex;
 +import com.google.inject.AbstractModule;
 +import cz.cuni.amis.pogamut.udk.agent.params.UDKAgentParameters;
 +import cz.cuni.amis.pogamut.udk.bot.IUDKBotController;
 +import cz.cuni.amis.pogamut.udk.communication.parser.IUDKYylex;
 +import cz.cuni.amis.pogamut.udk.factory.guice.remoteagent.UDKBotModule;
 +
 +public class SpyVsSpyBotModule<PARAMS extends UDKAgentParameters> extends UDKBotModule<PARAMS> 
 +{
 +
 +    public SpyVsSpyBotModule(Class<? extends IUDKBotController> botControllerClass) {
 +        super(botControllerClass);
 +    }
 +    
 +    
 + @Override
 + protected void configureModules() {
 + super.configureModules();
 + addModule(new AbstractModule() {
 +
 + @Override
 + public void configure() {
 +                                //bind our parser instead of the built-in one
 +                                bind(IUDKYylex.class).to(SpyVsSpyYylex.class);                                
 + }
 +
 + });
 + }
 +    
 +}
 +</code>
 +
guidelines/adding_gamebots_message_to_pogamut_java.txt · Last modified: 2012/02/07 17:50 by martin.cerny