diff options
author | jbion <joffrey.bion@amadeus.com> | 2017-03-13 20:07:12 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2017-03-13 20:07:12 +0100 |
commit | 24ff7b1dd384fcdb79d5c04131922e5a81332196 (patch) | |
tree | 32f48ff89c1dd5516da1a83aae0e008c8670abc6 /backend/src/main | |
parent | Update readme with work in progress status information (diff) | |
download | seven-wonders-24ff7b1dd384fcdb79d5c04131922e5a81332196.tar.gz seven-wonders-24ff7b1dd384fcdb79d5c04131922e5a81332196.tar.bz2 seven-wonders-24ff7b1dd384fcdb79d5c04131922e5a81332196.zip |
Add checkstyle configuration
Diffstat (limited to 'backend/src/main')
39 files changed, 99 insertions, 73 deletions
diff --git a/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java b/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java index 42a26f37..670e44ff 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java +++ b/backend/src/main/java/org/luxons/sevenwonders/actions/ChooseNameAction.java @@ -6,7 +6,7 @@ import javax.validation.constraints.Size; public class ChooseNameAction { @NotNull - @Size(min=2, max=20) + @Size(min = 2, max = 20) private String playerName; public String getPlayerName() { diff --git a/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java b/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java index ce1783c0..00a43971 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java +++ b/backend/src/main/java/org/luxons/sevenwonders/actions/CreateGameAction.java @@ -6,7 +6,7 @@ import javax.validation.constraints.Size; public class CreateGameAction { @NotNull - @Size(min=2, max=30) + @Size(min = 2, max = 30) private String gameName; public String getGameName() { diff --git a/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java b/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java index d54d8da4..7ac53250 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java +++ b/backend/src/main/java/org/luxons/sevenwonders/config/WebSocketConfig.java @@ -48,4 +48,4 @@ public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { public void configureClientInboundChannel(ChannelRegistration registration) { registration.setInterceptors(topicSubscriptionInterceptor); } -}
\ No newline at end of file +} diff --git a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java index 8d00994c..46e4531e 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java +++ b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameBrowserController.java @@ -35,8 +35,8 @@ public class GameBrowserController { private final SimpMessagingTemplate template; @Autowired - public GameBrowserController(LobbyController lobbyController, LobbyRepository lobbyRepository, PlayerRepository playerRepository, - SimpMessagingTemplate template) { + public GameBrowserController(LobbyController lobbyController, LobbyRepository lobbyRepository, + PlayerRepository playerRepository, SimpMessagingTemplate template) { this.lobbyController = lobbyController; this.lobbyRepository = lobbyRepository; this.playerRepository = playerRepository; diff --git a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java index 390d3e83..7b03a976 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java +++ b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java @@ -4,11 +4,11 @@ import java.security.Principal; import org.luxons.sevenwonders.actions.PrepareCardAction; import org.luxons.sevenwonders.game.Game; +import org.luxons.sevenwonders.game.api.PlayerTurnInfo; +import org.luxons.sevenwonders.game.cards.CardBack; import org.luxons.sevenwonders.lobby.Lobby; import org.luxons.sevenwonders.lobby.Player; -import org.luxons.sevenwonders.game.api.PlayerTurnInfo; import org.luxons.sevenwonders.output.PreparedCard; -import org.luxons.sevenwonders.game.cards.CardBack; import org.luxons.sevenwonders.repositories.PlayerRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java b/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java index 1cd18d09..16a40046 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java +++ b/backend/src/main/java/org/luxons/sevenwonders/errors/ErrorType.java @@ -1,5 +1,8 @@ package org.luxons.sevenwonders.errors; enum ErrorType { - USER_INPUT, VALIDATION, CLIENT, SERVER + USER_INPUT, + VALIDATION, + CLIENT, + SERVER } diff --git a/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java b/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java index ee5fcbe0..fbc1ee1d 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java +++ b/backend/src/main/java/org/luxons/sevenwonders/errors/UIError.java @@ -46,7 +46,7 @@ public class UIError { private UIErrorDetail convertError(ObjectError objectError) { if (objectError instanceof FieldError) { - return new UIErrorDetail((FieldError)objectError); + return new UIErrorDetail((FieldError) objectError); } else { return new UIErrorDetail(objectError); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java b/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java index 28b64fbb..179656cb 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java @@ -2,7 +2,6 @@ package org.luxons.sevenwonders.game.api; import java.util.ArrayList; import java.util.List; - import javax.validation.constraints.NotNull; import org.luxons.sevenwonders.game.moves.MoveType; @@ -44,6 +43,6 @@ public class PlayerMove { @Override public String toString() { - return type + " '" + cardName + '\''; + return type + " '" + cardName + '\''; } } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java b/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java index 16f5cf5a..a59bbfae 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/boards/Board.java @@ -157,10 +157,10 @@ public class Board { private int computePointsForCards(Table table, Color color) { return playedCards.stream() - .filter(c -> c.getColor() == color) - .flatMap(c -> c.getEffects().stream()) - .mapToInt(e -> e.computePoints(table, playerIndex)) - .sum(); + .filter(c -> c.getColor() == color) + .flatMap(c -> c.getEffects().stream()) + .mapToInt(e -> e.computePoints(table, playerIndex)) + .sum(); } private int computeGoldPoints() { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java b/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java index 06408b9e..f1b14c6d 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/boards/ScienceType.java @@ -1,5 +1,7 @@ package org.luxons.sevenwonders.game.boards; public enum ScienceType { - COMPASS, WHEEL, TABLET + COMPASS, + WHEEL, + TABLET } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java index de674011..473a1bcf 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Card.java @@ -105,7 +105,7 @@ public class Card { if (o == null || getClass() != o.getClass()) { return false; } - Card card = (Card)o; + Card card = (Card) o; return Objects.equals(name, card.name); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java index 5b4e4473..80d06c55 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/cards/Color.java @@ -1,5 +1,11 @@ package org.luxons.sevenwonders.game.cards; public enum Color { - BROWN, GREY, YELLOW, BLUE, GREEN, RED, PURPLE + BROWN, + GREY, + YELLOW, + BLUE, + GREEN, + RED, + PURPLE } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java b/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java index 9c4f4b02..f3902fb5 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/cards/HandRotationDirection.java @@ -1,7 +1,8 @@ package org.luxons.sevenwonders.game.cards; public enum HandRotationDirection { - LEFT(-1), RIGHT(1); + LEFT(-1), + RIGHT(1); private final int indexOffset; diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java index f0da6d63..6d464388 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/GameDefinitionLoader.java @@ -71,7 +71,8 @@ public class GameDefinitionLoader { } private static Gson createGson() { - Type resourceTypeList = new TypeToken<List<ResourceType>>() {}.getType(); + Type resourceTypeList = new TypeToken<List<ResourceType>>() { + }.getType(); return new GsonBuilder().disableHtmlEscaping() .registerTypeAdapter(Resources.class, new ResourcesSerializer()) .registerTypeAdapter(ResourceType.class, new ResourceTypeSerializer()) diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java index 08c85f57..34091350 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSide.java @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.game.data.definitions; public enum WonderSide { - A, B + A, + B } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java index 9b2bc2d5..c84bba4e 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/definitions/WonderSideDefinition.java @@ -7,7 +7,8 @@ import org.luxons.sevenwonders.game.Settings; import org.luxons.sevenwonders.game.resources.ResourceType; import org.luxons.sevenwonders.game.wonders.WonderStage; -@SuppressWarnings("unused,MismatchedQueryAndUpdateOfCollection") // the fields are injected by Gson +// the fields are injected by Gson +@SuppressWarnings("unused,MismatchedQueryAndUpdateOfCollection") class WonderSideDefinition { private ResourceType initialResource; diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java index c1a51f24..c0a75d80 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java @@ -21,11 +21,11 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese public JsonElement serialize(Effect effect, Type typeOfSrc, JsonSerializationContext context) { int value; if (MilitaryReinforcements.class.equals(typeOfSrc)) { - value = ((MilitaryReinforcements)effect).getCount(); + value = ((MilitaryReinforcements) effect).getCount(); } else if (GoldIncrease.class.equals(typeOfSrc)) { - value = ((GoldIncrease)effect).getAmount(); + value = ((GoldIncrease) effect).getAmount(); } else if (RawPointsIncrease.class.equals(typeOfSrc)) { - value = ((RawPointsIncrease)effect).getPoints(); + value = ((RawPointsIncrease) effect).getPoints(); } else { throw new IllegalArgumentException("Unknown numeric effect " + typeOfSrc.getTypeName()); } @@ -33,8 +33,8 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese } @Override - public Effect deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public Effect deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { int value = json.getAsInt(); if (MilitaryReinforcements.class.equals(typeOfT)) { return new MilitaryReinforcements(value); @@ -45,4 +45,4 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese } throw new IllegalArgumentException("Unknown numeric effet " + typeOfT.getTypeName()); } -}
\ No newline at end of file +} diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java index b1467900..c3eb1386 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.java @@ -13,8 +13,8 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -public class ProductionIncreaseSerializer - implements JsonSerializer<ProductionIncrease>, JsonDeserializer<ProductionIncrease> { +public class ProductionIncreaseSerializer implements JsonSerializer<ProductionIncrease>, + JsonDeserializer<ProductionIncrease> { @Override public JsonElement serialize(ProductionIncrease productionIncrease, Type typeOfSrc, diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java index eead39c3..3fa6b720 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.java @@ -39,10 +39,11 @@ public class ProductionSerializer implements JsonSerializer<Production>, JsonDes if (choices.size() > 1) { throw new IllegalArgumentException("Cannot serialize a production with more than one choice"); } - String str = choices.get(0).stream() - .map(ResourceType::getSymbol) - .map(Object::toString) - .collect(Collectors.joining("/")); + String str = choices.get(0) + .stream() + .map(ResourceType::getSymbol) + .map(Object::toString) + .collect(Collectors.joining("/")); return context.serialize(str); } @@ -51,8 +52,8 @@ public class ProductionSerializer implements JsonSerializer<Production>, JsonDes } @Override - public Production deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public Production deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String resourcesStr = json.getAsString(); Production production = new Production(); if (resourcesStr.contains("/")) { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java index 145063eb..d2a49180 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.java @@ -2,6 +2,8 @@ package org.luxons.sevenwonders.game.data.serializers; import java.lang.reflect.Type; +import org.luxons.sevenwonders.game.resources.ResourceType; + import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -9,7 +11,6 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.luxons.sevenwonders.game.resources.ResourceType; public class ResourceTypeSerializer implements JsonSerializer<ResourceType>, JsonDeserializer<ResourceType> { @@ -19,8 +20,8 @@ public class ResourceTypeSerializer implements JsonSerializer<ResourceType>, Jso } @Override - public ResourceType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public ResourceType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String str = json.getAsString(); if (str.isEmpty()) { throw new IllegalArgumentException("Empty string is not a valid resource type"); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java index 8aca5561..89d3e723 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.java @@ -5,6 +5,8 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import org.luxons.sevenwonders.game.resources.ResourceType; + import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -12,22 +14,19 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.luxons.sevenwonders.game.resources.ResourceType; -public class ResourceTypesSerializer implements JsonSerializer<List<ResourceType>>, JsonDeserializer<List<ResourceType>> { +public class ResourceTypesSerializer implements JsonSerializer<List<ResourceType>>, + JsonDeserializer<List<ResourceType>> { @Override public JsonElement serialize(List<ResourceType> resources, Type typeOfSrc, JsonSerializationContext context) { - String s = resources.stream() - .map(ResourceType::getSymbol) - .map(Object::toString) - .collect(Collectors.joining()); + String s = resources.stream().map(ResourceType::getSymbol).map(Object::toString).collect(Collectors.joining()); return new JsonPrimitive(s); } @Override - public List<ResourceType> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public List<ResourceType> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String s = json.getAsString(); List<ResourceType> resources = new ArrayList<>(); for (char c : s.toCharArray()) { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java index efeafd15..fb6c4e4b 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.java @@ -4,6 +4,9 @@ import java.lang.reflect.Type; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.luxons.sevenwonders.game.resources.ResourceType; +import org.luxons.sevenwonders.game.resources.Resources; + import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -12,8 +15,6 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.luxons.sevenwonders.game.resources.ResourceType; -import org.luxons.sevenwonders.game.resources.Resources; public class ResourcesSerializer implements JsonSerializer<Resources>, JsonDeserializer<Resources> { @@ -29,8 +30,8 @@ public class ResourcesSerializer implements JsonSerializer<Resources>, JsonDeser } @Override - public Resources deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public Resources deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String s = json.getAsString(); Resources resources = new Resources(); for (char c : s.toCharArray()) { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java index b6e38540..cecad405 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/data/serializers/ScienceProgressSerializer.java @@ -40,8 +40,8 @@ public class ScienceProgressSerializer implements JsonSerializer<ScienceProgress } @Override - public ScienceProgress deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws - JsonParseException { + public ScienceProgress deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { String s = json.getAsString(); ScienceProgress scienceProgress = new ScienceProgress(); Science science = new Science(); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java index 3a44574b..976ebf35 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/Discount.java @@ -5,8 +5,8 @@ import java.util.List; import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.resources.Provider; -import org.luxons.sevenwonders.game.resources.TradingRules; import org.luxons.sevenwonders.game.resources.ResourceType; +import org.luxons.sevenwonders.game.resources.TradingRules; public class Discount extends InstantOwnBoardEffect { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java index 79e7bd1a..1519e389 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/GoldIncrease.java @@ -29,7 +29,7 @@ public class GoldIncrease extends InstantOwnBoardEffect { if (o == null || getClass() != o.getClass()) { return false; } - GoldIncrease that = (GoldIncrease)o; + GoldIncrease that = (GoldIncrease) o; return amount == that.amount; } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java index b08e2f59..3accdd62 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/MilitaryReinforcements.java @@ -29,7 +29,7 @@ public class MilitaryReinforcements extends InstantOwnBoardEffect { if (o == null || getClass() != o.getClass()) { return false; } - MilitaryReinforcements that = (MilitaryReinforcements)o; + MilitaryReinforcements that = (MilitaryReinforcements) o; return count == that.count; } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java index 30bcc625..514c65db 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java @@ -43,7 +43,7 @@ public class ProductionIncrease extends InstantOwnBoardEffect { if (o == null || getClass() != o.getClass()) { return false; } - ProductionIncrease that = (ProductionIncrease)o; + ProductionIncrease that = (ProductionIncrease) o; return Objects.equals(production, that.production); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java index 0d117cec..fce8fa3e 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/RawPointsIncrease.java @@ -29,7 +29,7 @@ public class RawPointsIncrease extends EndGameEffect { if (o == null || getClass() != o.getClass()) { return false; } - RawPointsIncrease that = (RawPointsIncrease)o; + RawPointsIncrease that = (RawPointsIncrease) o; return points == that.points; } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java b/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java index 5de87784..cdf67f20 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAbility.java @@ -5,6 +5,7 @@ import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.cards.Card; public enum SpecialAbility { + /** * The player can play the last card of each age instead of discarding it. This card can be played by paying its * cost, discarded to gain 3 coins or used in the construction of his or her Wonder. @@ -22,7 +23,7 @@ public enum SpecialAbility { PLAY_DISCARDED, /** - * The player can, at the end of the game, “copy” a Guild of his or her choice (purple card), built by one of his or + * The player can, at the end of the game, "copy" a Guild of his or her choice (purple card), built by one of his or * her two neighboring cities. */ COPY_GUILD { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java index b7701c27..ea824277 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Production.java @@ -79,7 +79,8 @@ public class Production { return false; } - private static Set<ResourceType> findFirstAlternativeContaining(List<Set<ResourceType>> alternatives, ResourceType type) { + private static Set<ResourceType> findFirstAlternativeContaining(List<Set<ResourceType>> alternatives, + ResourceType type) { return alternatives.stream().filter(a -> a.contains(type)).findAny().orElse(null); } @@ -91,7 +92,7 @@ public class Production { if (o == null || getClass() != o.getClass()) { return false; } - Production that = (Production)o; + Production that = (Production) o; return Objects.equals(fixedResources, that.fixedResources) && Objects.equals(alternativeResources, that.alternativeResources); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java b/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java index 46d60123..baad8451 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/resources/ResourceType.java @@ -13,6 +13,7 @@ public enum ResourceType { LOOM('L'); private static final Map<Character, ResourceType> typesPerSymbol = new HashMap<>(7); + static { for (ResourceType type : values()) { typesPerSymbol.put(type.symbol, type); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java index 5bf6f269..f74ae994 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java @@ -54,7 +54,7 @@ public class Resources { if (o == null || getClass() != o.getClass()) { return false; } - Resources resources = (Resources)o; + Resources resources = (Resources) o; return Objects.equals(quantities, resources.quantities); } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java index 26b5f8ba..e7cdaedd 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreBoard.java @@ -6,7 +6,7 @@ import java.util.PriorityQueue; public class ScoreBoard { private static final Comparator<PlayerScore> comparator = Comparator.comparing(PlayerScore::getTotalPoints) - .thenComparing(PlayerScore::getBoardGold); + .thenComparing(PlayerScore::getBoardGold); private PriorityQueue<PlayerScore> scores; diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java index 54976072..a6a9537d 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java @@ -1,5 +1,11 @@ package org.luxons.sevenwonders.game.scoring; public enum ScoreCategory { - CIVIL, SCIENCE, MILITARY, TRADE, GUILD, WONDER, GOLD + CIVIL, + SCIENCE, + MILITARY, + TRADE, + GUILD, + WONDER, + GOLD } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java index 3ddddd30..73fff305 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/Wonder.java @@ -52,7 +52,7 @@ public class Wonder { } public int getNbBuiltStages() { - return (int)stages.stream().filter(WonderStage::isBuilt).count(); + return (int) stages.stream().filter(WonderStage::isBuilt).count(); } public String getImage() { @@ -94,9 +94,9 @@ public class Wonder { public int computePoints(Table table, int playerIndex) { return stages.stream() - .filter(WonderStage::isBuilt) - .flatMap(c -> c.getEffects().stream()) - .mapToInt(e -> e.computePoints(table, playerIndex)) - .sum(); + .filter(WonderStage::isBuilt) + .flatMap(c -> c.getEffects().stream()) + .mapToInt(e -> e.computePoints(table, playerIndex)) + .sum(); } } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java index 64d506fc..fc3fc573 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/wonders/WonderStage.java @@ -2,11 +2,11 @@ package org.luxons.sevenwonders.game.wonders; import java.util.List; -import org.luxons.sevenwonders.game.resources.BoughtResources; import org.luxons.sevenwonders.game.api.Table; import org.luxons.sevenwonders.game.cards.CardBack; import org.luxons.sevenwonders.game.cards.Requirements; import org.luxons.sevenwonders.game.effects.Effect; +import org.luxons.sevenwonders.game.resources.BoughtResources; public class WonderStage { diff --git a/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java b/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java index 6698c476..c0ac6282 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java +++ b/backend/src/main/java/org/luxons/sevenwonders/lobby/Player.java @@ -1,8 +1,9 @@ package org.luxons.sevenwonders.lobby; -import com.fasterxml.jackson.annotation.JsonIgnore; import org.luxons.sevenwonders.game.Game; +import com.fasterxml.jackson.annotation.JsonIgnore; + public class Player { private final String username; diff --git a/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java b/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java index ac696890..5a122274 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java +++ b/backend/src/main/java/org/luxons/sevenwonders/output/PreparedCard.java @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.output; -import org.luxons.sevenwonders.lobby.Player; import org.luxons.sevenwonders.game.cards.CardBack; +import org.luxons.sevenwonders.lobby.Player; public class PreparedCard { diff --git a/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java b/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java index 0a7b9238..eb573479 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java +++ b/backend/src/main/java/org/luxons/sevenwonders/repositories/LobbyRepository.java @@ -4,9 +4,9 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.luxons.sevenwonders.lobby.Lobby; import org.luxons.sevenwonders.lobby.Player; -import org.luxons.sevenwonders.game.data.GameDefinitionLoader; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; |