cz.cuni.amis.pogamut.udk.observer.impl
Class AbstractUDKObserver<WORLD_VIEW extends IVisionWorldView,ACT extends IAct>

Package class diagram package AbstractUDKObserver
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent
      extended by cz.cuni.amis.pogamut.base.agent.impl.AbstractObservingAgent<WORLD_VIEW>
          extended by cz.cuni.amis.pogamut.base.agent.impl.AbstractGhostAgent<WORLD_VIEW,ACT>
              extended by cz.cuni.amis.pogamut.udk.observer.impl.AbstractUDKObserver<WORLD_VIEW,ACT>
All Implemented Interfaces:
IAgent, IGhostAgent, IObservingAgent, IComponent, IComponentAware, IControllable, IUDKObserver
Direct Known Subclasses:
UDKObserver

public abstract class AbstractUDKObserver<WORLD_VIEW extends IVisionWorldView,ACT extends IAct>
extends AbstractGhostAgent<WORLD_VIEW,ACT>
implements IUDKObserver

Abstract class - ancestor of all UT2004 observer controls.

It counts with GameBots2004 protocol therefore taking care of:

  1. ReadyCommandRequest - sending automatically ready(), override readyCommandRequested() if you're not comfortable with this
  2. Password - when password is requested it calls method createPasswordReply()

You may use setPassword() method to specify the password before starting the agent.

Author:
Jimmy

Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent
events, INTROSPECTION_ROOT_NAME, log, LOG_CATEGORY_NAME
 
Constructor Summary
AbstractUDKObserver(IAgentId agentId, IComponentBus bus, IAgentLogger agentLogger, WORLD_VIEW worldView, ACT act)
           
 
Method Summary
protected  PasswordReply createPasswordReply()
          This method is called whenever the Password event is caught telling us the world is locked and is requiring a password.
 PasswordReply getPasswordReply()
          Instance of the password reply command that was sent upon receivieng request for the password (the world is locked).
 WORLD_VIEW getWorldView()
           
protected  void killAgent()
           
protected  void readyCommandRequested()
          This method is called whenever HelloBot message is parsed - the GameBots2004 is awaiting the bot to reply with Ready command to begin the handshake.
protected  void reset()
          Called during stop/kill/reset events.
protected  void resetAgent()
           
 void setPassword(String password)
          Specify the password that should be used if required by the world.
protected  void startAgent()
           
protected  void stopAgent()
           
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.impl.AbstractGhostAgent
getAct
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent
addDependency, addDependency, addDependency, addJMXComponents, awaitState, awaitState, componentFatalError, componentStarted, componentStarted, componentStopped, componentStopping, createAgentJMX, createIntrospection, equals, getComponentId, getEventBus, getIntrospection, getJMX, getLog, getLogger, getName, getState, hashCode, inState, kill, notInState, pause, pauseAgent, preKillAgent, preStopAgent, resetEvent, resume, resumeAgent, setState, start, startPaused, startPausedAgent, stop, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.IGhostAgent
getAct
 
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.IAgent
getComponentId, getIntrospection, getLogger, getName, getState, kill, pause, resume, start, startPaused, stop
 
Methods inherited from interface cz.cuni.amis.pogamut.base.component.IComponentAware
getEventBus
 

Constructor Detail

AbstractUDKObserver

@Inject
public AbstractUDKObserver(IAgentId agentId,
                                  IComponentBus bus,
                                  IAgentLogger agentLogger,
                                  WORLD_VIEW worldView,
                                  ACT act)
Method Detail

setPassword

public void setPassword(String password)
Specify the password that should be used if required by the world.

Parameters:
password -

readyCommandRequested

protected void readyCommandRequested()
This method is called whenever HelloBot message is parsed - the GameBots2004 is awaiting the bot to reply with Ready command to begin the handshake.


getPasswordReply

public PasswordReply getPasswordReply()
Instance of the password reply command that was sent upon receivieng request for the password (the world is locked).

If null the password was not required by the time the bot connected to the world.

Returns:

createPasswordReply

protected PasswordReply createPasswordReply()
This method is called whenever the Password event is caught telling us the world is locked and is requiring a password.

May return null - in that case an empty password is sent to the server (which will probably result in closing the connection and termination of the agent).

This message is then saved to private field passwordReply and is accessible via getPasswordReply() method if required to be probed during the bot's runtime.

Note that if setPassword() method is called before this one it will use provided password via that method.


getWorldView

public WORLD_VIEW getWorldView()
Specified by:
getWorldView in interface IObservingAgent
Overrides:
getWorldView in class AbstractObservingAgent<WORLD_VIEW extends IVisionWorldView>

reset

protected void reset()
Called during stop/kill/reset events.


startAgent

protected void startAgent()
Overrides:
startAgent in class AbstractAgent

resetAgent

protected void resetAgent()
Overrides:
resetAgent in class AbstractAgent

stopAgent

protected void stopAgent()
Overrides:
stopAgent in class AbstractAgent

killAgent

protected void killAgent()
Overrides:
killAgent in class AbstractAgent


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