cleanup: improve javadoc comments

This commit is contained in:
punchready 2021-06-03 03:54:18 +02:00
parent f323873b39
commit f9837b4c28
10 changed files with 40 additions and 45 deletions

View File

@ -5,7 +5,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
/** Represents an inventory of 6 slots of {@link StoneType}s that can be manipulated. */
/** Represents an inventory of 6 slots of {@link StoneType StoneTypes} that can be manipulated. */
public class Inventory implements Iterable<StoneType> {
/** The size of the inventory */
private final int size = 6;

View File

@ -10,7 +10,7 @@ import java.util.HashMap;
import java.util.StringJoiner;
/**
* A class made for building all sorts of {@link Event}s as nicely as possible.
* A class made for building all sorts of {@link Event Events} as nicely as possible.
* It works by taking .with[KEY]() functions and then building a specific event at the end.
*/
public class EventBuilder {
@ -51,7 +51,7 @@ public class EventBuilder {
private HashMap<String, Object> customContent;
/**
* Creates a new {@link EventBuilder} used for building {@link Event}s.
* Creates a new {@link EventBuilder} used for building {@link Event Events}.
* @param eventType is the type of Event that the final event will have
*/
public EventBuilder(EventType eventType) {

View File

@ -10,9 +10,9 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
/** Represents a managed list of {@link Entity}s. */
/** Represents a managed list of {@link Entity Entities}. */
public class EntityManager {
/** The internal collection of {@link Entity}s */
/** The internal collection of {@link Entity Entities} */
private final HashSet<Entity> entities = new HashSet<>();
/** A set of all currently used {@link Rock} entity ids */
@ -114,7 +114,7 @@ public class EntityManager {
/**
* Finds all entities with a position.
* @param pos The position to check on
* @return The found {@link Entity}s matching the position
* @return The found {@link Entity Entities} matching the position
*/
public ArrayList<Entity> findByPosition(IntVector2 pos) {
ArrayList<Entity> found = new ArrayList<>();

View File

@ -34,18 +34,16 @@ public class GameInstance {
}
/**
* Checks an array of {@link Request}s for validity and automatically applies them if valid.
* @param requests The requests to check
* @return The list of resulting {@link Event}s or {@link Optional#empty()} if the check failed
* See {@link GameInstance#checkRequestsAndApply(ArrayList)}.
*/
public Optional<List<Event>> checkRequestsAndApply(Request... requests) {
return checkRequestsAndApply(ArrayTools.toArrayList(requests));
}
/**
* Checks an array of {@link Request}s for validity and automatically applies them if valid.
* Checks an array of {@link Request Requests} for validity and automatically applies them if valid.
* @param requests The requests to check
* @return The list of resulting {@link Event}s or {@link Optional#empty()} if the check failed
* @return The list of resulting {@link Event Events} or {@link Optional#empty()} if the check failed
*/
public Optional<List<Event>> checkRequestsAndApply(ArrayList<Request> requests) {
if(manager.processRequests(requests, true)) {
@ -60,16 +58,14 @@ public class GameInstance {
}
/**
* Checks an array of {@link Request}s for validity without applying it.
* @param requests The requests to check
* @return Whether or not the given set of requests is valid
* See {@link GameInstance#checkRequests(ArrayList)}.
*/
public boolean checkRequests(Request... requests) {
return checkRequests(ArrayTools.toArrayList(requests));
}
/**
* Checks an array of {@link Request}s for validity without applying it.
* Checks an array of {@link Request Requests} for validity without applying it.
* @param requests The requests to check
* @return Whether or not the given set of requests is valid
*/
@ -78,15 +74,14 @@ public class GameInstance {
}
/**
* Applies an array of {@link Event}s to the game state.
* @param events The events to apply.
* See {@link GameInstance#applyEvents(ArrayList)}.
*/
public void applyEvents(Event... events) {
manager.applyEvents(events);
}
/**
* Applies an array of {@link Event}s to the game state.
* Applies an array of {@link Event Events} to the game state.
* @param events The events to apply.
*/
public void applyEvents(ArrayList<Event> events) {
@ -97,7 +92,7 @@ public class GameInstance {
* Initializes and starts the game. Selected characters are given as a list of indices from the {@link CharacterConfig#characters} array.
* @param selectedCharacters1 The characters selected by player 1
* @param selectedCharacters2 The characters selected by player 2
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
public ArrayList<Event> startGame(ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) {
return manager.startGame(selectedCharacters1, selectedCharacters2);
@ -105,7 +100,7 @@ public class GameInstance {
/**
* Forcefully ends the current turn.
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
public ArrayList<Event> endTurn() {
return manager.endTurn();

View File

@ -297,7 +297,7 @@ public class GameLogic {
/**
* Produces resulting {@link Event}s from a given {@link Request}.
* Produces resulting {@link Event Events} from a given {@link Request}.
* @param state The game state to execute on
* @param request The request to execute
* @return The list of resulting events
@ -641,7 +641,7 @@ public class GameLogic {
* @param state The game state to work on
* @param selectedCharacters1 The characters selected by player 1
* @param selectedCharacters2 The characters selected by player 2
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
protected static ArrayList<Event> startGame(GameState state, ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) {
ArrayList<Event> result = new ArrayList<>();
@ -695,7 +695,7 @@ public class GameLogic {
/**
* Forcefully starts the next round.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
protected static ArrayList<Event> startRound(GameState state) {
return handleRoundStart(state);
@ -704,7 +704,7 @@ public class GameLogic {
/**
* Starts end of round handling if necessary.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
protected static ArrayList<Event> checkTurnEnd(GameState state) {
if(
@ -720,7 +720,7 @@ public class GameLogic {
/**
* Forcefully ends the current turn.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
protected static ArrayList<Event> endTurn(GameState state) {
return handleTurnEnd(state);
@ -730,7 +730,7 @@ public class GameLogic {
/**
* Handles everything that happens at the end of a turn, including new rounds.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> handleTurnEnd(GameState state) {
ArrayList<Event> result = new ArrayList<>();
@ -783,7 +783,7 @@ public class GameLogic {
/**
* Handles everything that happens at the beginning of new rounds.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> handleRoundStart(GameState state) {
ArrayList<Event> result = new ArrayList<>();
@ -840,7 +840,7 @@ public class GameLogic {
/**
* Handles the actions of Goose at rounds 1-6.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> handleGoose(GameState state) {
ArrayList<Event> result = new ArrayList<>();
@ -886,7 +886,7 @@ public class GameLogic {
/**
* Handles the actions of Stan at round 7.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> handleStan(GameState state, HashSet<EntityID> revived) {
ArrayList<Event> result = new ArrayList<>();
@ -952,7 +952,7 @@ public class GameLogic {
/**
* Spawns Thanos at the beginning of the first overtime round.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> spawnThanos(GameState state) {
ArrayList<Event> result = new ArrayList<>();
@ -982,7 +982,7 @@ public class GameLogic {
/**
* Handles Thanos' AI.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> handleThanos(GameState state, NPC thanos) {
ArrayList<Event> result = new ArrayList<>();
@ -1102,7 +1102,7 @@ public class GameLogic {
/**
* Handles everything that happens at the beginning of a turn.
* @param state The game state to work on
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> handleTurnStart(GameState state) {
ArrayList<Event> result = new ArrayList<>();
@ -1157,7 +1157,7 @@ public class GameLogic {
* Handles the victory of a player through one character.
* @param state The game state to work on
* @param winner The winning character
* @return The list of resulting {@link Event}s
* @return The list of resulting {@link Event Events}
*/
private static ArrayList<Event> handlePlayerWin(GameState state, EntityType winner) {
ArrayList<Event> result = new ArrayList<>();

View File

@ -21,7 +21,7 @@ class GameState {
public final CharacterConfig characterConfig;
public final ScenarioConfig scenarioConfig;
/** The list of {@link Entity}s inside the game */
/** The list of {@link Entity Entities} inside the game */
public final EntityManager entities = new EntityManager();
/** The set of stones that are yet to be placed on the map */

View File

@ -11,7 +11,7 @@ class GameStateManager {
/** The managed {@link GameState} */
private final GameState state;
/** The queue of {@link Event}s to be applied during {@link Request} processing */
/** The queue of {@link Event Events} to be applied during {@link Request} processing */
private final ArrayList<Event> queue = new ArrayList<>();
/**
@ -23,7 +23,7 @@ class GameStateManager {
}
/**
* Checks a list of {@link Request}s for validity and optionally produces resulting {@link Event}s.
* Checks a list of {@link Request Requests} for validity and optionally produces resulting {@link Event Events}.
* @param requests The requests to check
* @param apply True if resulting events should be stored for later application
* @return Whether the requests are valid
@ -50,7 +50,7 @@ class GameStateManager {
}
/**
* Applies an array of {@link Event}s to the game state.
* Applies an array of {@link Event Events} to the game state.
* @param events The events to apply
*/
public void applyEvents(Event[] events) {
@ -60,7 +60,7 @@ class GameStateManager {
}
/**
* Applies an array of {@link Event}s to the game state.
* Applies an array of {@link Event Events} to the game state.
* @param events The events to apply
*/
public void applyEvents(ArrayList<Event> events) {
@ -96,7 +96,7 @@ class GameStateManager {
/**
* Handles events that happen after a turn phase.
* @return The optionally resulting {@link Event}s
* @return The optionally resulting {@link Event Events}
*/
public ArrayList<Event> checkPostPhase() {
ArrayList<Event> result = GameLogic.checkTurnEnd(state);
@ -108,7 +108,7 @@ class GameStateManager {
* Initializes and starts the game.
* @param selectedCharacters1 The characters selected by player 1
* @param selectedCharacters2 The characters selected by player 2
* @return The resulting {@link Event}s
* @return The resulting {@link Event Events}
*/
public ArrayList<Event> startGame(ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) {
ArrayList<Event> result = GameLogic.startGame(state, selectedCharacters1, selectedCharacters2);
@ -124,7 +124,7 @@ class GameStateManager {
/**
* Forcefully ends the current turn.
* @return The resulting {@link Event}s
* @return The resulting {@link Event Events}
*/
public ArrayList<Event> endTurn() {
ArrayList<Event> result = GameLogic.endTurn(state);

View File

@ -13,7 +13,7 @@ public class EventMessage {
/** This is the message type. It is either REQUESTS or EVENTS, everything else would be invalid here */
public MessageType messageType;
/** The list of {@link Event}s sent inside the message. */
/** The list of {@link Event Events} sent inside the message. */
public Event[] messages;
/** The type of the custom content sent with the message. */

View File

@ -14,7 +14,7 @@ public class RequestMessage {
/** This is the message type. It is either REQUESTS or EVENTS, everything else would be invalid here */
public MessageType messageType;
/** The list of {@link Event}s sent inside the message. */
/** The list of {@link Event Events} sent inside the message. */
public Request[] messages;
/** The type of the custom content sent with the message. */

View File

@ -9,7 +9,7 @@ import java.lang.reflect.Field;
import java.util.StringJoiner;
/**
* A class made for building all sorts of {@link Request}s as nicely as possible.
* A class made for building all sorts of {@link Request Requests} as nicely as possible.
* It works by taking .with[KEY]() functions and then building a specific request at the end.
*/
public class RequestBuilder {
@ -26,7 +26,7 @@ public class RequestBuilder {
private StoneType stoneType;
/**
* Creates a new {@link RequestBuilder} used for building {@link Request}s.
* Creates a new {@link RequestBuilder} used for building {@link Request Requests}.
* @param requestType is the type of Event that the final event will have
*/
public RequestBuilder(RequestType requestType) {