icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java
branchindvdum
changeset 5 162341642dd7
child 6 0dbbc8983926
     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	Fri Jul 13 21:55:14 2012 +0400
     1.3 @@ -0,0 +1,30 @@
     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 abstract class CellContent implements TextRepresentable {
    1.14 +
    1.15 +	@Override
    1.16 +	public CellContent fromText(String text) {
    1.17 +		for (CellContent content : new CellContent[] {
    1.18 +				new ClosedLambdaLift(),
    1.19 +				new Earth(),
    1.20 +				new Empty(),
    1.21 +				new Lambda(),
    1.22 +				new MiningRobot(),
    1.23 +				new OpenLambdaLift(),
    1.24 +				new Rock(),
    1.25 +				new Wall()
    1.26 +		}) {
    1.27 +			if (text != null && text.equals(content.toText()))
    1.28 +				return content;
    1.29 +		}
    1.30 +		return null;
    1.31 +	}
    1.32 +
    1.33 +}