refactor: unify comment styles

feat: add entity list class
This commit is contained in:
2021-04-30 20:54:34 +02:00
parent 67a7ab35f9
commit 3f7d393d5d
25 changed files with 269 additions and 263 deletions

View File

@ -6,51 +6,48 @@ import uulm.teamname.marvelous.gamelibrary.requests.Request;
import java.util.Observer;
/** Represents a game instance.
*/
/** Represents a game instance. */
public class GameInstance {
/** The private {@link GameState} of the instance.
*/
/** The private {@link GameState} of the instance */
private final GameState _state;
/** The public view for the underlying {@link GameState} of the instance.
*/
/** The public view for the underlying {@link GameState} of the instance */
public final GameStateView state;
/** The {@link GameStateManager} managing the {@link GameState} of the instance.
*/
/** The {@link GameStateManager} managing the {@link GameState} of the instance */
private final GameStateManager manager;
/** The {@link EventEmitter} for {@link Event}s resulting from {@link Request}s.
*/
/** The {@link EventEmitter} for {@link Event}s resulting from {@link Request}s */
private final EventEmitter emitter = new EventEmitter();
/** Constructs a new {@link GameInstance}.
*/
/** Constructs a new {@link GameInstance}. */
public GameInstance(IntVector2 mapSize) {
_state = new GameState(mapSize);
this.state = new GameStateView(_state);
manager = new GameStateManager(_state);
}
/** Checks a checksum with the current one.
* @param input The checksum to compare to.
* @return Whether or not the checksum matches.
/**
* Checks a checksum with the current one.
* @param input The checksum to compare to
* @return Whether or not the checksum matches
*/
public boolean checkChecksum(long input) {
return ChecksumCalculator.checkChecksum(_state, input);
}
/** Calculates the current checksum of the game state.
* @return The calculated checksum.
/**
* Calculates the current checksum of the game state.
* @return The calculated checksum
*/
public long calculateChecksum() {
return ChecksumCalculator.calculateChecksum(_state);
}
/** Checks an array of {@link Request}s for validity and automatically applies them if valid.
* @param requests The requests to check.
* @return Whether or not the given set of requests was valid.
/**
* Checks an array of {@link Request}s for validity and automatically applies them if valid.
* @param requests The requests to check
* @return Whether or not the given set of requests was valid
*/
public boolean checkRequestsAndApply(Request... requests) {
if(manager.processRequests(requests, true)) {
@ -60,30 +57,34 @@ public class GameInstance {
return false;
}
/** 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.
/**
* 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
*/
public boolean checkRequestsSilent(Request... requests) {
return manager.processRequests(requests, false);
}
/** Applies an array of {@link Event}s to the game state.
/**
* Applies an array of {@link Event}s to the game state.
* @param events The events to apply.
*/
public void applyEvents(Event... events) {
manager.applyEvents(events);
}
/** Adds an {@link Observer} for events.
* @param observer The observer to add.
/**
* Adds an {@link Observer} for events.
* @param observer The observer to add
*/
public void addObserver(Observer observer) {
emitter.addObserver(observer);
}
/** Emits an array of {@link Event}s.
* @param events The events to emit.
/**
* Emits an array of {@link Event}s.
* @param events The events to emit
*/
private void emit(Event... events) {
emitter.notifyObservers(events);