1 package nl.tudelft.goal.unreal.messages;
2
3 import java.util.logging.Level;
4
5 import nl.tudelft.goal.ut2004.util.Skin;
6
7 public enum BotParametersKey implements Key {
8
9
10
11
12 NAME("name"),
13
14
15
16
17
18 LEADTARGET("leadTarget"),
19
20
21
22
23
24
25 LOGLEVEL("logLevel"),
26
27
28
29
30
31 SKILL("skill"),
32
33
34
35
36
37 SKIN("skin"),
38
39
40
41
42
43
44 TEAM("team"),
45
46
47
48 STARTLOCATION("startLocation"),
49
50
51
52 STARTROTATION("startRotation");
53
54
55
56 private String key;
57
58 private BotParametersKey(String name) {
59 this.key = name;
60 }
61
62
63
64
65
66 @Override
67 public String toString() {
68 return key;
69 }
70
71
72
73
74
75 private static String listValid() {
76 String ret = "";
77
78 ConfigurationKey[] keys = ConfigurationKey.values();
79 for (int i = 0; i < keys.length; i++) {
80 ret += keys[i].toString();
81
82 if (i < keys.length - 1)
83 ret += ", ";
84 }
85 return ret;
86 }
87
88
89
90
91
92
93
94
95
96 public static BotParametersKey parseKey(String value) throws IllegalArgumentException {
97 assert value != null;
98
99 for (BotParametersKey key : BotParametersKey.values()) {
100 if (key.key.equalsIgnoreCase(value)) {
101 return key;
102 }
103 }
104
105 String message = "%s is not a valid parameter key. Valid keys are: %s.";
106 message = String.format(message, value, listValid());
107 throw new IllegalArgumentException(message);
108 }
109
110 public String getKey() {
111 return key;
112 }
113 }