From 5202b63c2e537cfd9aeb50b895442c11a769b1c9 Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Sun, 6 Jun 2021 17:55:57 +0200 Subject: [PATCH] refactor: changed some ArrayList types to Lists for compatibility --- .../marvelous/gamelibrary/gamelogic/GameInstance.java | 4 ++-- .../teamname/marvelous/gamelibrary/gamelogic/GameLogic.java | 2 +- .../marvelous/gamelibrary/gamelogic/GameStateManager.java | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java index 9046e53..2c8ffd8 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java @@ -81,7 +81,7 @@ public class GameInstance { * Applies an array of {@link Event Events} to the game state. * @param events The events to apply. */ - public void applyEvents(ArrayList events) { + public void applyEvents(List events) { manager.applyEvents(events); } @@ -91,7 +91,7 @@ public class GameInstance { * @param selectedCharacters2 The characters selected by player 2 * @return The list of resulting {@link Event Events} */ - public ArrayList startGame(ArrayList selectedCharacters1, ArrayList selectedCharacters2) { + public List startGame(List selectedCharacters1, List selectedCharacters2) { return manager.startGame(selectedCharacters1, selectedCharacters2); } diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java index 24f0e42..09793d0 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java @@ -716,7 +716,7 @@ public class GameLogic { * @param selectedCharacters2 The characters selected by player 2 * @return The list of resulting {@link Event Events} */ - protected static ArrayList startGame(GameState state, ArrayList selectedCharacters1, ArrayList selectedCharacters2) { + protected static ArrayList startGame(GameState state, List selectedCharacters1, List selectedCharacters2) { Logger.trace("Starting game"); ArrayList result = new ArrayList<>(); diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java index e5165e6..5ba240e 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java @@ -5,6 +5,7 @@ import uulm.teamname.marvelous.gamelibrary.events.EventType; import uulm.teamname.marvelous.gamelibrary.requests.Request; import java.util.ArrayList; +import java.util.List; /** Represents manager for a game state. */ class GameStateManager { @@ -63,7 +64,7 @@ class GameStateManager { * Applies an array of {@link Event Events} to the game state. * @param events The events to apply */ - public void applyEvents(ArrayList events) { + public void applyEvents(List events) { for(Event event: events) { GameLogic.applyEvent(state, event); } @@ -111,7 +112,7 @@ class GameStateManager { * @param selectedCharacters2 The characters selected by player 2 * @return The resulting {@link Event Events} */ - public ArrayList startGame(ArrayList selectedCharacters1, ArrayList selectedCharacters2) { + public List startGame(List selectedCharacters1, List selectedCharacters2) { GameState snapshot = state.snapshot(); ArrayList result = GameLogic.startGame(snapshot, selectedCharacters1, selectedCharacters2);