refactor: changed some ArrayList types to Lists for compatibility

This commit is contained in:
Yannik Bretschneider 2021-06-06 17:55:57 +02:00
parent a69534ff72
commit 5202b63c2e
3 changed files with 6 additions and 5 deletions

View File

@ -81,7 +81,7 @@ public class GameInstance {
* Applies an array of {@link Event Events} to the game state. * Applies an array of {@link Event Events} to the game state.
* @param events The events to apply. * @param events The events to apply.
*/ */
public void applyEvents(ArrayList<Event> events) { public void applyEvents(List<Event> events) {
manager.applyEvents(events); manager.applyEvents(events);
} }
@ -91,7 +91,7 @@ public class GameInstance {
* @param selectedCharacters2 The characters selected by player 2 * @param selectedCharacters2 The characters selected by player 2
* @return The list of resulting {@link Event Events} * @return The list of resulting {@link Event Events}
*/ */
public ArrayList<Event> startGame(ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) { public List<Event> startGame(List<Integer> selectedCharacters1, List<Integer> selectedCharacters2) {
return manager.startGame(selectedCharacters1, selectedCharacters2); return manager.startGame(selectedCharacters1, selectedCharacters2);
} }

View File

@ -716,7 +716,7 @@ public class GameLogic {
* @param selectedCharacters2 The characters selected by player 2 * @param selectedCharacters2 The characters selected by player 2
* @return The list of resulting {@link Event Events} * @return The list of resulting {@link Event Events}
*/ */
protected static ArrayList<Event> startGame(GameState state, ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) { protected static ArrayList<Event> startGame(GameState state, List<Integer> selectedCharacters1, List<Integer> selectedCharacters2) {
Logger.trace("Starting game"); Logger.trace("Starting game");
ArrayList<Event> result = new ArrayList<>(); ArrayList<Event> result = new ArrayList<>();

View File

@ -5,6 +5,7 @@ import uulm.teamname.marvelous.gamelibrary.events.EventType;
import uulm.teamname.marvelous.gamelibrary.requests.Request; import uulm.teamname.marvelous.gamelibrary.requests.Request;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** Represents manager for a game state. */ /** Represents manager for a game state. */
class GameStateManager { class GameStateManager {
@ -63,7 +64,7 @@ class GameStateManager {
* Applies an array of {@link Event Events} to the game state. * Applies an array of {@link Event Events} to the game state.
* @param events The events to apply * @param events The events to apply
*/ */
public void applyEvents(ArrayList<Event> events) { public void applyEvents(List<Event> events) {
for(Event event: events) { for(Event event: events) {
GameLogic.applyEvent(state, event); GameLogic.applyEvent(state, event);
} }
@ -111,7 +112,7 @@ class GameStateManager {
* @param selectedCharacters2 The characters selected by player 2 * @param selectedCharacters2 The characters selected by player 2
* @return The resulting {@link Event Events} * @return The resulting {@link Event Events}
*/ */
public ArrayList<Event> startGame(ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) { public List<Event> startGame(List<Integer> selectedCharacters1, List<Integer> selectedCharacters2) {
GameState snapshot = state.snapshot(); GameState snapshot = state.snapshot();
ArrayList<Event> result = GameLogic.startGame(snapshot, selectedCharacters1, selectedCharacters2); ArrayList<Event> result = GameLogic.startGame(snapshot, selectedCharacters1, selectedCharacters2);