1 package nl.tudelft.goal.ut2004.translators;
2
3 import cz.cuni.amis.pogamut.ut2004.agent.navigation.NavigationState;
4 import eis.eis2java.exception.TranslationException;
5 import eis.eis2java.translation.Java2Parameter;
6 import eis.iilang.Identifier;
7 import eis.iilang.Parameter;
8
9 public class NavigationStateTranslator implements Java2Parameter<NavigationState> {
10
11 @Override
12 public Parameter[] translate(NavigationState o) throws TranslationException {
13
14 Identifier state;
15 switch (o) {
16 case NAVIGATING:
17 state = new Identifier("navigating");
18 break;
19 case STUCK:
20 state = new Identifier("stuck");
21 break;
22 case PATH_COMPUTATION_FAILED:
23 state = new Identifier("noPath");
24 break;
25 case TARGET_REACHED:
26 state = new Identifier("reached");
27 break;
28 case STOPPED:
29 state = new Identifier("waiting");
30 break;
31 default:
32
33
34 throw new TranslationException("Encountered unknown state: " + o);
35 }
36
37 return new Parameter[] { state };
38 }
39
40 @Override
41 public Class<? extends NavigationState> translatesFrom() {
42 return NavigationState.class;
43 }
44
45 }