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.translators;
22
23 import nl.tudelft.goal.EIS2Java.exception.TranslationException;
24 import nl.tudelft.goal.EIS2Java.translation.Java2Parameter;
25 import nl.tudelft.goal.EIS2Java.translation.Translator;
26 import nl.tudelft.goal.unreal.translators.LocationTranslator;
27 import nl.tudelft.goal.unreal.translators.RotationTranslator;
28 import cz.cuni.amis.pogamut.emohawk.agent.module.sensomotoric.EmoticonType;
29 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo;
30 import eis.iilang.Function;
31 import eis.iilang.Identifier;
32 import eis.iilang.Parameter;
33
34 public class AgentInfoTranslator implements Java2Parameter<AgentInfo> {
35
36 @Override
37 public Parameter[] translate(AgentInfo o) throws TranslationException {
38 EmoticonType emoteLeft = EmoticonType.get(o.getSelf().getEmotLeft());
39 EmoticonType emoteCenter = EmoticonType.get(o.getSelf().getEmotCenter());
40 EmoticonType emoteRight = EmoticonType.get(o.getSelf().getEmotRight());
41
42 return new Parameter[] {
43 new Identifier(o.getSelf().getId().getStringId()),
44 new Identifier(o.getName()),
45 Translator.getInstance().translate2Parameter(o.getLocation())[0],
46 Translator.getInstance().translate2Parameter(o.getRotation())[0],
47 Translator.getInstance().translate2Parameter(emoteLeft)[0],
48 Translator.getInstance().translate2Parameter(emoteCenter)[0],
49 Translator.getInstance().translate2Parameter(emoteRight)[0]};
50 }
51
52 @Override
53 public Class<? extends AgentInfo> translatesFrom() {
54 return AgentInfo.class;
55 }
56
57 }