diff options
Diffstat (limited to 'ws2015/eip/blaetter/07/de/lmu/tcs/Zelle.java')
| -rw-r--r-- | ws2015/eip/blaetter/07/de/lmu/tcs/Zelle.java | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/ws2015/eip/blaetter/07/de/lmu/tcs/Zelle.java b/ws2015/eip/blaetter/07/de/lmu/tcs/Zelle.java deleted file mode 100644 index a7c6ad6..0000000 --- a/ws2015/eip/blaetter/07/de/lmu/tcs/Zelle.java +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | package de.lmu.tcs; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * Model | ||
| 5 | * | ||
| 6 | * Immutable | ||
| 7 | * | ||
| 8 | * Created by jost on 24.11.15. | ||
| 9 | */ | ||
| 10 | public class Zelle { | ||
| 11 | |||
| 12 | public final static int TOT=0; | ||
| 13 | public final static int LEBENDIG=1; | ||
| 14 | |||
| 15 | private final Position position; | ||
| 16 | private final int zustand; | ||
| 17 | |||
| 18 | public Zelle(Position position, int zustand) { | ||
| 19 | this.position = position; | ||
| 20 | this.zustand = zustand; | ||
| 21 | } | ||
| 22 | |||
| 23 | public Zelle(Zelle old) { | ||
| 24 | this.position = old.position; | ||
| 25 | this.zustand = old.zustand; | ||
| 26 | } | ||
| 27 | |||
| 28 | public Position getPosition() { | ||
| 29 | return position; | ||
| 30 | } | ||
| 31 | |||
| 32 | public boolean istLebendig() { | ||
| 33 | return zustand>=LEBENDIG; | ||
| 34 | } | ||
| 35 | |||
| 36 | public boolean istTot() { | ||
| 37 | return zustand==TOT; | ||
| 38 | } | ||
| 39 | |||
| 40 | public Zelle nachkommen() { | ||
| 41 | return this.istTot() ? (new Zelle(this)) : (new Zelle(position, zustand + 1)); | ||
| 42 | } | ||
| 43 | |||
| 44 | public int alter() { | ||
| 45 | return this.istTot() ? -1 : (this.zustand - 1); | ||
| 46 | } | ||
| 47 | } | ||
