- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
private enum UpdateToken {
W, A, F, D, H;
private static final Pattern PATTERN = compilePattern(UpdateToken.class);
}
private static Pattern compilePattern(Class<? extends Enum> clazz) {
StringBuilder builder = new StringBuilder("(");
for (Enum enumConstant : clazz.getEnumConstants()) {
if (enumConstant.ordinal() > 0) {
builder.append("|");
}
builder.append(enumConstant.name());
}
builder.append(")");
return Pattern.compile(builder.toString());
}
//и это добро вот так используется:
if (!UpdateToken.PATTERN.matcher(token).matches()) {
continue;
}
UpdateToken setupToken = UpdateToken.valueOf(token);
https://github.com/aichallenge/aichallenge/blob/epsilon/ants/dist/starter_bots/java/AbstractSystemInputParser.java
guestGovno 01.11.2011 18:23 # 0
WASD же!
Lure Of Chaos 02.11.2011 00:24 # +1
guestGovno 02.11.2011 04:24 # +3
guest8 09.04.2019 11:53 # −999