diff -r 964aa8102804 -r 505c25412b16 icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java --- a/icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java Sun Jul 15 19:26:28 2012 +0400 +++ b/icfp-model/src/main/java/ru/bosony/model/cellscontents/CellContent.java Sun Jul 15 21:20:04 2012 +0400 @@ -1,5 +1,8 @@ package ru.bosony.model.cellscontents; +import java.util.HashSet; +import java.util.Set; + import ru.bosony.model.io.TextRepresentable; /** @@ -8,7 +11,7 @@ * */ public enum CellContent implements TextRepresentable { - + ClosedLambdaLift("L"), Earth("."), Empty(" "), @@ -16,9 +19,50 @@ MiningRobot("R"), OpenLambdaLift("O"), Rock("*"), - Wall("#"); + Wall("#"), + TrampolineA("A"), + TrampolineB("B"), + TrampolineC("C"), + TrampolineD("D"), + TrampolineE("E"), + TrampolineF("F"), + TrampolineG("G"), + TrampolineH("H"), + TrampolineI("I"), + Target1("1"), + Target2("2"), + Target3("3"), + Target4("4"), + Target5("5"), + Target6("6"), + Target7("7"), + Target8("8"), + Target9("9"); - private String text; + private String text; + private CellContent trampolineTarget = null; + private static Set trampolines = new HashSet(); + private static Set targets = new HashSet(); + static { + trampolines.add(TrampolineA); + trampolines.add(TrampolineB); + trampolines.add(TrampolineC); + trampolines.add(TrampolineD); + trampolines.add(TrampolineE); + trampolines.add(TrampolineF); + trampolines.add(TrampolineG); + trampolines.add(TrampolineH); + trampolines.add(TrampolineI); + targets.add(Target1); + targets.add(Target2); + targets.add(Target3); + targets.add(Target4); + targets.add(Target5); + targets.add(Target6); + targets.add(Target7); + targets.add(Target8); + targets.add(Target9); + } private CellContent(String text) { this.text = text; @@ -37,4 +81,22 @@ return null; } + public CellContent getTrampolineTarget() { + return trampolineTarget; + } + + public void setTrampolineTarget(CellContent trampolineTarget) { + if (!trampolines.contains(this) || trampolineTarget != null && !targets.contains(trampolineTarget)) + throw new RuntimeException("Only references from Trampolines to Targets allowed"); + this.trampolineTarget = trampolineTarget; + } + + public static Set getTrampolines() { + return trampolines; + } + + public static Set getTargets() { + return targets; + } + }