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"),
43 private CellContent trampolineTarget = null;
44 private static Set<CellContent> trampolines = new HashSet<CellContent>();
45 private static Set<CellContent> targets = new HashSet<CellContent>();
47 trampolines.add(TrampolineA);
48 trampolines.add(TrampolineB);
49 trampolines.add(TrampolineC);
50 trampolines.add(TrampolineD);
51 trampolines.add(TrampolineE);
52 trampolines.add(TrampolineF);
53 trampolines.add(TrampolineG);
54 trampolines.add(TrampolineH);
55 trampolines.add(TrampolineI);
67 private CellContent(String text) {
72 public String toText() {
76 public static CellContent fromText(String text) {
77 for (CellContent content : values()) {
78 if (text != null && text.equals(content.toText()))
84 public CellContent getTrampolineTarget() {
85 return trampolineTarget;
88 public void setTrampolineTarget(CellContent trampolineTarget) {
89 if (!trampolines.contains(this) || trampolineTarget != null && !targets.contains(trampolineTarget))
90 throw new RuntimeException("Only references from Trampolines to Targets allowed");
91 this.trampolineTarget = trampolineTarget;
94 public static Set<CellContent> getTrampolines() {
98 public static Set<CellContent> getTargets() {