1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package nl.tudelft.goal.emohawk.translators;
21
22 import nl.tudelft.goal.EIS2Java.exception.TranslationException;
23 import nl.tudelft.goal.EIS2Java.translation.Java2Parameter;
24 import nl.tudelft.goal.EIS2Java.translation.Translator;
25 import cz.cuni.amis.pogamut.emohawk.agent.module.sensomotoric.EmoticonType;
26 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player;
27 import eis.iilang.Identifier;
28 import eis.iilang.Parameter;
29
30 public class PlayerTranslator implements Java2Parameter<Player> {
31
32 @Override
33 public Parameter[] translate(Player o) throws TranslationException {
34
35 EmoticonType emoteLeft = EmoticonType.get(o.getEmotLeft());
36 EmoticonType emoteCenter = EmoticonType.get(o.getEmotCenter());
37 EmoticonType emoteRight = EmoticonType.get(o.getEmotRight());
38
39 return new Parameter[]{
40 Translator.getInstance().translate2Parameter(o.getId())[0],
41 new Identifier(o.getName()),
42 Translator.getInstance().translate2Parameter(o.getLocation())[0],
43 Translator.getInstance().translate2Parameter(o.getRotation())[0],
44 Translator.getInstance().translate2Parameter(emoteLeft)[0],
45 Translator.getInstance().translate2Parameter(emoteCenter)[0],
46 Translator.getInstance().translate2Parameter(emoteRight)[0]
47 };
48 }
49
50 @Override
51 public Class<? extends Player> translatesFrom() {
52 return Player.class;
53 }
54
55 }