icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java
author indvdum (gotoindvdum[at]gmail[dot]com)
Fri, 13 Jul 2012 21:55:14 +0400
branchindvdum
changeset 5 162341642dd7
child 6 0dbbc8983926
permissions -rw-r--r--
First model objects
     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 abstract class CellContent implements TextRepresentable {
    11 
    12 	@Override
    13 	public CellContent fromText(String text) {
    14 		for (CellContent content : new CellContent[] {
    15 				new ClosedLambdaLift(),
    16 				new Earth(),
    17 				new Empty(),
    18 				new Lambda(),
    19 				new MiningRobot(),
    20 				new OpenLambdaLift(),
    21 				new Rock(),
    22 				new Wall()
    23 		}) {
    24 			if (text != null && text.equals(content.toText()))
    25 				return content;
    26 		}
    27 		return null;
    28 	}
    29 
    30 }