| author | indvdum (gotoindvdum[at]gmail[dot]com) |
| Sat, 14 Jul 2012 02:07:51 +0400 | |
| branch | indvdum |
| changeset 7 | 251961e44b5f |
| child 29 | 66aa96e8fd92 |
| permissions | -rw-r--r-- |
1 package ru.bosony.model.moving;
3 import ru.bosony.model.io.TextRepresentable;
5 /**
6 * @author indvdum (gotoindvdum[at]gmail[dot]com) <br>
7 * 14.07.2012 0:40:35
8 *
9 */
10 public enum Movement implements TextRepresentable {
12 LEFT("L"),
13 RIGHT("R"),
14 UP("U"),
15 DOWN("D"),
16 WAIT("W"),
17 ABORT("A");
19 private String text;
21 private Movement(String text) {
22 this.text = text;
23 }
25 @Override
26 public String toText() {
27 return text;
28 }
30 public static Movement fromText(String text) {
31 for (Movement content : values()) {
32 if (text != null && text.equals(content.toText()))
33 return content;
34 }
35 return null;
36 }
38 }