View Javadoc

1   package cz.cuni.amis.pogamut.base.agent.impl;
2   
3   import com.google.inject.Inject;
4   
5   import cz.cuni.amis.pogamut.base.agent.IAgentId;
6   import cz.cuni.amis.pogamut.base.agent.IObservingAgent;
7   import cz.cuni.amis.pogamut.base.communication.worldview.IWorldView;
8   import cz.cuni.amis.pogamut.base.component.bus.IComponentBus;
9   import cz.cuni.amis.pogamut.base.utils.guice.AgentScoped;
10  import cz.cuni.amis.pogamut.base.utils.logging.IAgentLogger;
11  import cz.cuni.amis.utils.NullCheck;
12  
13  /**
14   * The main difference between AbstractAgent and AbstractObservingAgent is that
15   * this one has a world to observe. It's a next step towards embodied agent.
16   * 
17   * @author Jimmy
18   * @param WorldView
19   *            class of the worldview the agent is working with
20   */
21  @AgentScoped
22  public abstract class AbstractObservingAgent<WORLD_VIEW extends IWorldView>
23          extends AbstractAgent implements IObservingAgent {
24   
25      /**
26       * Instance of the world view - basic agent's internal representation of the
27       * world.
28       * <p>
29       * <p>
30       * Accessible via getWorldView().
31       */
32      private WORLD_VIEW worldView;
33  
34      @Inject
35      public AbstractObservingAgent(IAgentId agentId, IComponentBus bus, IAgentLogger logger, WORLD_VIEW worldView) {
36          super(agentId, bus, logger);
37          this.worldView = worldView;
38          NullCheck.check(this.worldView, "worldView");
39          addDependency(worldView);
40      }
41  
42      /**
43       * Returns abstraction for the agent's world. That can be anything the range
44       * is broad ... from chess board to the UT2004 3D environment. <BR>
45       * <BR>
46       * The implementation may be different as the user needs.
47       *
48       * @return
49       */
50      @Override
51      public WORLD_VIEW getWorldView() {
52          return worldView;
53      }
54  
55  }