From b5475b051caba5a1bb9646ac25a21b27e484b597 Mon Sep 17 00:00:00 2001 From: CedricNew Date: Mon, 9 Jan 2023 23:43:16 +0100 Subject: [PATCH] corrected language consistency, Javadoc comments, Enumeration, Lambda expressions, UI Code, Updated project structure --- .../Robot_Factory_PR/.idea/misc.xml | 4 +- out/production/Robot_Factory_PR/Main.class | Bin 574 -> 594 bytes .../Robot_Factory_PR/domain/C3PO.class | Bin 1984 -> 0 bytes .../Robot_Factory_PR/domain/Factory.class | Bin 1488 -> 0 bytes .../Robot_Factory_PR/domain/Robot.class | Bin 3729 -> 0 bytes .../facade/FactorySystem.class | Bin 2349 -> 0 bytes .../Robot_Factory_PR/test_factoryFactory.ser | Bin 497 -> 434 bytes out/production/Robot_Factory_PR/ui/UI.class | Bin 3981 -> 0 bytes {domain => src/domain}/C3PO.java | 21 ++- {domain => src/domain}/Factory.java | 29 ++-- {domain => src/domain}/Nexus6.java | 16 +- {domain => src/domain}/R2D2.java | 10 +- {domain => src/domain}/Robot.java | 42 +++-- src/domain/RobotType.java | 13 ++ {facade => src/facade}/FactorySystem.java | 13 +- .../infrastructure}/Persistenz.java | 0 .../Robot_Factory_PR/domain/C3PO.class | Bin 0 -> 1841 bytes .../Robot_Factory_PR/domain/Factory.class | Bin 0 -> 2259 bytes .../Robot_Factory_PR/domain/R2D2.class | Bin 1823 -> 1822 bytes .../Robot_Factory_PR/domain/Robot.class | Bin 0 -> 3983 bytes .../facade/FactorySystem.class | Bin 0 -> 1832 bytes .../infrastructure/Persistenz.class | Bin 1877 -> 1877 bytes .../production/Robot_Factory_PR/ui/UI.class | Bin 0 -> 4657 bytes .../utility/interfaces/Robot.class | Bin 193 -> 193 bytes .../utility/interfaces/RobotControl.class | Bin 321 -> 321 bytes .../interfaces/RobotInstructions.class | Bin 278 -> 278 bytes .../ArrayEmptyException.class | Bin 529 -> 529 bytes .../robot_exceptions/ExceptionStorage.class | Bin 1100 -> 1100 bytes .../robot_exceptions/RobotException.class | Bin 1397 -> 1397 bytes .../RobotIllegalStateException.class | Bin 550 -> 550 bytes .../RobotMagicValueException.class | Bin 544 -> 544 bytes .../robot_exceptions/robotExceptions.class | Bin 1486 -> 1486 bytes src/ui/UI.java | 144 ++++++++++++++++++ .../utility}/interfaces/Robot.java | 2 +- .../utility}/interfaces/RobotControl.java | 0 .../interfaces/RobotInstructions.java | 0 .../robot_exceptions/ArrayEmptyException.java | 0 .../robot_exceptions/ExceptionStorage.java | 14 +- .../robot_exceptions/RobotException.java | 5 + .../RobotIllegalStateException.java | 4 + .../RobotMagicValueException.java | 4 + .../robot_exceptions/robotExceptions.java | 0 test_factoryFactory.ser | Bin 497 -> 0 bytes {domain => tests/tests}/C3POTest.java | 59 +++---- {domain => tests/tests}/R2D2Test.java | 4 +- ui/UI.java | 106 ------------- 46 files changed, 287 insertions(+), 203 deletions(-) delete mode 100644 out/production/Robot_Factory_PR/domain/C3PO.class delete mode 100644 out/production/Robot_Factory_PR/domain/Factory.class delete mode 100644 out/production/Robot_Factory_PR/domain/Robot.class delete mode 100644 out/production/Robot_Factory_PR/facade/FactorySystem.class delete mode 100644 out/production/Robot_Factory_PR/ui/UI.class rename {domain => src/domain}/C3PO.java (86%) rename {domain => src/domain}/Factory.java (68%) rename {domain => src/domain}/Nexus6.java (69%) rename {domain => src/domain}/R2D2.java (92%) rename {domain => src/domain}/Robot.java (79%) create mode 100644 src/domain/RobotType.java rename {facade => src/facade}/FactorySystem.java (86%) rename {infrastructure => src/infrastructure}/Persistenz.java (100%) create mode 100644 src/out/production/Robot_Factory_PR/domain/C3PO.class create mode 100644 src/out/production/Robot_Factory_PR/domain/Factory.class rename {out => src/out}/production/Robot_Factory_PR/domain/R2D2.class (57%) create mode 100644 src/out/production/Robot_Factory_PR/domain/Robot.class create mode 100644 src/out/production/Robot_Factory_PR/facade/FactorySystem.class rename {out => src/out}/production/Robot_Factory_PR/infrastructure/Persistenz.class (98%) create mode 100644 src/out/production/Robot_Factory_PR/ui/UI.class rename {out => src/out}/production/Robot_Factory_PR/utility/interfaces/Robot.class (66%) rename {out => src/out}/production/Robot_Factory_PR/utility/interfaces/RobotControl.class (71%) rename {out => src/out}/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class (68%) rename {out => src/out}/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class (86%) rename {out => src/out}/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class (94%) rename {out => src/out}/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class (98%) rename {out => src/out}/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class (87%) rename {out => src/out}/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class (87%) rename {out => src/out}/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class (92%) create mode 100644 src/ui/UI.java rename {utility => src/utility}/interfaces/Robot.java (85%) rename {utility => src/utility}/interfaces/RobotControl.java (100%) rename {utility => src/utility}/interfaces/RobotInstructions.java (100%) rename {utility => src/utility}/robot_exceptions/ArrayEmptyException.java (100%) rename {utility => src/utility}/robot_exceptions/ExceptionStorage.java (77%) rename {utility => src/utility}/robot_exceptions/RobotException.java (85%) rename {utility => src/utility}/robot_exceptions/RobotIllegalStateException.java (79%) rename {utility => src/utility}/robot_exceptions/RobotMagicValueException.java (78%) rename {utility => src/utility}/robot_exceptions/robotExceptions.java (100%) delete mode 100644 test_factoryFactory.ser rename {domain => tests/tests}/C3POTest.java (66%) rename {domain => tests/tests}/R2D2Test.java (95%) delete mode 100644 ui/UI.java diff --git a/out/production/Robot_Factory_PR/.idea/misc.xml b/out/production/Robot_Factory_PR/.idea/misc.xml index d15472f..b789a5e 100644 --- a/out/production/Robot_Factory_PR/.idea/misc.xml +++ b/out/production/Robot_Factory_PR/.idea/misc.xml @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/out/production/Robot_Factory_PR/Main.class b/out/production/Robot_Factory_PR/Main.class index bea465011120741388563fc37bfd9b6783c8f1c0..c170efe0d4e7ff145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M~%m}abW2srgNzm(l(`R8D-1Rc8IpV z>VAN>=$6DH2%v2H=c1pa1{> diff --git a/out/production/Robot_Factory_PR/domain/Robot.class b/out/production/Robot_Factory_PR/domain/Robot.class deleted file mode 100644 index ea0b3c0137a11690c5c8f574dd092b70e41811f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3729 zcmcInTX!4P8Qn)0kFAX3ODwPxk~$_3S+*lcsZ&r0H9|3Jw`KD zsRXvESVDf=o2^^@HUeRcHdDnH^1+&p$0A`b#+&dq|MmwpjhDQaC z?-}ym)qQvjk83!tBZWzU)ShOFg?11Ul*lh!SX`dFcyVr7AiZ~Xy9~1lGCrka8Z!bK z!JbnE8zI1sk|i*Kj8w`K0?(x$JVd9b$t78mlhW6x1*Y%g>t1@Y(y$kw(J_lt#9ZDm z%Ug4-fn)3nQGD@K@twhOXV z!lH&tI+k#m*>^|g4=eCQn5l-URc6Ow7?Iz^xCOZ8i$T)rgmbQn{>SfPuYJEt@l0;3YL>{*uWneG*%Y&QH}si7<|qM%w% zrewO7QMFz%)~f6+sZ^H;odG77*j;nZIxPl@mTjJE*49jS(f2W2bjn6`$)I2Q3?^gV zhQ*5QFNV8zmeS^~FR*j7!57%7sf$X*bT7!3T)Jj?S;@3ygPt1~gnt~cemvRcs4lr661Tnf)+mNVln(?x5&eRo6vLo6%0{wnr_)VYspF^R7NLcnF#QC$MG7TYt$D^ zZ^Kz{4D{gJ348~yYj{J)oA@r9gQ}?7UY32;*)lUlqqeqg(86H#xntNt_SM3_{uNeO zVB`mQ(XiL6X5(1VakiTEY^MT3Gxr!uP~qhd{?ZS5f7>vxf#;l2t(Hh?b`akeNTym{ zHFS^2lC2*m@FV|Xi zBK~r}_nmF={r3N#;ULY`P(^~yb3e9v@mp$JjQ8Ru`<^^^pBWd~@xlvgkX7UZFIffK zHr-s+Xf(`*hCc{A)&abmVl@0o;K==#@-+126+6mfHNwBIVU34!Oy0nF`bFeDPmR3I zsgd_JHS%)BF#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#u)A zXWb=MKIwN&vTr-u_^tz;MAXHY6r;K^%(K6MUT*dj&xkh3jraH(4g4Ag=JcC=}#-5`0&M&0opzZ`Nt$^5Ko zCOX0Od4cg*I`$No1RkPKuHF)OhS~9!(Z27aBHdEQwerU1KchdgO3dff4~6SP)Hp+g z14MC{JO^C(<=WN^U{a zI#-fq8j(%P(&Do`qu>E~UIzYUOCe7j{z|G(SU|SQORD*Ub(AOi9-?2~@n3m@_cqWm z9^>rNu{v(o@p0b|Oii->!L4}(+_Ff}BT0<%U4d_p@iRHbL*v92w|;Vyvx&)uTeHdI zGatWv_Bk0vSZ4rV;7dZ2OnL$)v0z?;9_Pd);jdtXEY2}WTDMK&K2XPk)IH+s-pUZ* Ww2z@T2-@o0hOgO=1@Vm^|Ly;*CmE#x diff --git a/out/production/Robot_Factory_PR/test_factoryFactory.ser b/out/production/Robot_Factory_PR/test_factoryFactory.ser index 45cdbe0f50cd4e081e18b457b8396e2a52c2534b..05a917043056cf50f82d5af30ce15e598a5d6060 100644 GIT binary patch delta 87 zcmey!yoq^&7{{y|7v+???W`usS+X)PFsKVojPYS)oVe1PNnK#_9!6>LA_kt6{M^LM qJiVa&r2LZkSL~+LyIuE~tif0=tS-P%P{P3Ck)Kluq=JlGj4A-G(;B=0 delta 172 zcmdnQ{E>Nr7{@d2+H##I?%OBIS+X)RFfhNI7~{jpG;yW32?IlM5d(Kher{rBo}ROD zfWPXj(|_O3P)uTCV5lf!;DO2nSVsrQOpqE*kQ$J77LU}TBp?M+Q~>~d!8XbO diff --git a/out/production/Robot_Factory_PR/ui/UI.class b/out/production/Robot_Factory_PR/ui/UI.class deleted file mode 100644 index 50def97afb2f64c0523517d21796cf4c96b0ee9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3981 zcmai1X?GOI6}_dcN1_p+1tcRx8w1v8Vc3i@Lc&NOm{1+&InXEu0Zp!p6Pgrq&u4rMuVKRXL{>kV6|F* zjX+CBS(Er!EgI2epxMM)tP`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n=)ZTZh5I`WGVrbeDZ$8UIo8xVheS-;4vJ{0PRGYpA_}RoBtb*>xQ)okg@=rCkMnq&-yg*}yq#_-v%VCa$p- zKh|Sv-8TFLKV_?WYJI9v-8-VyZg6HL$NI{zwz2Cb9=nX@PPXxn(Zlr%XdEeE6?fKi zrt1cF@Y7W~YeyX2NYI(uRwr*S;AX;YwXoMpi}kc=r&Swkayz!e;yq(i$yWQ8w%VsD z5_pGRnoxO{lPU}}8u%H6fkfpB!sjJ21R=)xrl4NAhTTQ%<+Gu$hy$uU7`1~@dpK&3 zL~Sx^pDALb^FuTgapERU?O*>s-SP4Tt^lF{R|B^2*UjH9#^7uLZET(|keni3DxkiA zN7RZbdMw;s7*_o$-OsA7!|qk?vL6?45fZQ9b=`)1jiH%-A19&?)RU#PWU!sr(yd%? z8`;{!XFnNBVh1t|o`>C-!xQwiho1J*S0BCgvX1Y^o9w@Zr%Ba8&8@|lByj*g$Gb#x z2{HTvztp&{M0_ij8&Qk@U`o`~)KvT%#()8-Najr@BpJ8)Rzt%<($rGK^l;amcd%VS z^9ZeLr29^P<({hMstxaAU3YWU&VAJ!Ypv$kYgM9f_n!rT;_k%c2ff0QVXU>}~r0FEtTh|}snqW#X5`BpQ3)L~vWGkX&l2lNti~u>aEf_ynz|Tc z{Ktv+IdXFbX@|(fU8Y{my{^ diff --git a/domain/C3PO.java b/src/domain/C3PO.java similarity index 86% rename from domain/C3PO.java rename to src/domain/C3PO.java index 75c40f1..615371f 100644 --- a/domain/C3PO.java +++ b/src/domain/C3PO.java @@ -6,10 +6,14 @@ import utility.robot_exceptions.robotExceptions; public class C3PO extends Robot { public C3PO(int id, String name){ - super(id, name, "C3PO"); + super(id, name, RobotType.C3PO); } - //returns the sorted list as String with the delimiter ';' + /** + * @param input from the user + * @return the sorted list as String with the delimiter ';' + * @throws RobotException + */ @Override public String speak(int[] input) throws RobotException { if(isPowerOn()){ @@ -45,9 +49,13 @@ public class C3PO extends Robot { this.exceptions = new ExceptionStorage(robotexception); throw robotexception; } - } - //Sorting then returning the input arr with insertion Sort + + /** + * @param input + * @return the input arr after insertion Sort + * @throws RobotException + */ @Override public int[] think(int[] input) throws RobotException { if(isPowerOn()){ @@ -58,7 +66,4 @@ public class C3PO extends Robot { throw robotException; } } -} - - - +} \ No newline at end of file diff --git a/domain/Factory.java b/src/domain/Factory.java similarity index 68% rename from domain/Factory.java rename to src/domain/Factory.java index 18d9b9f..3b02a16 100644 --- a/domain/Factory.java +++ b/src/domain/Factory.java @@ -13,13 +13,15 @@ public class Factory implements Serializable { public Factory(){ } - - //Has to return Collection + /** + * @return Collection + */ public Collection robotListToCollection(){ return robots.values(); } - - //return a String arr with robot attributes + /** + * @return a String arr with robot attributes + */ public String[] getRobotList() { Collection collect = robotListToCollection(); String[] list = new String[collect.size()]; @@ -29,12 +31,16 @@ public class Factory implements Serializable { } return list; } - //creates a new robot - public boolean buildNewRobot(String name, int type){ - Robot r ; - if(type == 0) { + /** + * @param name + * @param type + * @return created or not + */ + public boolean buildNewRobot(String name, RobotType type){ + Robot r; + if(type == RobotType.R2D2) { r = new R2D2(r2d2ID++, name); - } else if(type == 1) { + } else if(type == RobotType.C3PO) { r = new C3PO(c3poID++, name); } else { return false; @@ -43,7 +49,10 @@ public class Factory implements Serializable { robots.put(r.getId(), r); return true; } - //returns a specific robot via id + /** + * @param id + * @return a specific robot via id + */ public Robot getRobotOfList(int id){ return robots.get(id); } diff --git a/domain/Nexus6.java b/src/domain/Nexus6.java similarity index 69% rename from domain/Nexus6.java rename to src/domain/Nexus6.java index bb4f6bc..0cf2ea2 100644 --- a/domain/Nexus6.java +++ b/src/domain/Nexus6.java @@ -1,5 +1,4 @@ package domain; - import utility.robot_exceptions.ExceptionStorage; import utility.robot_exceptions.RobotException; import utility.robot_exceptions.robotExceptions; @@ -9,21 +8,28 @@ public final class Nexus6 extends Robot { private static final Nexus6 INSTANCE = new Nexus6(); private Nexus6() { - super(1, "Nexus-6", "Nexus-6"); + super(1, "Nexus-6", RobotType.Nexus6); } public static Nexus6 getInstance() { return INSTANCE; } - - //This method always throws an Illegalstate exception + /** + * This method always throws an Illegalstate exception + * @param numbers Zahlen, die ausgegeben werden sollen. + * @throws RobotException + */ @Override public String speak(int[] numbers) throws RobotException { RobotException e = new RobotException(robotExceptions.ILLEGALSTATE, getName()); this.exceptions = new ExceptionStorage(e); throw e; } - //This method always throws an Illegalstate exception + /** + * This method always throws an Illegalstate exception + * @param numbers Zahlen, die sortiert werden sollen. + * @throws RobotException + */ @Override public int[] think(int[] numbers) throws RobotException { RobotException e = new RobotException(robotExceptions.ILLEGALSTATE, getName()); diff --git a/domain/R2D2.java b/src/domain/R2D2.java similarity index 92% rename from domain/R2D2.java rename to src/domain/R2D2.java index 1c67c46..5b208d6 100644 --- a/domain/R2D2.java +++ b/src/domain/R2D2.java @@ -1,6 +1,6 @@ package domain; - +import utility.interfaces.RobotInstructions; import utility.robot_exceptions.ExceptionStorage; import utility.robot_exceptions.RobotException; import utility.robot_exceptions.robotExceptions; @@ -11,11 +11,11 @@ public class R2D2 extends Robot { * @param name> String */ public R2D2(int id, String name){ - super(id, name, "R2D2"); + super(id, name, RobotType.R2D2); } /** - * @see utility.interfaces.RobotInstructions + * @see RobotInstructions * Sorting then returning the input arr with selection sort */ public int[] think(int[] input) throws RobotException { @@ -31,7 +31,7 @@ public class R2D2 extends Robot { /** * Sorts any given array of integers with the selection Sort algorithm. * @param input - * @return + * @return an sorted list * @throws RobotException */ public int[] selectionSort(int[] input) throws RobotException{ @@ -57,7 +57,7 @@ public class R2D2 extends Robot { } /** - * @see utility.interfaces.RobotInstructions + * @see RobotInstructions * returns the sorted list as String with the delimiter ',' */ @Override diff --git a/domain/Robot.java b/src/domain/Robot.java similarity index 79% rename from domain/Robot.java rename to src/domain/Robot.java index e8dbddd..3851d4c 100644 --- a/domain/Robot.java +++ b/src/domain/Robot.java @@ -1,5 +1,5 @@ package domain; - +import utility.interfaces.RobotControl; import utility.robot_exceptions.ExceptionStorage; import utility.robot_exceptions.RobotException; import utility.robot_exceptions.robotExceptions; @@ -10,18 +10,15 @@ import java.util.stream.Collectors; public abstract class Robot implements utility.interfaces.Robot, Serializable { - // ENUMS für Robot Type - static enum RobotType { - C3PO, R2D2, Nexus6; - } + protected ExceptionStorage exceptions; private int id; private final String name; private boolean power; - private String type; + private RobotType type; - public Robot(int id, String name, String type){ + public Robot(int id, String name, RobotType type){ this.id = id; this.name = name; this.power = false; @@ -30,7 +27,7 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { } /** - * @see utility.interfaces.RobotControl; + * @see RobotControl ; */ @Override public int getId() { @@ -38,7 +35,7 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { } /** - * @see utility.interfaces.RobotControl; + * @see RobotControl ; */ @Override public String getName() { @@ -46,7 +43,7 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { } /** - * @see utility.interfaces.RobotControl; + * @see RobotControl ; */ @Override public void triggerPowerSwitch() { @@ -54,7 +51,7 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { } /** - * @see utility.interfaces.RobotControl; + * @see RobotControl ; */ @Override public boolean isPowerOn() { @@ -62,7 +59,7 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { } /** - * @see utility.interfaces.RobotControl; + * @see RobotControl ; */ @Override public RobotException getLastException() { @@ -79,12 +76,12 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { * @return boolean * @throws RobotException EMPTYARRAY Exception */ - - // Check lists for the forbidden Number 42 public boolean checkArray(int[] input) throws RobotException{ if(input.length != 0){ - for(int x: input){ - if(x == 42){ return false; } + if (Arrays.stream(input).anyMatch(i -> i == 42)) { + RobotException robotexception = new RobotException(robotExceptions.MAGICVALUE, getName()); + this.exceptions = new ExceptionStorage(robotexception); + throw robotexception; } return true; }else{ @@ -100,8 +97,6 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { * @return String (array as String) * @throws RobotException */ - - // Write an array with a delimiter to the command line public String output(int[] input, String delemiter)throws RobotException{ if(checkArray(input)) { return Arrays.stream(input) @@ -113,14 +108,17 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { throw robotexception; } } - public String getType(){ + + public RobotType getType(){ return this.type; } - // Override the to String method to get a clean looking outcome + /** + * Override the to String method to get a clean looking outcome + * @return {@link String} + */ @Override public String toString(){ - return "Name: " + name + "; ID: " + id + "; Type: " + type; + return "Name: " + name + "; ID: " + id + "; Type: " + type.toString(); } - } diff --git a/src/domain/RobotType.java b/src/domain/RobotType.java new file mode 100644 index 0000000..9ace46a --- /dev/null +++ b/src/domain/RobotType.java @@ -0,0 +1,13 @@ +package domain; +public enum RobotType { + C3PO("C3PO"), R2D2("R2D2"), Nexus6("Nexus6"); + private final String type; + private RobotType(String type) { + this.type = type; + } + + @Override + public String toString() { + return type; + } +} diff --git a/facade/FactorySystem.java b/src/facade/FactorySystem.java similarity index 86% rename from facade/FactorySystem.java rename to src/facade/FactorySystem.java index ca00e4a..7cfefcb 100644 --- a/facade/FactorySystem.java +++ b/src/facade/FactorySystem.java @@ -2,6 +2,7 @@ package facade; import domain.Factory; import domain.Robot; +import domain.RobotType; import infrastructure.Persistenz; public class FactorySystem { @@ -25,12 +26,14 @@ public class FactorySystem { } - //provide robot attributes + /** + * @return all Robots + */ public String[] getAllRobots(){ return factory.getRobotList(); } //Creating a new robot - public boolean buildNewRobot(String name, int type) { + public boolean buildNewRobot(String name, RobotType type) { boolean check = factory.buildNewRobot(name, type); if(check) { try { @@ -41,7 +44,11 @@ public class FactorySystem { } return check; } - //provides a specific robot + /** + * + * @param id + * @return a specific robot + */ public Robot searchForRobot(int id){ return factory.getRobotOfList(id); } diff --git a/infrastructure/Persistenz.java b/src/infrastructure/Persistenz.java similarity index 100% rename from infrastructure/Persistenz.java rename to src/infrastructure/Persistenz.java diff --git a/src/out/production/Robot_Factory_PR/domain/C3PO.class b/src/out/production/Robot_Factory_PR/domain/C3PO.class new file mode 100644 index 0000000000000000000000000000000000000000..4e4531905b1a201b2504c69b921cb819988bd655 GIT binary patch literal 1841 zcma)7U2hvj6g^|Fv-W25Nt`w`DGj8Jy>{)A(9n{P;)XOB)^Vs)OKpY1##yCHlHF*% z2KtE9KT+|9kn&oPNTgOO?@0Y2`~#4HaAsp$2}z(2J3Du0?!D)nduR67zn{MZFoSz> zLp*J1u+#JI#k33^mT9Ba@_n~Z_Nt?I%XW#3FZV+siOI%^_7+1vfPb)CGZ`0 zWBTNmbX9|fP8GV2E_4fYHsi@u0tu(S?0s$fWmh1YNQw6CDJjz@bE+5=7;gm5mJ>YA`x5x7{Y}l@2^`O@A2L~J*&32KuVV;r3d95NkchxQ z>Xg6<3}ZyaMICS95&@l=BFx!NQKyPU(_C0An3a{n%7TDlzOHL1#oIdGk@(aNJ6N)| zZHf7^tj`sJTdCKNbyBKyRYgi5eI}eXiAv!4)&^6L!;q;n0@?pa9kxr`c{*K9u%uUY zV&zJoy9Um4222bnfbX6V-Z`~H?F&)=lYHY9B{))A> z#V`G)SF^UNmhVWr`B4cTIV9C(9%=JwfrzutzGfQ5W&Nb@iL*lz^&Q*Vlu(H2v<(rT zuIaP&`j_Ye-Nze|DI7OEOA$%As}fkX&62g##ICjVCIhj?6S-+qTj8_~5K zi8;evipvWqmF)oSRZczQa&vB$rfvKwoA=`64s&Bzll5?;iXnt)x@()uFngRd- literal 0 HcmV?d00001 diff --git a/src/out/production/Robot_Factory_PR/domain/Factory.class b/src/out/production/Robot_Factory_PR/domain/Factory.class new file mode 100644 index 0000000000000000000000000000000000000000..4767b0ad85b4cee5df51bde516e9c2b9b9590669 GIT binary patch literal 2259 zcmZuzTXz#x7~LnCFl{=$q%F0jw1|b0q=jIp2u(@RA`%U0CAHY%rITcu4y2iyPPnOW z{t5qpyzrndC?ZRj&p!L)i~qyr68AYXAqix4b>_@D-?zWLzsp(q`bOjD9*j3w23k0LFH62|75oJ_&?MmW`xwn1Q+zmrV zup2!vbo3hNL%%>@$=NaOYT~k4be-Bg0@a*?5QrWg{-%s^m2D3U&8aRc7z+f|I!$d&eH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ory_PR/domain/R2D2.class b/src/out/production/Robot_Factory_PR/domain/R2D2.class similarity index 57% rename from out/production/Robot_Factory_PR/domain/R2D2.class rename to src/out/production/Robot_Factory_PR/domain/R2D2.class index 54b8f8b2f4418d43b9a54a0701bf4e99745ecbf8..31cb8c26669989b57af4616d9153e69c53c9fca0 100644 GIT binary patch delta 158 zcmbQwH;<3w)W2Q(7#J9AHgc?G64Bve;9@Z4VK8GbXJlZ@FD)r3E!ljEX*DA&9|H#i z|Kuu`Qb92Wb_Q_5+tVb->fYKTa0t}iALJV3Aatzu)o(_=IVlZUT z2O4LBPX#-~!a?3e@8^`3{>i0EONg AsQ>@~ delta 160 zcmbQoH=mE=)W2Q(7#JArHgc?G61C=H;9@Z4VK8GbXJlYcEGVhaR>4|87vqg7%Ul57_27$VLd143N+J=fuF$xsM8au#%uCzHfI1H Cm>nYk diff --git a/src/out/production/Robot_Factory_PR/domain/Robot.class b/src/out/production/Robot_Factory_PR/domain/Robot.class new file mode 100644 index 0000000000000000000000000000000000000000..0c5199cecd1188c31aeead53ae6a982e917733df GIT binary patch literal 3983 zcmcInYj+#P8Gc5Vz4m64*dhU(KV*sb{7acKlX^0!>Mvp-Ms(HywmrQ3leQt5pD*6IFr)=Nj% zxR))Dvh#BFb^~|dP66F|wrEv++jXh}qxqU|mu!DM?MY)#H}}#L^utf5P)zZ_=t(X@K4&N4EAyq0w+EqvIfk zH5@W<7)R<5OApfHo@cHzww|i*S!P*aD7lau37}F3g7tLH@d+AFWD?BUh=CMF39WBc z3Hm|0qQF%W7i&&YA|_>~JZs4=n!c6UhNHMgL)ySG+$*rBdA`+xK(FbnPnv#lMPNAj zKQ)icYd9frWJ^RhgVBfk@qmVt20o1k1(I8esU$ZrBu4t=_~W_k?0EkCgg|O*@LL3l zelIcxss0%Ojk!Fl__(VMnxZ>J^_Kefk~X@idm_Y z)&&mKV{9YFnUExk7gGj4k7?$;Y*uDmR=q%GtGqV^qm&CN)L>`~GX~CMR^X1Zxn^Zu zha9|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SN96OE+0#k1Z!gl=3zTI$Mjbjo!nunQ`y`bq8=tYjc5{S ze4^u1ToTY}a@(moewmq7QReQRY;{@36_f<}s!gj=TQeU9RsyppWV4fx;L7H~zFBJ5 z#8n*&_?$K2v4Xm4q6;M~fa7uGwiMfII=;lBK%Aj3%BDxI=`OCDyRP$4QXAIx3~s0d zEgeZf=t2Rev8-bSw^(c)E!OL8HHNY)xh^i`A6s;4^f*wqY;&!-S2f*D?t>JrO9=$>#JX5;H?vmq%Nsd@G-d|ybRh*`4m`hf` zI80%?sV=AnV8g}vih*B5wP`Tp^TaU*x<;P=Uvc#>qWl5N`R5S%!ZT=v7wCJ8VxHs3 z-$*~h_)|;_Pqpy=6HKqF`3IbHJl{ew*zM2%iS(W4_?UNpC+;AonC}8{%S4_Fy!O#= zKN1+==@26t=AAL#8o?}5DDsWE%=J7@<0em6X_uk>EbpyhJz%no4Sdag#;P7#`nk<{ z3ei`DiD-yxs6c2aj3#;Z4KDFtF`VNlIL7mTV7!Hkzi}Q3BI^zI&j#KU9`A%cgz7Qw zDEpU;qlaTb*%wIqvxSMrm{co%+6&A-!Qhn`1sRXE@I?#PCw`@AKgKD0M}$degqT7S z(>$5sS&pZ(d>^x%6@m~h(#<5PDZ(-3@Q`o;TLEFU_bt9-_(>-C4z?MZ5+RMqE5gOv yB51fv#uP$v`T@5>9#?6mDk7mGKhwg^qe2veD8|~C4t*!^BYq-;z|S;}K>iQNr<%+F literal 0 HcmV?d00001 diff --git a/out/production/Robot_Factory_PR/infrastructure/Persistenz.class b/src/out/production/Robot_Factory_PR/infrastructure/Persistenz.class similarity index 98% rename from out/production/Robot_Factory_PR/infrastructure/Persistenz.class rename to src/out/production/Robot_Factory_PR/infrastructure/Persistenz.class index 9c31bf5af609877cf984c62021f2c51bf4da0cf0..92e6b243204b0111353aa3d61bc2052673943ecd 100644 GIT binary patch delta 17 Zcmcc0ca@Lh)W2Q(7#J9AHgfo~0{}z123P<9 delta 17 Zcmcc0ca@Lh)W2Q(7#JArHgfo~0{}zB23i0B diff --git a/src/out/production/Robot_Factory_PR/ui/UI.class b/src/out/production/Robot_Factory_PR/ui/UI.class new file mode 100644 index 0000000000000000000000000000000000000000..6c3769fd5cf29b6a1cb8762a2bb3609e2d60e5d5 GIT binary patch literal 4657 zcmai1340aQ8Ga|*+=LM@AwXDUz@S+OVR0pZh6G9^2}oE9XmxV$N$$X8CeF-FAf;;S zQmeMLt*uL2#igcdH>d_hinMgK`@Z~x{)0Y!tn~fP49TSgo9DT6&dmAFx4hr`edpx8 z4^Eu{upa-YLJ3MulvyZ8g@M@zoe`(ibNs>9?fnN;Ha1YP-u2yhqk+l@Ws$gQa z*uT=i{Dx^o8uwJ926If*T9}J@2FeR=>+UY9jj{%6l0C%^wTXP4g#}nhp@GQ2-0lG< z>*Q4H7AG4A;gQ5K8n3}(3s*_-Re7f{91kh~+-ccvTUd%^2FiSANExV3tY~cLx$6&d zb3K-uxW>Y@XfROc`U9a8#bF^E7edv#Lxqvc@cl6Zv(#ZuqdsRu#R?nu zi^?Vo%~-)bUf|?XcauHWOt+`VuOw$}CRQ4lGhMtURuQkMByT>PRl~6x_*H1Z8cD+1 z%Xr2NRN;CHH{eE6At;a;Q|a76IHuBhGuD}Cvq&$3niylsi)0L#!?MHkGa#{+-1Xsq zRk#_qin_HKY%;L8&sBEb=~uoz5O{;i&nY|5K`4Knok1rxwybWkTUzXP&r|l!pg)LJ zXgmIxaw*P*47P~S8ZERr98-lsW&5hY#S79Rv{i)GiV*)MS7^8pk7+$3bejlWmkK44 zn-9BjvPr*FsGFGC8*PcC*TQx|xm-gag6rja z)u>*Q6~{uqtYiw2(jPO(8CbYY(OrAQ@mwZhyH0}b6rxcl@0l1NGE-FREe!Rma7z#l zIq@XzGRU*CL`$k9v~_F9;2`RA{9TZuKOrd*d`8xLFxSO&ue zmUg--nqq;jLsx~&AKg)I9IeZM$klI-?9oD)<99#E=Iui|vI}fbnj>)r1a>K1vZKKB zY&xb{Gf9oSa?d@l$m$W&b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G+x*`hE1$brNKQ(YxqbRGq+)-f>uq%8tQ2f%|#|n&y@X zeCio=p1?z#J+|_7T1u!S6csupJ%B|*yUnNYd63n&u%wdLFQu;etip+v!-8Ic8?#VqLnr zP6cdfZUXo+{u-0Im4ap6vS2mFNx?qaD~=`wdoSa;hx~klb($bQKyCp!BClX!fSqj+ zOW+dugG6hHi2JOufM^dB?|X=E$km9m5gf%Rp2iX09miOcNAVJ?_7&WRS9vc#j)!RF z0iydLdHj&h%5`M;QP#B7tKgp0tHg0O&D0XSfFJ5=ZlLBL;T$t1`I!gvKWJleo_`;A zu#ztnGSmEHE|=gZ_$kLShW9Xj#@QSi_&MKxqo2Ri&p+T#T#;+&!yGX?gFoZ1_&e(U E3oN{mxc~qF literal 0 HcmV?d00001 diff --git a/out/production/Robot_Factory_PR/utility/interfaces/Robot.class b/src/out/production/Robot_Factory_PR/utility/interfaces/Robot.class similarity index 66% rename from out/production/Robot_Factory_PR/utility/interfaces/Robot.class rename to src/out/production/Robot_Factory_PR/utility/interfaces/Robot.class index c5ef4638f498732d8c58e6ef065fa35504ac1ff4..67fb5dcdfb90e0201d4367b0b282139b0d4c0782 100644 GIT binary patch delta 16 YcmX@ec#x6f)W2Q(7#J9ACUWcq06D4#TL1t6 delta 16 YcmX@ec#x6f)W2Q(7#JArCUWcq06DS-T>t<8 diff --git a/out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class b/src/out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class similarity index 71% rename from out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class rename to src/out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class index 6db39f04fd1479c7ef73a64be4c320b2e578467f..86dccf86f17faae684ae43306c361f5e167e2452 100644 GIT binary patch delta 17 ZcmX@ebdZVT)W2Q(7#J9AHgZ@p0sudx1^xg4 delta 17 ZcmX@ebdZVT)W2Q(7#JArHgZ@p0sud*1^@s6 diff --git a/out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class b/src/out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class similarity index 68% rename from out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class rename to src/out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class index 7e1d54f8af126b0b18876b328c351d8e2149e576..9443f1eda963781782e4aab190b7ac01b2c92bcd 100644 GIT binary patch delta 17 ZcmbQnG>wVl)W2Q(7#J9AHgfPW0suMg1$_Vj delta 17 ZcmbQnG>wVl)W2Q(7#JArHgfPW0suMq1%Chl diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class b/src/out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class similarity index 86% rename from out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class rename to src/out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class index 19a7b23052ddd542f9f1219cde77ed662086c94f..56d740ef622b2392a08d88b5f3905ac4ca001534 100644 GIT binary patch delta 17 ZcmbQpGLePj)W2Q(7#J9AHga$>0RTCH1#0RTCR1$6)b diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class b/src/out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class similarity index 94% rename from out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class rename to src/out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class index 077567460614ccf74389e88d532eb34fc63adfe6..662da0eeac64b53daef0e48f66f8ceea7a89fe2c 100644 GIT binary patch delta 17 ZcmX@ZafXBA)W2Q(7#J9AHgdSI002SJ1}*>q delta 17 ZcmX@ZafXBA)W2Q(7#JArHgdSI002ST1~32s diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class b/src/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class similarity index 98% rename from out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class rename to src/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class index fdcc11e68c5a663e8556ab741389fdaf9f4cee54..f22d7b353a0178eb31f84605a4c0c35d4225a45d 100644 GIT binary patch delta 17 Zcmey$^_7d`)W2Q(7#J9AHge>$0su#V2Ce`A delta 17 Zcmey$^_7d`)W2Q(7#JArHge>$0su#f2Cx7C diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class b/src/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class similarity index 87% rename from out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class rename to src/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class index a058331406fb472ca9d6ec41b40943789b1d00c9..d0643ab83753e86d2127975be85a9fbcb113f125 100644 GIT binary patch delta 17 ZcmZ3+vW$h})W2Q(7#J9AHgd=@0RTKp1+oAD delta 17 ZcmZ3+vW$h})W2Q(7#JArHgd=@0RTKz1+)MF diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class b/src/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class similarity index 87% rename from out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class rename to src/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class index 90d2da7735c78897639ffc8198d0417f257885fd..5a41dab87c96b631dbcf66238c8d58869823314d 100644 GIT binary patch delta 17 ZcmZ3$vVeu-)W2Q(7#J9AHgZTX0RTIH1)u-` delta 17 ZcmZ3$vVeu-)W2Q(7#JArHgZTX0RTIR1)=}| diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class b/src/out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class similarity index 92% rename from out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class rename to src/out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class index d731254ecbdfd946cbf00dae168a91b472306554..a50f2740da265d301cbd18f1a112c02d7adb7214 100644 GIT binary patch delta 17 ZcmX@deU6*s)W2Q(7#J9AHgX(e1pq^E2D< "); + //User options + try{ + int input = Integer.parseInt(sc.nextLine()); + switch(input){ + case 1: + listAllRobots();break; + case 2: buildNewRobot();break; + case 3: useRobot();break; + case 4: break mainloop; + default: + System.out.println("Keine valide Option auswahl"); break; + } + }catch(NumberFormatException e){ + System.out.println("Kein valider Input"); + } + } + System.out.println("Auf Wiedersehen"); + } + /** + * display all existing robots + */ + private void listAllRobots(){ + String[] listOfAll = fs.getAllRobots(); + if(listOfAll.length > 0){ + System.out.println("Diese Roboter existieren bereits:"); + for (String s: listOfAll) { + System.out.println(s); + } + }else{ + System.out.println("Es wurden noch keine Roboter erzeugt"); + } + } + /** + * create a new robot + */ + private void buildNewRobot(){ + System.out.println("Wie soll der neue Roboter heißen"); + System.out.print(" > "); + String name = sc.nextLine(); + System.out.println("Welche Art Roboter wollen Sie"); + System.out.println(" [0] für R2D2 und [1] für C3PO"); + System.out.print(" > "); + //user enters which type of robot he wants + int in = Integer.parseInt(sc.nextLine()); + RobotType type = null; + if(in == 0) { + type = RobotType.R2D2; + } else if(in == 1) { + type = RobotType.C3PO; + } + if(fs.buildNewRobot(name, type)){ + switch (type) { + case R2D2 -> System.out.println("Neuer Roboter vom typ R2D2 mit dem Namen " + name + " wurde erzeugt"); + case C3PO -> System.out.println("Neuer Roboter vom typ C3PO mit dem Namen " + name + " wurde erzeugt"); + } + }else{ + System.out.println("Anlegen des Roboters fehlgeschlagen"); + } + } + /** + * let the robots sort + */ + private void useRobot(){ + System.out.println("Welchen Roboter wollen Sie verwenden"); + listAllRobots(); + System.out.print(" ID > "); + int idInput = Integer.parseInt(sc.nextLine()); + // Change the searchForRobot Methode (safety) + Robot r = fs.searchForRobot(idInput); + System.out.println("Du hast " + r.getName() + " gewählt der vom Typ " + r.getType() + " ist"); + mainloop: + while(true) { + System.out.println(); + System.out.println("_______________________________"); + System.out.println("Sie haben folgende optionen: "); + System.out.println("-1- --- An oder Ausschalten ---"); + System.out.println("-2- -- Sortieren einer Liste --"); + System.out.println("-3- ---------- Exit -----------"); + System.out.print(" > "); + //User options + try { + int input = Integer.parseInt(sc.nextLine()); + switch (input) { + case 1: + listAllRobots(); + break; + case 2: + buildNewRobot(); + break; + case 3: + break; + default: + System.out.println("Keine valide Option auswahl"); break; + } + }catch(NumberFormatException e) { + System.out.println("Kein valider Input"); + } + } + } +} diff --git a/utility/interfaces/Robot.java b/src/utility/interfaces/Robot.java similarity index 85% rename from utility/interfaces/Robot.java rename to src/utility/interfaces/Robot.java index 474b644..c4886c3 100644 --- a/utility/interfaces/Robot.java +++ b/src/utility/interfaces/Robot.java @@ -10,6 +10,6 @@ package utility.interfaces; public interface Robot extends RobotControl, RobotInstructions{ - // keine eigenen Methoden + // Don't write methods here } \ No newline at end of file diff --git a/utility/interfaces/RobotControl.java b/src/utility/interfaces/RobotControl.java similarity index 100% rename from utility/interfaces/RobotControl.java rename to src/utility/interfaces/RobotControl.java diff --git a/utility/interfaces/RobotInstructions.java b/src/utility/interfaces/RobotInstructions.java similarity index 100% rename from utility/interfaces/RobotInstructions.java rename to src/utility/interfaces/RobotInstructions.java diff --git a/utility/robot_exceptions/ArrayEmptyException.java b/src/utility/robot_exceptions/ArrayEmptyException.java similarity index 100% rename from utility/robot_exceptions/ArrayEmptyException.java rename to src/utility/robot_exceptions/ArrayEmptyException.java diff --git a/utility/robot_exceptions/ExceptionStorage.java b/src/utility/robot_exceptions/ExceptionStorage.java similarity index 77% rename from utility/robot_exceptions/ExceptionStorage.java rename to src/utility/robot_exceptions/ExceptionStorage.java index 289976c..31068bc 100644 --- a/utility/robot_exceptions/ExceptionStorage.java +++ b/src/utility/robot_exceptions/ExceptionStorage.java @@ -14,7 +14,9 @@ public class ExceptionStorage implements Serializable { LocalDateTime now = LocalDateTime.now(); this.date = now; } - + /** + * @param message of the exception + */ public void saveLatestErrorMessage(RobotException message){ this.message = message; this.date = LocalDateTime.now(); @@ -23,14 +25,4 @@ public class ExceptionStorage implements Serializable { public RobotException getLastErrorMessage(){ return this.message; } - - /*public boolean emptyErrorStorage(){ - if(this.message != ""){ - this.message = ""; - this.date = LocalDateTime.now(); - return true; - }else{return false;} - - }*/ - } diff --git a/utility/robot_exceptions/RobotException.java b/src/utility/robot_exceptions/RobotException.java similarity index 85% rename from utility/robot_exceptions/RobotException.java rename to src/utility/robot_exceptions/RobotException.java index e8d1485..20c5e96 100644 --- a/utility/robot_exceptions/RobotException.java +++ b/src/utility/robot_exceptions/RobotException.java @@ -10,6 +10,11 @@ public class RobotException extends Exception{ } + /** + * @param types + * @param name + * @return a combined String of both + */ private static String getMessage(robotExceptions types, String name){ return name + " " + types.getMessage(); } diff --git a/utility/robot_exceptions/RobotIllegalStateException.java b/src/utility/robot_exceptions/RobotIllegalStateException.java similarity index 79% rename from utility/robot_exceptions/RobotIllegalStateException.java rename to src/utility/robot_exceptions/RobotIllegalStateException.java index 5dcd6b7..6f4705a 100644 --- a/utility/robot_exceptions/RobotIllegalStateException.java +++ b/src/utility/robot_exceptions/RobotIllegalStateException.java @@ -2,6 +2,10 @@ package utility.robot_exceptions; public class RobotIllegalStateException extends RobotException{ + /** + * @param type + * @param errormessage + */ public RobotIllegalStateException(robotExceptions type, String errormessage){ super(type, errormessage); } diff --git a/utility/robot_exceptions/RobotMagicValueException.java b/src/utility/robot_exceptions/RobotMagicValueException.java similarity index 78% rename from utility/robot_exceptions/RobotMagicValueException.java rename to src/utility/robot_exceptions/RobotMagicValueException.java index 2fb8d2b..d70623f 100644 --- a/utility/robot_exceptions/RobotMagicValueException.java +++ b/src/utility/robot_exceptions/RobotMagicValueException.java @@ -1,6 +1,10 @@ package utility.robot_exceptions; public class RobotMagicValueException extends RobotException { + /** + * @param type + * @param errormessage + */ public RobotMagicValueException(robotExceptions type, String errormessage) { super(type, errormessage); } diff --git a/utility/robot_exceptions/robotExceptions.java b/src/utility/robot_exceptions/robotExceptions.java similarity index 100% rename from utility/robot_exceptions/robotExceptions.java rename to src/utility/robot_exceptions/robotExceptions.java diff --git a/test_factoryFactory.ser b/test_factoryFactory.ser deleted file mode 100644 index 45cdbe0f50cd4e081e18b457b8396e2a52c2534b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 497 zcmYjNJ4gdT6dW%(e-ZHmb`~O5N)BQpC@2^|2j>UvEYwYINlq@e=ibI#3PmmaV5=Zj z7MAulB8a6n7B*HQBBl^aE5Y3)eu~|FFthV!=KLLcz|m~89C5t(I7th}i?6ZuLf^~8 zg@%ZU+H}9q%%mK6!cLe;OAai>L?F;^t&lZhQGvEfd&;OWFSz4n6efy3UBw1s6|3+C^jRt>7l herbert.think(new int[]{42})); + } @Test void magicValueException(){ int[] input = {3,2,42}; - Herbert.triggerPowerSwitch(); + herbert.triggerPowerSwitch(); String expectedMessage = "Herbert has an unknown error. Code 42."; try{ - int[] solution = Herbert.think(input); + int[] solution = herbert.think(input); }catch(RobotException re){ assertEquals(0, expectedMessage.compareTo(re.getMessage())); } try{ - String test = Herbert.speak(input); + String test = herbert.speak(input); }catch(RobotException re){ assertEquals(0, expectedMessage.compareTo(re.getMessage())); } @@ -104,12 +107,12 @@ class C3POTest { int[] input = {3,2,42}; String expectedMessage = "Herbert is turned off."; try{ - int[] solution = Herbert.think(input); + int[] solution = herbert.think(input); }catch(RobotException re){ assertEquals(0, expectedMessage.compareTo(re.getMessage())); } try{ - String test = Herbert.speak(input); + String test = herbert.speak(input); }catch(RobotException re){ assertEquals(0, expectedMessage.compareTo(re.getMessage())); } @@ -119,16 +122,16 @@ class C3POTest { @Test void arrayEmptyException(){ String expectedMessage = "Herbert got an empty array."; - Herbert.triggerPowerSwitch(); + herbert.triggerPowerSwitch(); try{ - int[] solution = Herbert.think(new int[0]); + int[] solution = herbert.think(new int[0]); }catch(RobotException re){ System.out.println(re); assertEquals(0, expectedMessage.compareTo(re.getMessage())); } try{ - String test = Herbert.speak(new int[0]); + String test = herbert.speak(new int[0]); }catch(RobotException re){ System.out.println(re); assertEquals(0, expectedMessage.compareTo(re.getMessage())); diff --git a/domain/R2D2Test.java b/tests/tests/R2D2Test.java similarity index 95% rename from domain/R2D2Test.java rename to tests/tests/R2D2Test.java index f84f794..31ec999 100644 --- a/domain/R2D2Test.java +++ b/tests/tests/R2D2Test.java @@ -1,5 +1,6 @@ -package domain; +package tests; +import src.domain.R2D2; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; import static org.junit.jupiter.api.Assertions.*; @@ -18,7 +19,6 @@ class R2D2Test { //Tests for basic functions @Test void getId() { - assertEquals(id, Herbert.getId()); } diff --git a/ui/UI.java b/ui/UI.java deleted file mode 100644 index bada1c3..0000000 --- a/ui/UI.java +++ /dev/null @@ -1,106 +0,0 @@ -package ui; - -import domain.Robot; -import facade.FactorySystem; -import infrastructure.Persistenz; -import java.util.Scanner; - -public class UI { - - private FactorySystem fs; - private String name; - - Scanner sc = new Scanner(System.in); - public UI (FactorySystem fs){ - this.fs = fs; - hauptmenü(); - - } - public UI (String name){ - this.name = name; - if(Persistenz.existsSavedData(name)){ - try{ - this.fs = (FactorySystem) Persistenz.loadFactoryData(name); - }catch(Exception ignored){ - } - }else{ - this.fs = new FactorySystem(name); - } - } - //starting screen - private void hauptmenü() { - mainloop: - while(true){ - System.out.println(); - System.out.println("____________________________"); - System.out.println("Sie haben folgende optionen:"); - System.out.println("-1- --- show all robots ----"); - System.out.println("-2- --- build new robot ----"); - System.out.println("-3- ------- use robot ------"); - System.out.println("-4- --------- Exit ---------"); - System.out.print(" > "); - //User options - try{ - int input = Integer.parseInt(sc.nextLine()); - switch(input){ - case 1: - listAllRobots();break; - case 2: buildNewRobot();break; - case 3: useRobot();break; - case 4: break mainloop; - default: - System.out.println("this is an invalid option"); break; - } - }catch(NumberFormatException e){ - System.out.println("invalid input"); - } - } - System.out.println("Good Bye"); - } - //display all existing robots - private void listAllRobots(){ - String[] listOfAll = fs.getAllRobots(); - if(listOfAll.length > 0){ - System.out.println("These robtos exist right now:"); - for (String s: listOfAll) { - System.out.println(s); - } - }else{ - System.out.println("There are no robots yet."); - } - } - //create a new robot - private void buildNewRobot(){ - System.out.println("What shall the name of the robot be?"); - System.out.print(" > "); - String name = sc.nextLine(); - System.out.println("Which type of robot do u want?"); - System.out.println(" [0] for R2D2 and [1] for C3PO"); - System.out.print(" > "); - //user enters which type of robot he wants - int type = Integer.parseInt(sc.nextLine()); - if(fs.buildNewRobot(name, type)){ - switch (type) { - case 0 -> System.out.println("Created new Robot of type R2D2 with the name " + name); - case 1 -> System.out.println("Created new Robot of type C3PO with the name " + name); - } - }else{ - System.out.println("Anlegen des Roboters fehlgeschlagen"); - } - } - //let the robots sort - private void useRobot(){ - System.out.println("Which robot do you want to use?"); - listAllRobots(); - System.out.print(" ID > "); - int input = Integer.parseInt(sc.nextLine()); - // Change the searchForRobot Methode (safety) - Robot r = fs.searchForRobot(input); - System.out.println("You choose " + r.getName() + " of type " + r.getType()); - System.out.println("Yout have following options"); - mainloop: - while(true){ - - } - } -}