equal
deleted
inserted
replaced
|
1 package ru.bosony.model.cellscontents; |
|
2 |
|
3 import ru.bosony.model.io.TextRepresentable; |
|
4 |
|
5 /** |
|
6 * @author indvdum (gotoindvdum[at]gmail[dot]com) <br> |
|
7 * 13.07.2012 21:25:49 |
|
8 * |
|
9 */ |
|
10 public enum CellContent implements TextRepresentable { |
|
11 |
|
12 ClosedLambdaLift("L"), |
|
13 Earth("."), |
|
14 Empty(" "), |
|
15 Lambda("\\"), |
|
16 MiningRobot("R"), |
|
17 OpenLambdaLift("O"), |
|
18 Rock("*"), |
|
19 Wall("#"); |
|
20 |
|
21 private String text; |
|
22 |
|
23 private CellContent(String text) { |
|
24 this.text = text; |
|
25 } |
|
26 |
|
27 @Override |
|
28 public String toText() { |
|
29 return text; |
|
30 } |
|
31 |
|
32 public static CellContent fromText(String text) { |
|
33 for (CellContent content : values()) { |
|
34 if (text != null && text.equals(content.toText())) |
|
35 return content; |
|
36 } |
|
37 return null; |
|
38 } |
|
39 |
|
40 } |