1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java Sat Jul 14 23:27:11 2012 +0400
1.3 @@ -0,0 +1,40 @@
1.4 +package ru.bosony.model.cellscontents;
1.5 +
1.6 +import ru.bosony.model.io.TextRepresentable;
1.7 +
1.8 +/**
1.9 + * @author indvdum (gotoindvdum[at]gmail[dot]com) <br>
1.10 + * 13.07.2012 21:25:49
1.11 + *
1.12 + */
1.13 +public enum CellContent implements TextRepresentable {
1.14 +
1.15 + ClosedLambdaLift("L"),
1.16 + Earth("."),
1.17 + Empty(" "),
1.18 + Lambda("\\"),
1.19 + MiningRobot("R"),
1.20 + OpenLambdaLift("O"),
1.21 + Rock("*"),
1.22 + Wall("#");
1.23 +
1.24 + private String text;
1.25 +
1.26 + private CellContent(String text) {
1.27 + this.text = text;
1.28 + }
1.29 +
1.30 + @Override
1.31 + public String toText() {
1.32 + return text;
1.33 + }
1.34 +
1.35 + public static CellContent fromText(String text) {
1.36 + for (CellContent content : values()) {
1.37 + if (text != null && text.equals(content.toText()))
1.38 + return content;
1.39 + }
1.40 + return null;
1.41 + }
1.42 +
1.43 +}