1 package nl.tudelft.goal.unreal.util;
2
3 import nl.tudelft.goal.unreal.messages.Key;
4 import cz.cuni.amis.pogamut.base.agent.IAgentId;
5
6 public class EnvironmentUtil {
7
8
9
10
11
12
13
14
15
16
17
18 public static String simplefyID(IAgentId agentID) {
19 String token = agentID.getToken();
20 int index = token.lastIndexOf('/');
21
22 if (index < 0) {
23 return token;
24 }
25
26 return token.substring(0, index);
27 }
28
29
30
31
32
33
34
35
36
37 public static <E extends Enum<E>> String listValid(Class<E> type) {
38
39 String ret = "";
40
41 E[] keys = type.getEnumConstants();
42 for (int i = 0; i < keys.length; i++) {
43
44 if (keys[i] instanceof Key) {
45 ret += ((Key) keys[i]).getKey();
46 } else {
47 ret += keys[i].name().toLowerCase();
48 }
49
50 if (i < keys.length - 1)
51 ret += ", ";
52 }
53 return ret;
54 }
55
56 }