1 package cz.cuni.amis.pogamut.defcon.agent.impl;
2
3 import com.google.inject.Inject;
4
5 import cz.cuni.amis.pogamut.base.utils.guice.AgentScoped;
6 import cz.cuni.amis.pogamut.base.utils.logging.LogCategory;
7 import cz.cuni.amis.pogamut.defcon.agent.DefConAgent;
8 import cz.cuni.amis.pogamut.defcon.agent.IDefConAgentController;
9 import cz.cuni.amis.pogamut.defcon.agent.module.sensor.GameInfo;
10 import cz.cuni.amis.pogamut.defcon.communication.command.impl.DefConAct;
11 import cz.cuni.amis.pogamut.defcon.communication.messages.commands.DefConCommand;
12 import cz.cuni.amis.pogamut.defcon.communication.worldview.DefConWorldView;
13
14
15
16
17
18
19
20 @AgentScoped
21 public class DefConAgentController<AGENT extends DefConAgent>
22 implements IDefConAgentController<AGENT> {
23
24 private static final String USER_LOG_ID = "User";
25
26 protected AGENT agent;
27
28
29
30
31 private LogCategory user = null;
32
33 @Inject
34 public DefConAgentController() {
35
36 }
37
38 @Override
39 public void initializeController(AGENT agent) {
40 this.agent = agent;
41 user = agent.getLogger().getCategory(USER_LOG_ID);
42 }
43
44 @Override
45 public void botStopped() {
46 }
47
48
49
50
51
52 public DefConWorldView getWorldView() {
53 return (DefConWorldView) agent.getWorldView();
54 }
55
56
57
58
59
60
61 public GameInfo getGameInfo() {
62 return (GameInfo) getWorldView().getGameInfo();
63 }
64
65 public DefConAct getAct() {
66 return (DefConAct) agent.getAct();
67 }
68
69
70
71
72 public void act(DefConCommand command) {
73 agent.act(command);
74 }
75
76
77
78
79
80 public LogCategory getLog() {
81 return user;
82 }
83
84 }