From cf9301d4b8b4070c378d637d482ef12d44865dde Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Fri, 25 Mar 2022 22:15:19 +0100 Subject: [PATCH] javadocs of Methods to create Movestrategy --- src/main/java/ch/zhaw/pm2/racetrack/Game.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index deac44a..8f6fd94 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -69,10 +69,10 @@ public class Game implements GameSpecification { moveStrategy = new UserMoveStrategy(userInterface, carIndex, track.getCarId(carIndex)); break; case 2: - moveStrategy = getMoveListStrategy(selectedTrack, carIndex, moveStrategy); + moveStrategy = getMoveListStrategy(selectedTrack, carIndex); break; case 3: - moveStrategy = getPathFollowerMoveStrategy(selectedTrack, carIndex, moveStrategy); + moveStrategy = getPathFollowerMoveStrategy(selectedTrack, carIndex); break; case 4: @@ -89,8 +89,15 @@ public class Game implements GameSpecification { } } - private MoveStrategy getPathFollowerMoveStrategy(File selectedTrack, int carIndex, MoveStrategy moveStrategy) { + /** + * creates a PathFollowerMoveStrategy for a specific track and a specific car + * @param selectedTrack the selected Track + * @param carIndex the Index of the car + * @return the created Movestrategy, null if File not found or invalid + */ + private MoveStrategy getPathFollowerMoveStrategy(File selectedTrack, int carIndex) { File selectedFile = null; + MoveStrategy moveStrategy = null; for (File file : config.getFollowerDirectory().listFiles()) { if (file.toString().equals(config.getFollowerDirectory().toString() + "\\" + selectedTrack.getName().split("\\.")[0] + "_points.txt")) { selectedFile = file; @@ -112,8 +119,15 @@ public class Game implements GameSpecification { return moveStrategy; } - private MoveStrategy getMoveListStrategy(File selectedTrack, int carIndex, MoveStrategy moveStrategy) { + /** + * creates a MoveListStrategy for a specific track and a specific car + * @param selectedTrack the selected Track + * @param carIndex the Index of the car + * @return the created Movestrategy, null if File not found or invalid + */ + private MoveStrategy getMoveListStrategy(File selectedTrack, int carIndex) { File selectedFile = null; + MoveStrategy moveStrategy = null; for (File file : config.getMoveDirectory().listFiles()) { if (file.toString().equals(config.getMoveDirectory().toString() + "\\" + selectedTrack.getName().split("\\.")[0] + "-car-" + track.getCar(carIndex).getID() + ".txt")) { selectedFile = file;