From 54adc38a93bcdd65c2e7b844f51a0ff2921be287 Mon Sep 17 00:00:00 2001 From: cedri Date: Sat, 7 Jan 2023 20:00:44 +0100 Subject: [PATCH] =?UTF-8?q?Methoden=20Robotermodell=20erg=C3=A4nzt=20+=20k?= =?UTF-8?q?leine=20Umstrukturierung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Robbie-Management-System/src/domain/C3PO.java | 9 ++- Robbie-Management-System/src/domain/R2D2.java | 8 ++- .../src/domain/RobotFactory.java | 17 ------ .../src/domain/Robotermodell.java | 55 +++++++++++++++++++ .../src/domain/Robotermodelle.java | 16 ------ .../src/main/RobotFactory.java | 20 +++++++ 6 files changed, 89 insertions(+), 36 deletions(-) delete mode 100644 Robbie-Management-System/src/domain/RobotFactory.java create mode 100644 Robbie-Management-System/src/domain/Robotermodell.java delete mode 100644 Robbie-Management-System/src/domain/Robotermodelle.java create mode 100644 Robbie-Management-System/src/main/RobotFactory.java diff --git a/Robbie-Management-System/src/domain/C3PO.java b/Robbie-Management-System/src/domain/C3PO.java index 184cb36..e51694f 100644 --- a/Robbie-Management-System/src/domain/C3PO.java +++ b/Robbie-Management-System/src/domain/C3PO.java @@ -1,8 +1,9 @@ package domain; +import exceptions.RobotException; import roboterSystem.Robot; -public class C3PO extends Robotermodelle implements Robot { +public class C3PO extends Robotermodell implements Robot { private int zähler = 10000; @@ -12,6 +13,10 @@ public class C3PO extends Robotermodelle implements Robot { zähler++; } - + @Override + public int[] think(int[] zahlen) throws RobotException { + // TODO Auto-generated method stub + return null; + } } diff --git a/Robbie-Management-System/src/domain/R2D2.java b/Robbie-Management-System/src/domain/R2D2.java index 600ec1f..2d6c7a5 100644 --- a/Robbie-Management-System/src/domain/R2D2.java +++ b/Robbie-Management-System/src/domain/R2D2.java @@ -1,8 +1,9 @@ package domain; +import exceptions.RobotException; import roboterSystem.Robot; -public class R2D2 extends Robotermodelle implements Robot { +public class R2D2 extends Robotermodell implements Robot { private int zähler = 0; @@ -12,5 +13,10 @@ public class R2D2 extends Robotermodelle implements Robot { zähler++; } + @Override + public int[] think(int[] zahlen) throws RobotException { + // TODO Auto-generated method stub + return null; + } } diff --git a/Robbie-Management-System/src/domain/RobotFactory.java b/Robbie-Management-System/src/domain/RobotFactory.java deleted file mode 100644 index 1fda10c..0000000 --- a/Robbie-Management-System/src/domain/RobotFactory.java +++ /dev/null @@ -1,17 +0,0 @@ -package domain; - -import roboterSystem.Robot; - -public class RobotFactory { - - public static Robot RobotFactory (String modell, String name) { - switch(modell) { - case "C3PO": - return new C3PO(name); - - case "R2D2": - return new R2D2(name); - } - return null; - } -} diff --git a/Robbie-Management-System/src/domain/Robotermodell.java b/Robbie-Management-System/src/domain/Robotermodell.java new file mode 100644 index 0000000..9c761e1 --- /dev/null +++ b/Robbie-Management-System/src/domain/Robotermodell.java @@ -0,0 +1,55 @@ +package domain; + +import exceptions.RobotException; +import roboterSystem.Robot; + +public abstract class Robotermodell implements Robot { + private int iD; + private String name; + private boolean power = true; + + public void setName(String name) { + this.name = name; + } + + public void setiD(int iD) { + this.iD = iD; + } + + @Override + public int getId() { + return iD; + } + + @Override + public String getName() { + return name; + } + + @Override + public void triggerPowerSwitch() { + if (power == true) { + power = false; + } else { + power = true; + } + } + + @Override + public boolean isPowerOn() { + return power; + } + + @Override + public RobotException getLastException() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String speak(int[] zahlen) throws RobotException { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/Robbie-Management-System/src/domain/Robotermodelle.java b/Robbie-Management-System/src/domain/Robotermodelle.java deleted file mode 100644 index 8e25952..0000000 --- a/Robbie-Management-System/src/domain/Robotermodelle.java +++ /dev/null @@ -1,16 +0,0 @@ -package domain; - -public class Robotermodelle { - private int iD; - private String name; - private boolean power = true; - - public void setName(String name) { - this.name = name; - } - - public void setiD(int iD) { - this.iD = iD; - } - -} diff --git a/Robbie-Management-System/src/main/RobotFactory.java b/Robbie-Management-System/src/main/RobotFactory.java new file mode 100644 index 0000000..ed0a0aa --- /dev/null +++ b/Robbie-Management-System/src/main/RobotFactory.java @@ -0,0 +1,20 @@ +package main; + +import domain.C3PO; +import domain.R2D2; +import domain.RobotType; +import domain.Robotermodell; + +public class RobotFactory { + + public static Robotermodell robotFactory (RobotType modell, String name) { + switch(modell) { + case C3PO: + return new C3PO(name); + + case R2D2: + return new R2D2(name); + } + return null; + } +}