diff --git a/bin/C3PO.class b/bin/C3PO.class index 5180443..174c0db 100644 Binary files a/bin/C3PO.class and b/bin/C3PO.class differ diff --git a/bin/R2D2.class b/bin/R2D2.class index c720f49..f50ae3f 100644 Binary files a/bin/R2D2.class and b/bin/R2D2.class differ diff --git a/src/C3PO.java b/src/C3PO.java index 9196d28..e915b08 100644 --- a/src/C3PO.java +++ b/src/C3PO.java @@ -5,23 +5,31 @@ import java.util.Arrays; import java.util.stream.Collectors; public class C3PO implements Robot { - //declaring + private int id; private String name; private boolean isPowerOn; - //returns id + /** + * @return id of the robot + */ @Override public int getId() { return id; } - //returns name + + /** + * @return name of the robot + */ @Override public String getName() { return name; } - //returns isPorwerOn true if it's false + + /** + * @return isPorwerOn true if it's false + */ @Override public void triggerPowerSwitch() { if(isPowerOn==false){ @@ -32,18 +40,27 @@ public class C3PO implements Robot { } //tes test - //returns isPowerOn + /** + * @return isPowerOn + */ @Override public boolean isPowerOn() { return isPowerOn; } - //creating a RobotException + + /** + * creating a RobotException getLastException + */ @Override public RobotException getLastException() { return null; } - //speak method that returns the sorted and formated numbers from the array zahlen + /** + * speak method that returns the sorted and formated numbers from the array zahlen + * @param int[] zahlen Array of numbers for sorting + * @return sorted and formated numbers + */ @Override public String speak(int[] zahlen) throws RobotException { @@ -52,9 +69,14 @@ public class C3PO implements Robot { return arrayFormatieren(sortiert); } - //method to format the result - //Returns a Stream consisting of the elements of this stream,each boxed to an Integer and maps it into a String - //each element of the Stream is separated by ; + /** + * method to format the outcome + * Returns a Stream consisting of the elements of this stream,each boxed to an Integer + * and maps it into a String + * each element of the Stream is separated by "," + * @param int[] zahlen Array of numbers to sort + * @return formated outcome + */ private String arrayFormatieren(int[] zahlen){ var ergebnis = Arrays.stream(zahlen) .boxed() @@ -63,7 +85,11 @@ public class C3PO implements Robot { return ergebnis; } - //method that sorts the array zahlen with the Selectionsort-Algorithmin in descending order + /** + * method that sorts the array zahlen with the Selectionsort-Algorithmin in descending order + * @param int[] zahlen Array of numbers for sorting + * @return array of numbers in descending order + */ @Override public int[] think(int[] zahlen) throws RobotException { int n = zahlen.length; diff --git a/src/Nexus6.java b/src/Nexus6.java index 3a4f8bc..5906c64 100644 --- a/src/Nexus6.java +++ b/src/Nexus6.java @@ -6,7 +6,7 @@ import java.util.Arrays; import java.util.stream.Collectors; public class Nexus6 implements Robot { - //declaring and initializing + private int id = 19281982; private String name = "pris"; private boolean isPowerOn = false; diff --git a/src/R2D2.java b/src/R2D2.java index 12597aa..62e644b 100644 --- a/src/R2D2.java +++ b/src/R2D2.java @@ -5,23 +5,31 @@ import java.util.Arrays; import java.util.stream.Collectors; public class R2D2 implements Robot { - //declaring + private int id; private String name; private boolean isPowerOn; - //returns id + /** + * @return id of the robot + */ @Override public int getId() { return id; } - //returns name + + /** + * @return name of the robot + */ @Override public String getName() { return name; } - //returns isPorwerOn true if it's false + + /** + * @return isPorwerOn true if it's false + */ @Override public void triggerPowerSwitch() { if(isPowerOn==false){ @@ -30,17 +38,28 @@ public class R2D2 implements Robot { isPowerOn=false; } } - //returns isPowerOn + + /** + * @return isPowerOn + */ @Override public boolean isPowerOn() { return isPowerOn; } - //creating a RobotException + + /** + * creating a RobotException getLastException + */ @Override public RobotException getLastException() { return null; } - //speak method that returns the sorted and formated numbers from the array zahlen + + /** + * speak method that returns the sorted and formated numbers from the array zahlen + * @param int[] zahlen Array of numbers for sorting + * @return sorted and formated numbers + */ @Override public String speak(int[] zahlen) throws RobotException { @@ -48,9 +67,15 @@ public class R2D2 implements Robot { return arrayFormatieren(sortiert); } - //method to format the result - //Returns a Stream consisting of the elements of this stream,each boxed to an Integer and maps it into a String - //each element of the Stream is separated by , + + /** + * method to format the outcome + * Returns a Stream consisting of the elements of this stream,each boxed to an Integer + * and maps it into a String + * each element of the Stream is separated by "," + * @param int[] zahlen Array of numbers to sort + * @return formated outcome + */ private String arrayFormatieren(int[] zahlen){ var ergebnis = Arrays.stream(zahlen) .boxed() @@ -58,7 +83,11 @@ public class R2D2 implements Robot { .collect(Collectors.joining(",")); return ergebnis; } - //method that sorts the array zahlen with the Selectionsort-Algorithmin in ascending order + /** + * method that sorts the array zahlen with the Selectionsort-Algorithmin in ascending order + * @param int[] zahlen Array of numbers for sorting + * @return array of numbers in ascending order + */ @Override public int[] think(int[] zahlen) throws RobotException { int n = zahlen.length;