cz.cuni.amis.pogamut.sposh.context
Class USAR2004Context<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot>

Package class diagram package USAR2004Context
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.context.Context<BOT>
      extended by cz.cuni.amis.pogamut.sposh.context.USAR2004Context<BOT>
All Implemented Interfaces:
cz.cuni.amis.pogamut.sposh.context.IContext<BOT>, IUSAR2004Context<BOT>

public class USAR2004Context<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot>
extends cz.cuni.amis.pogamut.sposh.context.Context<BOT>
implements IUSAR2004Context<BOT>

Primitive State Context for UT2004.

Author:
Honza

Field Summary
protected  cz.cuni.amis.pogamut.base.communication.command.IAct act
          Shortcut for the UT2004BotModuleController#getAct().
protected  cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.AnnotationListenerRegistrator listenerRegistrator
          Listener registrator that probes declared methods for the presence of EventListener, ObjectClassEventListener, ObjectClassListener, ObjectEventListener and ObjectListener annotations and automatically registers them as listeners on a specific events.
protected  cz.cuni.amis.pogamut.base.utils.logging.LogCategory log
          Alias for user's log.
protected  Random random
          Random number generator that is usually useful to have during decision making.
protected  cz.cuni.amis.pogamut.usar2004.agent.module.master.StateMasterModule stateModule
          State module should be handy any time dealing with robots.
protected  cz.cuni.amis.pogamut.base.communication.worldview.IWorldView world
          Shortcut for the UT2004BotModuleController#getWorldView().
 
Fields inherited from class cz.cuni.amis.pogamut.sposh.context.Context
bot, name
 
Constructor Summary
USAR2004Context(String name, BOT bot)
           
 
Method Summary
 void finishInitialization()
          Called after UT2004Behaviour#botFirstSpawn(GameInfo, ConfigChange, InitedMessage, Self) as a hook for Pogamut's core developers to finalize initialization of various modules.
 cz.cuni.amis.pogamut.base.communication.command.IAct getAct()
           
 int getBatteryLeft()
          If state module is ready and has acquired a message already, it returns the battery left.
 cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.AnnotationListenerRegistrator getListenerRegistrator()
           
 cz.cuni.amis.pogamut.base.utils.logging.LogCategory getLog()
           
 Random getRandom()
           
 cz.cuni.amis.pogamut.usar2004.agent.module.master.StateMasterModule getStateModule()
           
 double getTime()
          If state module is ready and has acquired a message already, it returns the time since the server has started.
 cz.cuni.amis.pogamut.base.communication.worldview.IWorldView getWorld()
           
 cz.cuni.amis.pogamut.base.communication.worldview.IWorldView getWorldView()
           
protected  void initialize()
          Called after the construction of the UT2004Behaviour before the GameBots2004 greets the bot even before UT2004Behaviour#prepareBehaviour(UT2004Bot) method.
protected  void initializeListeners(BOT bot)
          Initializes UT2004Behaviour#listenerRegistrator and calls AnnotationListenerRegistrator.addListeners() method to probe all declared methods for event-annotation presence.
protected  void initializeModules(BOT bot)
          Initializes memory/command modules of the bot.
 void logicIteration()
          This method is called before the SPOSH iteration is invoked.
protected  void prepareBehaviour(BOT bot)
          Called after the behaviour construction to initialize user's data structures.
 
Methods inherited from class cz.cuni.amis.pogamut.sposh.context.Context
getBot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.sposh.context.IContext
getBot
 

Field Detail

random

protected Random random
Random number generator that is usually useful to have during decision making.


log

protected cz.cuni.amis.pogamut.base.utils.logging.LogCategory log
Alias for user's log.


listenerRegistrator

protected cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.AnnotationListenerRegistrator listenerRegistrator
Listener registrator that probes declared methods for the presence of EventListener, ObjectClassEventListener, ObjectClassListener, ObjectEventListener and ObjectListener annotations and automatically registers them as listeners on a specific events.

Note that this registrator is usable for 'this' object only! It will work only for 'this' object.


world

protected cz.cuni.amis.pogamut.base.communication.worldview.IWorldView world
Shortcut for the UT2004BotModuleController#getWorldView().


act

protected cz.cuni.amis.pogamut.base.communication.command.IAct act
Shortcut for the UT2004BotModuleController#getAct().


stateModule

protected cz.cuni.amis.pogamut.usar2004.agent.module.master.StateMasterModule stateModule
State module should be handy any time dealing with robots. Not only is the logic method triggered by state messages but they really provide essentials such as time, type of the robot and the battery left.

Constructor Detail

USAR2004Context

public USAR2004Context(String name,
                       BOT bot)
Method Detail

initialize

protected void initialize()
Called after the construction of the UT2004Behaviour before the GameBots2004 greets the bot even before UT2004Behaviour#prepareBehaviour(UT2004Bot) method.

NOTE: This is Pogamut's developers reserved method - do not override it and if you do, always use 'super' to call parent's initializeBehaviour.


initializeListeners

protected void initializeListeners(BOT bot)
Initializes UT2004Behaviour#listenerRegistrator and calls AnnotationListenerRegistrator.addListeners() method to probe all declared methods for event-annotation presence.

Parameters:
bot -

initializeModules

protected void initializeModules(BOT bot)
Initializes memory/command modules of the bot.

Parameters:
bot -

prepareBehaviour

protected void prepareBehaviour(BOT bot)
Called after the behaviour construction to initialize user's data structures.

Parameters:
bot -

finishInitialization

public void finishInitialization()
Called after UT2004Behaviour#botFirstSpawn(GameInfo, ConfigChange, InitedMessage, Self) as a hook for Pogamut's core developers to finalize initialization of various modules.

NOTE: This is Pogamut's developers reserved method - do not override it and if you do, always use 'super' to call parent's finishControllerInitialization.

Specified by:
finishInitialization in interface IUSAR2004Context<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot>

logicIteration

public void logicIteration()
This method is called before the SPOSH iteration is invoked. You may clear previous-state variables here.


getStateModule

public cz.cuni.amis.pogamut.usar2004.agent.module.master.StateMasterModule getStateModule()

getBatteryLeft

public int getBatteryLeft()
If state module is ready and has acquired a message already, it returns the battery left. Note that this method returns the first state message if ready. So this works propperly for single robot session.

Returns:
Returns battery left.

getTime

public double getTime()
If state module is ready and has acquired a message already, it returns the time since the server has started. Note that this method returns the first state message if ready. So this works propperly for single robot session.

Returns:
Returns time since.

getWorldView

public cz.cuni.amis.pogamut.base.communication.worldview.IWorldView getWorldView()

getAct

public cz.cuni.amis.pogamut.base.communication.command.IAct getAct()

getRandom

public Random getRandom()

getLog

public cz.cuni.amis.pogamut.base.utils.logging.LogCategory getLog()

getListenerRegistrator

public cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.AnnotationListenerRegistrator getListenerRegistrator()

getWorld

public cz.cuni.amis.pogamut.base.communication.worldview.IWorldView getWorld()


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.