From cb7e589985d25a5a4d787927a6531722b0a2ec44 Mon Sep 17 00:00:00 2001
From: Peter Hertkorn <peter.hertkorn@reutlingen-university.de>
Date: Sat, 10 Oct 2020 18:26:01 +0200
Subject: [PATCH] Add start and stop

---
 src/soon/PlayZustand.java   | 13 ++++++++++
 src/soon/Soon.java          | 50 +++++++++++++++++++++++++++++++++++++
 src/soon/SoonTestDrive.java | 14 +++++++++++
 src/soon/StopZustand.java   | 13 ++++++++++
 src/soon/Zustand.java       | 12 +++++++++
 5 files changed, 102 insertions(+)
 create mode 100644 src/soon/PlayZustand.java
 create mode 100644 src/soon/Soon.java
 create mode 100644 src/soon/SoonTestDrive.java
 create mode 100644 src/soon/StopZustand.java
 create mode 100644 src/soon/Zustand.java

diff --git a/src/soon/PlayZustand.java b/src/soon/PlayZustand.java
new file mode 100644
index 0000000..b44a8b2
--- /dev/null
+++ b/src/soon/PlayZustand.java
@@ -0,0 +1,13 @@
+package soon;
+
+public class PlayZustand extends Zustand {
+	
+	public PlayZustand(Soon s) {
+		super(s);
+	}
+	
+	public void stopButton() {
+		s.stopPlay();
+		s.setZustand(s.getStopZustand());
+	}
+}
diff --git a/src/soon/Soon.java b/src/soon/Soon.java
new file mode 100644
index 0000000..b2a2004
--- /dev/null
+++ b/src/soon/Soon.java
@@ -0,0 +1,50 @@
+package soon;
+
+public class Soon {
+	Zustand stopZustand;
+	Zustand playZustand;
+	
+	Zustand zustand;
+	
+	public Soon () {
+		stopZustand = new StopZustand(this);
+		playZustand = new PlayZustand(this);
+		zustand = stopZustand;
+	}
+
+	public Zustand getStopZustand() {
+		return stopZustand;
+	}
+
+	public Zustand getPlayZustand() {
+		return playZustand;
+	}
+
+	public void setZustand(Zustand zustand) {
+		this.zustand = zustand;
+	}
+	
+	public void playButton() {
+		zustand.playButton();
+	}
+	
+	public void stopButton() {
+		zustand.stopButton();
+	}
+	
+	public void startPlay() {
+		System.out.println("Musik an");
+	}
+	
+	public void stopPlay() {
+		System.out.println("Musik aus");
+	}
+	
+	public String toString() {
+		StringBuffer result = new StringBuffer();
+		result.append("\nSoon MP3 Player");
+		result.append("\n---------------");
+		result.append("\nSoon available soon in MyCross-Platform Software Store\n");
+		return result.toString();
+	}
+}
diff --git a/src/soon/SoonTestDrive.java b/src/soon/SoonTestDrive.java
new file mode 100644
index 0000000..8f377ed
--- /dev/null
+++ b/src/soon/SoonTestDrive.java
@@ -0,0 +1,14 @@
+package soon;
+
+public class SoonTestDrive {
+
+	public static void main(String[] args) {
+
+		Soon player = new Soon();
+		
+		System.out.println(player);
+		player.playButton();
+		player.stopButton();
+	}
+
+}
diff --git a/src/soon/StopZustand.java b/src/soon/StopZustand.java
new file mode 100644
index 0000000..3210093
--- /dev/null
+++ b/src/soon/StopZustand.java
@@ -0,0 +1,13 @@
+package soon;
+
+public class StopZustand extends Zustand {
+	
+	public StopZustand(Soon s) {
+		super(s);
+	}
+	
+	public void playButton() {
+		s.startPlay();
+		s.setZustand(s.getPlayZustand());
+	}
+}
diff --git a/src/soon/Zustand.java b/src/soon/Zustand.java
new file mode 100644
index 0000000..5ff57b1
--- /dev/null
+++ b/src/soon/Zustand.java
@@ -0,0 +1,12 @@
+package soon;
+
+public abstract class Zustand {
+	protected Soon s;
+
+	public Zustand(Soon s) {
+		this.s = s;
+	}
+	
+	public void playButton() {};
+	public void stopButton() {};
+}
-- 
GitLab