diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..4b5e2a6
Binary files /dev/null and b/.DS_Store differ
diff --git a/Main.java b/Main.java
index aeb5dd5..a67aecf 100644
--- a/Main.java
+++ b/Main.java
@@ -1,9 +1,11 @@
import domain.*;
-import robot.exceptions.RobotException;
+import safety.robot_exceptions.RobotException;
+import ui.UI;
public class Main {
public static void main(String[] args) {
+ UI ui = new UI("test_factory");
int[] input = {42,6,5,4,3,43,1};
int[] input2 = input;
diff --git a/README.md b/README.md
index 260ddad..43a3495 100644
--- a/README.md
+++ b/README.md
@@ -26,8 +26,8 @@
* [Factrory](#-classe-factory-)
* ### [Infrastructure](#infratructure-1)
* [Persistenz](#-classe-persistenz-)
-* ### [robot](#robot-1)
- * ### [exceptions](#exceptions-1)
+* ### [safety](#robot-1)
+ * ### [safety](#exceptions-1)
* [RobotException](#-class-robotexception-)
* [RobotIllegalStateException](#-class-robotillegalstateexception-)
* [RobotMagicValueException](#-class-robotmagicvalueexception-)
@@ -199,9 +199,9 @@ ___
`loadFactoryData():Object -> throws`
-## robot
+## safety
-### exceptions
+### safety
Class RobotException
diff --git a/domain/C3PO.java b/domain/C3PO.java
index 5eaa36b..339e645 100644
--- a/domain/C3PO.java
+++ b/domain/C3PO.java
@@ -1,11 +1,8 @@
package domain;
-import robot.exceptions.ExceptionStorage;
-import robot.exceptions.RobotException;
-import robot.exceptions.robotExceptions;
-
-import java.util.Arrays;
-import java.util.stream.Collectors;
+import safety.robot_exceptions.ExceptionStorage;
+import safety.robot_exceptions.RobotException;
+import safety.robot_exceptions.robotExceptions;
public class C3PO extends RobotBasics {
public C3PO(int id, String name){
diff --git a/domain/C3POTest.java b/domain/C3POTest.java
index d7bdeb9..f323dd8 100644
--- a/domain/C3POTest.java
+++ b/domain/C3POTest.java
@@ -1,7 +1,7 @@
package domain;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import robot.exceptions.RobotException;
+import safety.robot_exceptions.RobotException;
import static org.junit.jupiter.api.Assertions.*;
diff --git a/domain/Factory.java b/domain/Factory.java
new file mode 100644
index 0000000..0cf6adb
--- /dev/null
+++ b/domain/Factory.java
@@ -0,0 +1,9 @@
+package domain;
+
+import java.util.HashMap;
+
+public class Factory {
+ private HashMap robots = new HashMap<>();
+ private int c3poID = 0;
+ private int r2d2ID = 1000;
+}
diff --git a/domain/R2D2.java b/domain/R2D2.java
index b7f6441..9279b9e 100644
--- a/domain/R2D2.java
+++ b/domain/R2D2.java
@@ -1,9 +1,9 @@
package domain;
-import robot.exceptions.ExceptionStorage;
-import robot.exceptions.RobotException;
-import robot.exceptions.robotExceptions;
+import safety.robot_exceptions.ExceptionStorage;
+import safety.robot_exceptions.RobotException;
+import safety.robot_exceptions.robotExceptions;
public class R2D2 extends RobotBasics {
/**
@@ -18,7 +18,7 @@ public class R2D2 extends RobotBasics {
/**
- * @see robot.interfaces.RobotInstructions
+ * @see safety.interfaces.RobotInstructions
*/
public int[] think(int[] input) throws RobotException {
if(isPowerOn()){
@@ -32,7 +32,7 @@ public class R2D2 extends RobotBasics {
/**
- * @see robot.interfaces.RobotInstructions
+ * @see safety.interfaces.RobotInstructions
*/
@Override
public String speak(int[] input) throws RobotException {
diff --git a/domain/RobotBasics.java b/domain/RobotBasics.java
index 7596435..202c1ab 100644
--- a/domain/RobotBasics.java
+++ b/domain/RobotBasics.java
@@ -1,9 +1,9 @@
package domain;
-import robot.exceptions.ExceptionStorage;
-import robot.exceptions.RobotException;
-import robot.exceptions.robotExceptions;
-import robot.interfaces.Robot;
+import safety.robot_exceptions.ExceptionStorage;
+import safety.robot_exceptions.RobotException;
+import safety.robot_exceptions.robotExceptions;
+import safety.interfaces.Robot;
import java.util.Arrays;
import java.util.stream.Collectors;
@@ -23,7 +23,7 @@ public abstract class RobotBasics implements Robot {
}
/**
- * @see robot.interfaces.RobotControl;
+ * @see safety.interfaces.RobotControl;
*/
@Override
public int getId() {
@@ -31,7 +31,7 @@ public abstract class RobotBasics implements Robot {
}
/**
- * @see robot.interfaces.RobotControl;
+ * @see safety.interfaces.RobotControl;
*/
@Override
public String getName() {
@@ -39,7 +39,7 @@ public abstract class RobotBasics implements Robot {
}
/**
- * @see robot.interfaces.RobotControl;
+ * @see safety.interfaces.RobotControl;
*/
@Override
public void triggerPowerSwitch() {
@@ -51,7 +51,7 @@ public abstract class RobotBasics implements Robot {
}
/**
- * @see robot.interfaces.RobotControl;
+ * @see safety.interfaces.RobotControl;
*/
@Override
public boolean isPowerOn() {
@@ -59,7 +59,7 @@ public abstract class RobotBasics implements Robot {
}
/**
- * @see robot.interfaces.RobotControl;
+ * @see safety.interfaces.RobotControl;
*/
@Override
public RobotException getLastException() {
diff --git a/facade/Factory.java b/facade/Factory.java
deleted file mode 100644
index b990d22..0000000
--- a/facade/Factory.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package facade;
-
-public class Factory {
-
-}
diff --git a/facade/FactorySystem.java b/facade/FactorySystem.java
new file mode 100644
index 0000000..f887e8d
--- /dev/null
+++ b/facade/FactorySystem.java
@@ -0,0 +1,19 @@
+package facade;
+
+import java.util.HashMap;
+import domain.*;
+import infrastructure.Persistenz;
+
+public class FactorySystem {
+
+
+ private String name;
+
+ public FactorySystem(String name){
+ if(Persistenz.existsSavedData(name)){
+
+ }
+
+ }
+
+}
diff --git a/out/production/Robot_Factory_PR/classpath.index b/out/production/Robot_Factory_PR/classpath.index
deleted file mode 100644
index 03ee4a3..0000000
Binary files a/out/production/Robot_Factory_PR/classpath.index and /dev/null differ
diff --git a/out/production/Robot_Factory_PR/domain/C3PO.class b/out/production/Robot_Factory_PR/domain/C3PO.class
index 241c8f0..a432459 100644
Binary files a/out/production/Robot_Factory_PR/domain/C3PO.class and b/out/production/Robot_Factory_PR/domain/C3PO.class differ
diff --git a/out/production/Robot_Factory_PR/facade/Factory.class b/out/production/Robot_Factory_PR/facade/Factory.class
index c49391e..fe3da3e 100644
Binary files a/out/production/Robot_Factory_PR/facade/Factory.class and b/out/production/Robot_Factory_PR/facade/Factory.class differ
diff --git a/out/production/Robot_Factory_PR/makefile b/out/production/Robot_Factory_PR/makefile
index c4c8eb2..9f1b581 100644
--- a/out/production/Robot_Factory_PR/makefile
+++ b/out/production/Robot_Factory_PR/makefile
@@ -23,5 +23,9 @@ update_interfaces:
git add robot/interfaces
git commit -m "updated interfaces"
git push -u origin main
+update_ui:
+ git add ui/
+ git commit -m "updated ui"
+ git push -u origin main
fetch_git:
- git pull origin main
\ No newline at end of file
+ git pull origin main
diff --git a/out/production/Robot_Factory_PR/robot/exceptions/RobotException$1.class b/out/production/Robot_Factory_PR/robot/exceptions/RobotException$1.class
deleted file mode 100644
index a93d60e..0000000
Binary files a/out/production/Robot_Factory_PR/robot/exceptions/RobotException$1.class and /dev/null differ
diff --git a/out/production/Robot_Factory_PR/robot/exceptions/RobotException.class b/out/production/Robot_Factory_PR/robot/exceptions/RobotException.class
index 6e265cf..89c4054 100644
Binary files a/out/production/Robot_Factory_PR/robot/exceptions/RobotException.class and b/out/production/Robot_Factory_PR/robot/exceptions/RobotException.class differ
diff --git a/out/production/Robot_Factory_PR/robot/exceptions/robotExceptions.class b/out/production/Robot_Factory_PR/robot/exceptions/robotExceptions.class
index 55a0bc1..577d7f1 100644
Binary files a/out/production/Robot_Factory_PR/robot/exceptions/robotExceptions.class and b/out/production/Robot_Factory_PR/robot/exceptions/robotExceptions.class differ
diff --git a/robot/exceptions/robotExceptions.java b/robot/exceptions/robotExceptions.java
deleted file mode 100644
index 656c059..0000000
--- a/robot/exceptions/robotExceptions.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package robot.exceptions;
-
-public enum robotExceptions {
- ILLEGALSTATE, MAGICVALUE, EMPTYARRAY
-}
diff --git a/robot/interfaces/Robot.java b/safety/interfaces/Robot.java
similarity index 73%
rename from robot/interfaces/Robot.java
rename to safety/interfaces/Robot.java
index c7bdf19..b7b8bb6 100644
--- a/robot/interfaces/Robot.java
+++ b/safety/interfaces/Robot.java
@@ -1,9 +1,7 @@
/* (c) 2012 Thomas Smits */
-package robot.interfaces;
+package safety.interfaces;
-import robot.exceptions.RobotException;
-
/**
* Interface für Roboter.
*
diff --git a/robot/interfaces/RobotControl.java b/safety/interfaces/RobotControl.java
similarity index 97%
rename from robot/interfaces/RobotControl.java
rename to safety/interfaces/RobotControl.java
index 8fd6276..945f9e4 100644
--- a/robot/interfaces/RobotControl.java
+++ b/safety/interfaces/RobotControl.java
@@ -1,5 +1,5 @@
-package robot.interfaces;
-import robot.exceptions.RobotException;
+package safety.interfaces;
+import safety.robot_exceptions.RobotException;
/**
* Das Interface repräsentiert einen einfachen Roboter mit seinen Funktionen.
diff --git a/robot/interfaces/RobotInstructions.java b/safety/interfaces/RobotInstructions.java
similarity index 91%
rename from robot/interfaces/RobotInstructions.java
rename to safety/interfaces/RobotInstructions.java
index cd9a9e0..9604568 100644
--- a/robot/interfaces/RobotInstructions.java
+++ b/safety/interfaces/RobotInstructions.java
@@ -1,8 +1,8 @@
-package robot.interfaces;
+package safety.interfaces;
-import robot.exceptions.RobotException;
-import robot.exceptions.RobotIllegalStateException;
-import robot.exceptions.RobotMagicValueException;
+import safety.robot_exceptions.RobotException;
+import safety.robot_exceptions.RobotIllegalStateException;
+import safety.robot_exceptions.RobotMagicValueException;
/**
diff --git a/robot/exceptions/ArrayEmptyException.java b/safety/robot_exceptions/ArrayEmptyException.java
similarity index 84%
rename from robot/exceptions/ArrayEmptyException.java
rename to safety/robot_exceptions/ArrayEmptyException.java
index 3b3cfdb..9f84044 100644
--- a/robot/exceptions/ArrayEmptyException.java
+++ b/safety/robot_exceptions/ArrayEmptyException.java
@@ -1,4 +1,4 @@
-package robot.exceptions;
+package safety.robot_exceptions;
public class ArrayEmptyException extends RobotException{
public ArrayEmptyException(robotExceptions type,String errorMessage){
diff --git a/robot/exceptions/ExceptionStorage.java b/safety/robot_exceptions/ExceptionStorage.java
similarity index 96%
rename from robot/exceptions/ExceptionStorage.java
rename to safety/robot_exceptions/ExceptionStorage.java
index 128f4b6..4d1b342 100644
--- a/robot/exceptions/ExceptionStorage.java
+++ b/safety/robot_exceptions/ExceptionStorage.java
@@ -1,4 +1,4 @@
-package robot.exceptions;
+package safety.robot_exceptions;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
diff --git a/robot/exceptions/RobotException.java b/safety/robot_exceptions/RobotException.java
similarity index 56%
rename from robot/exceptions/RobotException.java
rename to safety/robot_exceptions/RobotException.java
index 8c2587f..26bcc23 100644
--- a/robot/exceptions/RobotException.java
+++ b/safety/robot_exceptions/RobotException.java
@@ -1,4 +1,4 @@
-package robot.exceptions;
+package safety.robot_exceptions;
public class RobotException extends Exception{
robotExceptions currentType;
@@ -11,13 +11,7 @@ public class RobotException extends Exception{
}
private static String getMessage(robotExceptions types, String name){
- String message = "";
- switch (types){
- case ILLEGALSTATE: message = name + " is turned off."; break;
- case MAGICVALUE: message = name + " has an unknown error. Code 42."; break;
- case EMPTYARRAY: message = name + " got an empty array."; break;
- }
- return message;
+ return name + " " + types.getMessage();
}
@Override
diff --git a/robot/exceptions/RobotIllegalStateException.java b/safety/robot_exceptions/RobotIllegalStateException.java
similarity index 85%
rename from robot/exceptions/RobotIllegalStateException.java
rename to safety/robot_exceptions/RobotIllegalStateException.java
index e39128e..ddfd269 100644
--- a/robot/exceptions/RobotIllegalStateException.java
+++ b/safety/robot_exceptions/RobotIllegalStateException.java
@@ -1,4 +1,4 @@
-package robot.exceptions;
+package safety.robot_exceptions;
public class RobotIllegalStateException extends RobotException{
diff --git a/robot/exceptions/RobotMagicValueException.java b/safety/robot_exceptions/RobotMagicValueException.java
similarity index 84%
rename from robot/exceptions/RobotMagicValueException.java
rename to safety/robot_exceptions/RobotMagicValueException.java
index 3574087..9bd1fa4 100644
--- a/robot/exceptions/RobotMagicValueException.java
+++ b/safety/robot_exceptions/RobotMagicValueException.java
@@ -1,4 +1,4 @@
-package robot.exceptions;
+package safety.robot_exceptions;
public class RobotMagicValueException extends RobotException {
public RobotMagicValueException(robotExceptions type, String errormessage) {
diff --git a/safety/robot_exceptions/robotExceptions.java b/safety/robot_exceptions/robotExceptions.java
new file mode 100644
index 0000000..12b7f10
--- /dev/null
+++ b/safety/robot_exceptions/robotExceptions.java
@@ -0,0 +1,17 @@
+package safety.robot_exceptions;
+
+public enum robotExceptions {
+ ILLEGALSTATE("ist in einem illegalen Zustand"),
+ MAGICVALUE("Magic value"),
+ EMPTYARRAY("leer");
+
+ final String message;
+
+ private robotExceptions(String msg) {
+ this.message = msg;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
diff --git a/ui/UI.java b/ui/UI.java
index 5504904..a0a5271 100644
--- a/ui/UI.java
+++ b/ui/UI.java
@@ -1,7 +1,35 @@
package ui;
+import facade.Factory;
+import infrastructure.Persistenz;
+
+import java.util.Scanner;
+
public class UI {
+ private Factory factory;
+ private String name;
+ Scanner sc = new Scanner(System.in);
+ public UI (Factory factory){
+ this.factory = factory;
+ hauptmenü();
+ }
+ public UI (String name){
+ this.name = name;
+ if(Persistenz.existsSavedData(name)){
+ try{
+ this.factory = (Factory) Persistenz.loadFactoryData(name);
+ }catch(Exception e){
+
+ }
+ }else{
+ this.factory = new Factory();
+ }
+ }
+
+ public void hauptmenü(){
+
+ }
}