1 package ru.bosony.model.cellscontents;
3 import java.util.HashSet;
6 import ru.bosony.model.io.TextRepresentable;
9 * @author indvdum (gotoindvdum[at]gmail[dot]com) <br>
13 public enum CellContent implements TextRepresentable {
15 ClosedLambdaLift("L"),
46 private CellContent trampolineTarget = null;
47 private static Set<CellContent> trampolines = new HashSet<CellContent>();
48 private static Set<CellContent> targets = new HashSet<CellContent>();
50 trampolines.add(TrampolineA);
51 trampolines.add(TrampolineB);
52 trampolines.add(TrampolineC);
53 trampolines.add(TrampolineD);
54 trampolines.add(TrampolineE);
55 trampolines.add(TrampolineF);
56 trampolines.add(TrampolineG);
57 trampolines.add(TrampolineH);
58 trampolines.add(TrampolineI);
70 private CellContent(String text) {
75 public String toText() {
79 public static CellContent fromText(String text) {
80 for (CellContent content : values()) {
81 if (text != null && text.equals(content.toText()))
87 public CellContent getTrampolineTarget() {
88 return trampolineTarget;
91 public void setTrampolineTarget(CellContent trampolineTarget) {
92 if (!trampolines.contains(this) || trampolineTarget != null && !targets.contains(trampolineTarget))
93 throw new RuntimeException("Only references from Trampolines to Targets allowed");
94 this.trampolineTarget = trampolineTarget;
97 public static Set<CellContent> getTrampolines() {
101 public static Set<CellContent> getTargets() {