1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package nl.tudelft.goal.emohawk.environment;
22
23 import java.util.HashMap;
24
25 import nl.tudelft.goal.emohawk.agent.EmohawkBotBehavior;
26 import nl.tudelft.goal.emohawk.translators.EmoticonTypeTranslator;
27 import nl.tudelft.goal.emohawk.translators.PerceptTranslator;
28 import nl.tudelft.goal.emohawk.translators.PlaceTranslator;
29 import nl.tudelft.goal.emohawk.translators.UnrealIdOrLocationTranslator;
30 import nl.tudelft.goal.unreal.environment.AbstractUnrealEnvironment;
31 import nl.tudelft.goal.unreal.translators.LocationTranslator;
32 import nl.tudelft.goal.unreal.translators.RotationTranslator;
33 import nl.tudelft.goal.unreal.translators.TeamTranslator;
34 import nl.tudelft.goal.unreal.translators.UnrealIdTranslator;
35 import nl.tudelft.goal.unreal.translators.VelocityTranslator;
36 import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController;
37 import eis.eis2java.handlers.ActionHandler;
38 import eis.eis2java.handlers.AllPerceptPerceptHandler;
39 import eis.eis2java.handlers.DefaultActionHandler;
40 import eis.eis2java.handlers.PerceptHandler;
41 import eis.eis2java.translation.Translator;
42 import eis.eis2java.util.AllPerceptsProvider;
43 import eis.exceptions.EntityException;
44 import eis.exceptions.ManagementException;
45 import eis.iilang.Identifier;
46 import eis.iilang.Parameter;
47 import eis.iilang.ParameterList;
48
49 public class EmohawkEnvironment extends AbstractUnrealEnvironment {
50
51
52
53
54 private static final long serialVersionUID = 8240549393243585632L;
55
56 @Override
57 protected void registerTranslators() {
58
59 Translator translator = Translator.getInstance();
60
61
62
63
64
65
66
67 LocationTranslator locationTranslator = new LocationTranslator();
68 translator.registerJava2ParameterTranslator(locationTranslator);
69 translator.registerParameter2JavaTranslator(locationTranslator);
70
71
72
73
74
75
76
77 RotationTranslator rotationTranslator = new RotationTranslator();
78 translator.registerJava2ParameterTranslator(rotationTranslator);
79 translator.registerParameter2JavaTranslator(rotationTranslator);
80
81 TeamTranslator teamTranslator = new TeamTranslator();
82 translator.registerJava2ParameterTranslator(teamTranslator);
83 translator.registerParameter2JavaTranslator(teamTranslator);
84
85 UnrealIdTranslator unrealIdTranslator = new UnrealIdTranslator();
86 translator.registerJava2ParameterTranslator(unrealIdTranslator);
87 translator.registerParameter2JavaTranslator(unrealIdTranslator);
88
89 VelocityTranslator velocityTranslator = new VelocityTranslator();
90 translator.registerJava2ParameterTranslator(velocityTranslator);
91 translator.registerParameter2JavaTranslator(velocityTranslator);
92
93
94
95
96
97
98
99 EmoticonTypeTranslator emoticonTypeTranslator = new EmoticonTypeTranslator();
100 translator.registerJava2ParameterTranslator(emoticonTypeTranslator);
101 translator.registerParameter2JavaTranslator(emoticonTypeTranslator);
102
103 PerceptTranslator perceptTranslator = new PerceptTranslator();
104 translator.registerJava2ParameterTranslator(perceptTranslator);
105
106 PlaceTranslator placeTranslator = new PlaceTranslator();
107 translator.registerJava2ParameterTranslator(placeTranslator);
108
109 UnrealIdOrLocationTranslator unrealIdOrLocationTranslator = new UnrealIdOrLocationTranslator();
110 translator.registerParameter2JavaTranslator(unrealIdOrLocationTranslator);
111
112 }
113
114 public static void main(String[] args) throws ManagementException {
115 HashMap<String, Parameter> map = new HashMap<String, Parameter>();
116 map.put("botNames", new ParameterList(new Identifier("Test")));
117 new EmohawkEnvironment().init(map);
118
119 }
120
121 @Override
122 protected Class<EmohawkBotBehavior> getControlerClass() {
123 return EmohawkBotBehavior.class;
124 }
125
126 @Override
127 protected PerceptHandler createPerceptHandler(UT2004BotController controller) throws EntityException {
128 return new AllPerceptPerceptHandler((AllPerceptsProvider) controller);
129 }
130
131 @Override
132 protected ActionHandler createActionHandler(UT2004BotController controller) throws EntityException {
133 return new DefaultActionHandler(controller);
134 }
135
136 }