From 58cac3d48a90e654e5d62346ce22bbfac0197b65 Mon Sep 17 00:00:00 2001 From: Stefan <31254851+piregler@users.noreply.github.com> Date: Sun, 25 Dec 2022 14:07:10 +0100 Subject: [PATCH] added comment for think method --- .../informatik/name/domain/starwars/R2D2.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/hsmannheim/informatik/name/domain/starwars/R2D2.java b/src/de/hsmannheim/informatik/name/domain/starwars/R2D2.java index 786aa11..998d0b9 100644 --- a/src/de/hsmannheim/informatik/name/domain/starwars/R2D2.java +++ b/src/de/hsmannheim/informatik/name/domain/starwars/R2D2.java @@ -22,9 +22,16 @@ public class R2D2 extends StarWarsRobot { return 0 <= id && id <= 9999; } + /** + * R2D2 think method sorts numbers with selection sort + * @param numbers integer numbers for sorting + * @return arrayToSort integer array with numbers sorted in ascending order + * @throws RobotException + * @throws RobotMagicValueException + */ @Override - public int[] think(int[] zahlen) throws RobotException, RobotMagicValueException { - int[] arrayToSort = zahlen.clone(); + public int[] think(int[] numbers) throws RobotException, RobotMagicValueException { + int[] arrayToSort = numbers.clone(); for (int i = 0; i < arrayToSort.length; i++) { if (arrayToSort[i] == MAGIC_NUMBER) { throw new RobotMagicValueException(String.format("Appearance of Magic Number: %d", MAGIC_NUMBER), this);