From d42c1ef95e381450e56b440db5c83a53f6a4b2b9 Mon Sep 17 00:00:00 2001 From: 2120940 <2120940@stud.hs-mannheim.de> Date: Sat, 7 Jan 2023 14:15:53 +0100 Subject: [PATCH] =?UTF-8?q?Struktur=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .classpath | 7 ++++ Roboter/tpe/exceptions/RobotException.java | 20 ++++++++++ .../RobotIllegalStateException.java | 13 +++++++ Roboter/tpe/exceptions/roboter/C3PO.java | 2 +- Roboter/tpe/exceptions/roboter/Nexus6.java | 2 +- Roboter/tpe/exceptions/roboter/R2D2.java | 3 +- .../tpe/exceptions/roboter/RobotControl.java | 2 +- .../exceptions/roboter/RobotInstructions.java | 6 +-- .../roboter/exceptions/RobotException.java | 6 --- .../RobotIllegalStateException.java | 5 --- .../exceptions/RobotMagicValueException.java | 16 -------- Roboter/tpe/exceptions/roboter/ui/UI.java | 5 --- .../roboter => }/facade/RobotFactory.java | 7 +++- Roboter/tpe/infrastructure/Persistenz.java | 39 +++++++++++++++++++ Roboter/tpe/ui/UI.java | 5 +++ 15 files changed, 98 insertions(+), 40 deletions(-) create mode 100644 .classpath create mode 100644 Roboter/tpe/exceptions/RobotException.java create mode 100644 Roboter/tpe/exceptions/RobotIllegalStateException.java delete mode 100644 Roboter/tpe/exceptions/roboter/exceptions/RobotException.java delete mode 100644 Roboter/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java delete mode 100644 Roboter/tpe/exceptions/roboter/exceptions/RobotMagicValueException.java delete mode 100644 Roboter/tpe/exceptions/roboter/ui/UI.java rename Roboter/tpe/{exceptions/roboter => }/facade/RobotFactory.java (73%) create mode 100644 Roboter/tpe/infrastructure/Persistenz.java create mode 100644 Roboter/tpe/ui/UI.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..33515c0 --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Roboter/tpe/exceptions/RobotException.java b/Roboter/tpe/exceptions/RobotException.java new file mode 100644 index 0000000..deee895 --- /dev/null +++ b/Roboter/tpe/exceptions/RobotException.java @@ -0,0 +1,20 @@ +package tpe.exceptions; +import java.util.*; +import java.lang.Thread; +@SuppressWarnings("serial") +public class RobotException extends Exception { + +public class MagicValueException extends Throwable { + throw new Exception("Die Zahl 42 kann nicht verarbeitet werden"); + } + +public RobotException(String string) { + // TODO Auto-generated constructor stub + } + +public RobotException MagicValueException() throws { + + +} + +} diff --git a/Roboter/tpe/exceptions/RobotIllegalStateException.java b/Roboter/tpe/exceptions/RobotIllegalStateException.java new file mode 100644 index 0000000..917278b --- /dev/null +++ b/Roboter/tpe/exceptions/RobotIllegalStateException.java @@ -0,0 +1,13 @@ +package tpe.exceptions; + +public class RobotIllegalStateException { + public boolean illegalState(boolean powerSwitch) { + if(powerSwitch=false) + { + return false; + } + else + return true; + } + +} diff --git a/Roboter/tpe/exceptions/roboter/C3PO.java b/Roboter/tpe/exceptions/roboter/C3PO.java index f031afc..70d5e5b 100644 --- a/Roboter/tpe/exceptions/roboter/C3PO.java +++ b/Roboter/tpe/exceptions/roboter/C3PO.java @@ -1,6 +1,6 @@ package tpe.exceptions.roboter; -import tpe.exceptions.roboter.exceptions.RobotException; +import tpe.exceptions.RobotException; public class C3PO implements Robot{ diff --git a/Roboter/tpe/exceptions/roboter/Nexus6.java b/Roboter/tpe/exceptions/roboter/Nexus6.java index fb44f48..9dae737 100644 --- a/Roboter/tpe/exceptions/roboter/Nexus6.java +++ b/Roboter/tpe/exceptions/roboter/Nexus6.java @@ -1,6 +1,6 @@ package tpe.exceptions.roboter; -import tpe.exceptions.roboter.exceptions.RobotException; +import tpe.exceptions.RobotException; public class Nexus6 implements RobotControl, RobotInstructions { private static int id=19281982; diff --git a/Roboter/tpe/exceptions/roboter/R2D2.java b/Roboter/tpe/exceptions/roboter/R2D2.java index 392a7a2..73bd57e 100644 --- a/Roboter/tpe/exceptions/roboter/R2D2.java +++ b/Roboter/tpe/exceptions/roboter/R2D2.java @@ -1,7 +1,8 @@ package tpe.exceptions.roboter; import java.util.*; -import tpe.exceptions.roboter.exceptions.RobotException; + +import tpe.exceptions.RobotException; public class R2D2 implements Robot { RobotException robotexception; diff --git a/Roboter/tpe/exceptions/roboter/RobotControl.java b/Roboter/tpe/exceptions/roboter/RobotControl.java index 814f272..d43f36b 100644 --- a/Roboter/tpe/exceptions/roboter/RobotControl.java +++ b/Roboter/tpe/exceptions/roboter/RobotControl.java @@ -1,6 +1,6 @@ package tpe.exceptions.roboter; -import tpe.exceptions.roboter.exceptions.RobotException; +import tpe.exceptions.RobotException; /** * Das Interface repräsentiert einen einfachen Roboter mit seinen Funktionen. diff --git a/Roboter/tpe/exceptions/roboter/RobotInstructions.java b/Roboter/tpe/exceptions/roboter/RobotInstructions.java index dd3ccf6..ccc5abb 100644 --- a/Roboter/tpe/exceptions/roboter/RobotInstructions.java +++ b/Roboter/tpe/exceptions/roboter/RobotInstructions.java @@ -1,8 +1,8 @@ package tpe.exceptions.roboter; -import tpe.exceptions.roboter.exceptions.RobotException; -import tpe.exceptions.roboter.exceptions.RobotIllegalStateException; -import tpe.exceptions.roboter.exceptions.RobotMagicValueException; +import tpe.exceptions.RobotException; +import tpe.exceptions.RobotIllegalStateException; +import tpe.exceptions.RobotMagicValueException; /** * Das Interface repräsentiert den Befehlssatz eines einfachen Roboters. diff --git a/Roboter/tpe/exceptions/roboter/exceptions/RobotException.java b/Roboter/tpe/exceptions/roboter/exceptions/RobotException.java deleted file mode 100644 index 6b7ae91..0000000 --- a/Roboter/tpe/exceptions/roboter/exceptions/RobotException.java +++ /dev/null @@ -1,6 +0,0 @@ -package tpe.exceptions.roboter.exceptions; - -public class RobotException { - - -} diff --git a/Roboter/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java b/Roboter/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java deleted file mode 100644 index d837772..0000000 --- a/Roboter/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java +++ /dev/null @@ -1,5 +0,0 @@ -package tpe.exceptions.roboter.exceptions; - -public class RobotIllegalStateException { - -} diff --git a/Roboter/tpe/exceptions/roboter/exceptions/RobotMagicValueException.java b/Roboter/tpe/exceptions/roboter/exceptions/RobotMagicValueException.java deleted file mode 100644 index 84dae3d..0000000 --- a/Roboter/tpe/exceptions/roboter/exceptions/RobotMagicValueException.java +++ /dev/null @@ -1,16 +0,0 @@ -package tpe.exceptions.roboter.exceptions; - - -public class RobotMagicValueException { - - public boolean invalidNumber(int[] zahlen) { - - boolean error=false; - for(int i =0; i