# HG changeset patch
# User indvdum (gotoindvdum[at]gmail[dot]com)
# Date 1342202114 -14400
# Node ID 162341642dd78ef4632a98bd6b8df81f2d1f4601
# Parent 156014e240fd0e1fb711efba637e4baa17d6c056
First model objects
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,30 @@
+package ru.bosony.model.cellscontents;
+
+import ru.bosony.model.io.TextRepresentable;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:25:49
+ *
+ */
+public abstract class CellContent implements TextRepresentable {
+
+ @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()
+ }) {
+ if (text != null && text.equals(content.toText()))
+ return content;
+ }
+ return null;
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/ClosedLambdaLift.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/ClosedLambdaLift.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,15 @@
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:41:34
+ *
+ */
+public class ClosedLambdaLift extends CellContent {
+
+ @Override
+ public String toText() {
+ return "L";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/Earth.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/Earth.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,15 @@
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:41:39
+ *
+ */
+public class Earth extends CellContent {
+
+ @Override
+ public String toText() {
+ return ".";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/Empty.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/Empty.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,15 @@
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:41:42
+ *
+ */
+public class Empty extends CellContent {
+
+ @Override
+ public String toText() {
+ return " ";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/Lambda.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/Lambda.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:37:31
+ *
+ */
+public class Lambda extends CellContent {
+
+ @Override
+ public String toText() {
+ return "\\";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/MiningRobot.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/MiningRobot.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,15 @@
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:41:47
+ *
+ */
+public class MiningRobot extends CellContent {
+
+ @Override
+ public String toText() {
+ return "R";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/OpenLambdaLift.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/OpenLambdaLift.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,15 @@
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:41:50
+ *
+ */
+public class OpenLambdaLift extends CellContent {
+
+ @Override
+ public String toText() {
+ return "O";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/Rock.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/Rock.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,15 @@
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:41:52
+ *
+ */
+public class Rock extends CellContent {
+
+ @Override
+ public String toText() {
+ return "*";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/cellscontents/Wall.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/Wall.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,15 @@
+package ru.bosony.model.cellscontents;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:41:55
+ *
+ */
+public class Wall extends CellContent {
+
+ @Override
+ public String toText() {
+ return "#";
+ }
+
+}
diff -r 156014e240fd -r 162341642dd7 icfp-model/src/main/java/ru/bosony/model/io/TextRepresentable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icfp-model/src/main/java/ru/bosony/model/io/TextRepresentable.java Fri Jul 13 21:55:14 2012 +0400
@@ -0,0 +1,13 @@
+package ru.bosony.model.io;
+
+/**
+ * @author indvdum (gotoindvdum[at]gmail[dot]com)
+ * 13.07.2012 21:32:34
+ *
+ */
+public interface TextRepresentable {
+
+ public String toText();
+ public TextRepresentable fromText(String text);
+
+}