icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java
author indvdum (gotoindvdum[at]gmail[dot]com)
Sat, 14 Jul 2012 23:27:11 +0400
changeset 13 59fca1d3cb55
parent 6 0dbbc8983926
child 27 505c25412b16
permissions -rw-r--r--
Merge with branch indvdum
     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 }