diff -r 162341642dd7 -r 0dbbc8983926 icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java --- a/icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java Fri Jul 13 21:55:14 2012 +0400 +++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java Sat Jul 14 00:36:43 2012 +0400 @@ -7,20 +7,30 @@ * 13.07.2012 21:25:49 * */ -public abstract class CellContent implements TextRepresentable { +public enum CellContent implements TextRepresentable { + + ClosedLambdaLift("L"), + Earth("."), + Empty(" "), + Lambda("\\"), + MiningRobot("R"), + OpenLambdaLift("O"), + Rock("*"), + Wall("#"); + + private String text; + + private CellContent(String text) { + this.text = text; + } @Override - public CellContent fromText(String text) { - for (CellContent content : new CellContent[] { - new ClosedLambdaLift(), - new Earth(), - new Empty(), - new Lambda(), - new MiningRobot(), - new OpenLambdaLift(), - new Rock(), - new Wall() - }) { + public String toText() { + return text; + } + + public static CellContent fromText(String text) { + for (CellContent content : values()) { if (text != null && text.equals(content.toText())) return content; }