From a17ccaa2260c6f8571acd9618083f432d4bb65ae Mon Sep 17 00:00:00 2001 From: FlavianIuga <121820069+FlavianIuga@users.noreply.github.com> Date: Wed, 25 Jan 2023 14:19:54 +0200 Subject: [PATCH 1/4] Reordering modifiers - code cleanup --- .../gui/animation/UnitImageAnimation.java | 2 +- src/net/sf/freecol/common/i18n/NameCache.java | 2 +- src/net/sf/freecol/common/model/Building.java | 2 +- .../sf/freecol/common/model/Direction.java | 2 +- src/net/sf/freecol/common/model/Map.java | 2 +- .../sf/freecol/common/model/ModelMessage.java | 2 +- .../common/model/mission/CompoundMission.java | 2 +- .../BuildingProductionCalculator.java | 2 +- .../sf/freecol/common/networking/Message.java | 34 +++++++++---------- src/net/sf/freecol/common/util/OSUtils.java | 4 +-- .../tools/ColonizationSaveGameReader.java | 6 ++-- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/net/sf/freecol/client/gui/animation/UnitImageAnimation.java b/src/net/sf/freecol/client/gui/animation/UnitImageAnimation.java index 143df4dfae..24477fb695 100644 --- a/src/net/sf/freecol/client/gui/animation/UnitImageAnimation.java +++ b/src/net/sf/freecol/client/gui/animation/UnitImageAnimation.java @@ -96,7 +96,7 @@ public void setMirrored(boolean mirror) { * @param direction The preferred {@code Direction}. * @return A list of {@code Direction}s. */ - private synchronized static List trialDirections(Direction direction) { + private static synchronized List trialDirections(Direction direction) { if (alternatives.isEmpty()) { // Populate first time // Favour the closest E-W cases for (Direction d : Direction.allDirections) { diff --git a/src/net/sf/freecol/common/i18n/NameCache.java b/src/net/sf/freecol/common/i18n/NameCache.java index b2f59ff68f..fe58c23bbd 100644 --- a/src/net/sf/freecol/common/i18n/NameCache.java +++ b/src/net/sf/freecol/common/i18n/NameCache.java @@ -55,7 +55,7 @@ public class NameCache { private static final String[] DEFAULT_SEASON_IDS = { "model.season.spring.name", "model.season.autumn.name" }; - private final static String CIBOLA_PREFIX + private static final String CIBOLA_PREFIX = "nameCache.lostCityRumour.cityName."; /** Cities of Cibola. */ diff --git a/src/net/sf/freecol/common/model/Building.java b/src/net/sf/freecol/common/model/Building.java index ecab91aa65..657e7c4a0a 100644 --- a/src/net/sf/freecol/common/model/Building.java +++ b/src/net/sf/freecol/common/model/Building.java @@ -50,7 +50,7 @@ public class Building extends WorkLocation @SuppressWarnings("unused") private static final Logger logger = Logger.getLogger(Building.class.getName()); - private final static double EPSILON = 0.0001; + private static final double EPSILON = 0.0001; public static final String TAG = "building"; diff --git a/src/net/sf/freecol/common/model/Direction.java b/src/net/sf/freecol/common/model/Direction.java index 7efbc00744..8d33f227da 100644 --- a/src/net/sf/freecol/common/model/Direction.java +++ b/src/net/sf/freecol/common/model/Direction.java @@ -44,7 +44,7 @@ public enum Direction implements Named { W (-1, 0, -1, 0), NW ( 0, -1, -1, -1); - public final static int NUMBER_OF_DIRECTIONS = values().length; + public static final int NUMBER_OF_DIRECTIONS = values().length; public static final List allDirections = makeUnmodifiableList(Direction.N, Direction.NE, diff --git a/src/net/sf/freecol/common/model/Map.java b/src/net/sf/freecol/common/model/Map.java index c3638ec091..633b2667b7 100644 --- a/src/net/sf/freecol/common/model/Map.java +++ b/src/net/sf/freecol/common/model/Map.java @@ -90,7 +90,7 @@ private static enum MoveStep { FAIL, BYLAND, BYWATER, EMBARK, DISEMBARK }; * The number of tiles from the upper edge that are considered * polar by default. */ - public final static int POLAR_HEIGHT = 2; + public static final int POLAR_HEIGHT = 2; /** * The layers included in the map. The RIVERS layer includes all diff --git a/src/net/sf/freecol/common/model/ModelMessage.java b/src/net/sf/freecol/common/model/ModelMessage.java index fbf113d79b..6b44ce1085 100644 --- a/src/net/sf/freecol/common/model/ModelMessage.java +++ b/src/net/sf/freecol/common/model/ModelMessage.java @@ -284,7 +284,7 @@ public ModelMessage addDefaultId(String id) { * @param source The source object * @return An object to be displayed for the message. */ - static private FreeColObject getDefaultDisplay(MessageType messageType, + private static FreeColObject getDefaultDisplay(MessageType messageType, FreeColGameObject source) { FreeColObject o = null; switch (messageType) { diff --git a/src/net/sf/freecol/common/model/mission/CompoundMission.java b/src/net/sf/freecol/common/model/mission/CompoundMission.java index 4d41077bbd..49ec9e0178 100644 --- a/src/net/sf/freecol/common/model/mission/CompoundMission.java +++ b/src/net/sf/freecol/common/model/mission/CompoundMission.java @@ -154,7 +154,7 @@ public MissionState doMission() { // Serialization. - private final static String INDEX_TAG = "index"; + private static final String INDEX_TAG = "index"; /** diff --git a/src/net/sf/freecol/common/model/production/BuildingProductionCalculator.java b/src/net/sf/freecol/common/model/production/BuildingProductionCalculator.java index fadd5ce02d..1e2ea1a034 100644 --- a/src/net/sf/freecol/common/model/production/BuildingProductionCalculator.java +++ b/src/net/sf/freecol/common/model/production/BuildingProductionCalculator.java @@ -56,7 +56,7 @@ * Calculates the production for a building of a given type. */ public class BuildingProductionCalculator { - private final static double EPSILON = 0.0001; + private static final double EPSILON = 0.0001; private Player owner; diff --git a/src/net/sf/freecol/common/networking/Message.java b/src/net/sf/freecol/common/networking/Message.java index 8b18648cbf..e4e6dfce83 100644 --- a/src/net/sf/freecol/common/networking/Message.java +++ b/src/net/sf/freecol/common/networking/Message.java @@ -60,7 +60,7 @@ public abstract class Message { * A map of message name to message constructors, built on the fly * as new messages are encountered and suitable constructors found. */ - private final static Map> builders + private static final Map> builders = Collections.synchronizedMap(new HashMap>()); @@ -114,14 +114,14 @@ protected Message() { * * @return The message tag. */ - abstract public String getType(); + public abstract String getType(); /** * Set the message tag. * * @param type The new message tag. */ - abstract protected void setType(String type); + protected abstract void setType(String type); /** * Checks if an attribute is present in this message. @@ -129,7 +129,7 @@ protected Message() { * @param key The attribute to look for. * @return True if the attribute is present. */ - abstract protected boolean hasAttribute(String key); + protected abstract boolean hasAttribute(String key); /** * Get a string attribute value. @@ -137,7 +137,7 @@ protected Message() { * @param key The attribute to look for. * @return The string value found, or null if the attribute was absent. */ - abstract protected String getStringAttribute(String key); + protected abstract String getStringAttribute(String key); /** * Sets an attribute in this message. @@ -145,35 +145,35 @@ protected Message() { * @param key The attribute to set. * @param value The new value of the attribute. */ - abstract protected void setStringAttribute(String key, String value); + protected abstract void setStringAttribute(String key, String value); /** * Get a map of all the attributes in this message. * * @return A {@code Map} of the attributes. */ - abstract protected Map getStringAttributeMap(); + protected abstract Map getStringAttributeMap(); /** * Get the number of child objects. * * @return The child count. */ - abstract protected int getChildCount(); + protected abstract int getChildCount(); /** * Get the child objects of this message. * * @return A list of child {@code FreeColObject}s. */ - abstract protected List getChildren(); + protected abstract List getChildren(); /** * Set the list of objects attached to this message. * * @param fcos The new list of attached {@code FreeColObject}s. */ - abstract protected void setChildren(List fcos); + protected abstract void setChildren(List fcos); /** * Append a new child. @@ -181,7 +181,7 @@ protected Message() { * @param The child type. * @param fco The new child object. */ - abstract protected void appendChild(T fco); + protected abstract void appendChild(T fco); /** * Append a multiple new children. @@ -189,21 +189,21 @@ protected Message() { * @param The child type. * @param fcos The new child objects. */ - abstract protected void appendChildren(Collection fcos); + protected abstract void appendChildren(Collection fcos); /** * Should this message only be sent to a server by the current player? * * @return True if this is a current-player-only message. */ - abstract public boolean currentPlayerMessage(); + public abstract boolean currentPlayerMessage(); /** * Get the priority of this type of message. * * @return The message priority. */ - abstract public MessagePriority getPriority(); + public abstract MessagePriority getPriority(); /** @@ -225,7 +225,7 @@ public boolean canMerge() { * @param aiPlayer The {@code AIPlayer} the message was sent to. * @exception FreeColException if there is a problem handling the message. */ - abstract public void aiHandler(FreeColServer freeColServer, + public abstract void aiHandler(FreeColServer freeColServer, AIPlayer aiPlayer) throws FreeColException; /** @@ -236,7 +236,7 @@ abstract public void aiHandler(FreeColServer freeColServer, * @param freeColClient The {@code FreeColClient} to handle this message. * @exception FreeColException if there is a problem building the message. */ - abstract public void clientHandler(FreeColClient freeColClient) + public abstract void clientHandler(FreeColClient freeColClient) throws FreeColException; /** @@ -246,7 +246,7 @@ abstract public void clientHandler(FreeColClient freeColClient) * @param serverPlayer The {@code ServerPlayer} that sent the request. * @return A {@code ChangeSet} defining the response. */ - abstract public ChangeSet serverHandler(FreeColServer freeColServer, + public abstract ChangeSet serverHandler(FreeColServer freeColServer, ServerPlayer serverPlayer); diff --git a/src/net/sf/freecol/common/util/OSUtils.java b/src/net/sf/freecol/common/util/OSUtils.java index 652aefbea9..99bf10aa77 100644 --- a/src/net/sf/freecol/common/util/OSUtils.java +++ b/src/net/sf/freecol/common/util/OSUtils.java @@ -76,7 +76,7 @@ public static boolean onWindows() { * * @param url The URL to launch */ - final public static void launchBrowser(String url) { + public static final void launchBrowser(String url) { // Use Desktop Class first try { URI uri = java.net.URI.create(url); @@ -104,7 +104,7 @@ final public static void launchBrowser(String url) { * * @see #launchBrowser(String) */ - final private static String[] getBrowserExecString(String url) { + private static final String[] getBrowserExecString(String url) { if (onMacOSX()) { // Apple Macintosh, Safari is the main browser return new String[] { "open" , "-a", "Safari", url }; diff --git a/src/net/sf/freecol/tools/ColonizationSaveGameReader.java b/src/net/sf/freecol/tools/ColonizationSaveGameReader.java index 7bba68a324..4d73add95e 100644 --- a/src/net/sf/freecol/tools/ColonizationSaveGameReader.java +++ b/src/net/sf/freecol/tools/ColonizationSaveGameReader.java @@ -27,9 +27,9 @@ public class ColonizationSaveGameReader { - private final static int PLAYER_DATA = 0x9e; - private final static int COLONY_DATA = 0x186; - private final static String[] NATIONS = { + private static final int PLAYER_DATA = 0x9e; + private static final int COLONY_DATA = 0x186; + private static final String[] NATIONS = { "English", "French", "Spanish", "Dutch" }; From 44724605f8cfec5f7de479f12784696ea7a3369b Mon Sep 17 00:00:00 2001 From: FlavianIuga <121820069+FlavianIuga@users.noreply.github.com> Date: Wed, 25 Jan 2023 14:23:03 +0200 Subject: [PATCH 2/4] Move array indicators on type declaration - code cleanup --- src/net/sf/freecol/client/gui/GUI.java | 2 +- src/net/sf/freecol/client/gui/plaf/FreeColLookAndFeel.java | 2 +- src/net/sf/freecol/common/model/Specification.java | 2 +- test/src/net/sf/freecol/common/model/BuildingTest.java | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/net/sf/freecol/client/gui/GUI.java b/src/net/sf/freecol/client/gui/GUI.java index 40e23e6263..27ffed535c 100644 --- a/src/net/sf/freecol/client/gui/GUI.java +++ b/src/net/sf/freecol/client/gui/GUI.java @@ -112,7 +112,7 @@ public enum ViewMode { }; /** Levels (danger, finance) for confirmEuropeanTribute(). */ - private static final String levels[] = { "low", "normal", "high" }; + private static final String[] levels = { "low", "normal", "high" }; /** diff --git a/src/net/sf/freecol/client/gui/plaf/FreeColLookAndFeel.java b/src/net/sf/freecol/client/gui/plaf/FreeColLookAndFeel.java index 6341bcd84d..2a68b20f1d 100644 --- a/src/net/sf/freecol/client/gui/plaf/FreeColLookAndFeel.java +++ b/src/net/sf/freecol/client/gui/plaf/FreeColLookAndFeel.java @@ -112,7 +112,7 @@ public ColorUIResource getMenuDisabledForeground() { private static final String transparentPanelUI = "net.sf.freecol.client.gui.plaf.FreeColTransparentPanelUI"; - private static final Class uiClasses[] = { + private static final Class[] uiClasses = { FreeColButtonUI.class, FreeColCheckBoxUI.class, FreeColComboBoxUI.class, diff --git a/src/net/sf/freecol/common/model/Specification.java b/src/net/sf/freecol/common/model/Specification.java index 70f02afe79..03ec160492 100644 --- a/src/net/sf/freecol/common/model/Specification.java +++ b/src/net/sf/freecol/common/model/Specification.java @@ -781,7 +781,7 @@ public void clean(String why) { String agesValue = ""; if (!badAges) { agesValue = getText(GameOptions.AGES); - String a[] = agesValue.split(","); + String[] a = agesValue.split(","); badAges = a.length != NUMBER_OF_AGES-1; if (!badAges) { try { diff --git a/test/src/net/sf/freecol/common/model/BuildingTest.java b/test/src/net/sf/freecol/common/model/BuildingTest.java index 6053df9b63..85af9c9fab 100644 --- a/test/src/net/sf/freecol/common/model/BuildingTest.java +++ b/test/src/net/sf/freecol/common/model/BuildingTest.java @@ -1022,7 +1022,7 @@ public void testUnitProduction() { } // Lumber and cross production data contributed by Lone_Wolf in BR#2981. - private static int lumberProd[][][] = { + private static int[][][] lumberProd = { { // carpenterHouse { 0, 0, 0, 1, 4 }, // -2 { 0, 0, 1, 2, 5 }, // -1 @@ -1045,7 +1045,7 @@ public void testLumberProduction() { // Cross production is very like lumber production, with the addition of // the unattended production. - private static int crossProd[][][] = { + private static int[][][] crossProd = { { // church { 2, 2, 2, 3, 6 }, // -2 { 2, 2, 3, 4, 7 }, // -1 @@ -1067,7 +1067,7 @@ public void testCrossProduction() { } // Factory production data contributed by Lone_Wolf in BR#2979. - private static int factoryProd[][][] = { + private static int[][][] factoryProd = { { // house { 0, 0, 0, 1, 2 }, // -2 { 0, 0, 1, 2, 4 }, // -1 From 4db447e9e66fb7aa5223d44e15588263697fdb09 Mon Sep 17 00:00:00 2001 From: FlavianIuga <121820069+FlavianIuga@users.noreply.github.com> Date: Wed, 25 Jan 2023 14:56:52 +0200 Subject: [PATCH 3/4] Removed unnecessary modifiers - code cleanup --- .../client/control/InGameController.java | 2 +- .../sf/freecol/client/gui/FontLibrary.java | 2 +- src/net/sf/freecol/client/gui/SwingGUI.java | 2 +- .../client/gui/action/ColopediaAction.java | 2 +- .../gui/action/DisplayTileTextAction.java | 2 +- .../client/gui/animation/Animations.java | 2 +- .../client/gui/dialog/FreeColDialog.java | 2 +- .../freecol/client/gui/label/CargoLabel.java | 4 +- .../freecol/client/gui/label/Draggable.java | 2 +- .../client/gui/mapviewer/MapViewer.java | 2 +- .../client/gui/option/OptionUpdater.java | 4 +- .../freecol/client/gui/panel/DropTarget.java | 10 ++-- .../freecol/client/gui/panel/EuropePanel.java | 2 +- .../client/gui/panel/FindSettlementPanel.java | 2 +- .../freecol/client/gui/panel/InfoPanel.java | 2 +- .../sf/freecol/client/gui/panel/NewPanel.java | 2 +- .../panel/colopedia/ColopediaDetailPanel.java | 4 +- .../report/ReportCompactColonyPanel.java | 2 +- .../client/gui/video/VideoListener.java | 2 +- src/net/sf/freecol/common/ObjectWithId.java | 2 +- .../freecol/common/debug/FreeColDebugger.java | 2 +- src/net/sf/freecol/common/i18n/Selector.java | 2 +- .../freecol/common/io/FreeColXMLReader.java | 2 +- .../freecol/common/io/FreeColXMLWriter.java | 2 +- .../common/io/sza/ImageAnimationEvent.java | 4 +- .../common/metaserver/MetaServerUtils.java | 2 +- .../freecol/common/model/BaseProduction.java | 4 +- src/net/sf/freecol/common/model/Colony.java | 4 +- .../sf/freecol/common/model/CombatModel.java | 2 +- .../sf/freecol/common/model/Constants.java | 28 +++++------ src/net/sf/freecol/common/model/Consumer.java | 16 +++---- .../freecol/common/model/DiplomaticTrade.java | 4 +- src/net/sf/freecol/common/model/Disaster.java | 2 +- src/net/sf/freecol/common/model/Europe.java | 2 +- .../freecol/common/model/FoundingFather.java | 2 +- .../model/FreeColGameObjectListener.java | 6 +-- src/net/sf/freecol/common/model/Game.java | 4 +- .../sf/freecol/common/model/HighScore.java | 2 +- .../sf/freecol/common/model/HistoryEvent.java | 2 +- .../common/model/IndianSettlement.java | 2 +- src/net/sf/freecol/common/model/Limit.java | 2 +- .../sf/freecol/common/model/Locatable.java | 10 ++-- src/net/sf/freecol/common/model/Location.java | 48 +++++++++---------- .../freecol/common/model/LostCityRumour.java | 2 +- src/net/sf/freecol/common/model/Map.java | 4 +- src/net/sf/freecol/common/model/Market.java | 2 +- .../sf/freecol/common/model/ModelMessage.java | 2 +- src/net/sf/freecol/common/model/Modifier.java | 2 +- src/net/sf/freecol/common/model/Monarch.java | 2 +- src/net/sf/freecol/common/model/Movable.java | 4 +- src/net/sf/freecol/common/model/Nameable.java | 4 +- src/net/sf/freecol/common/model/Named.java | 2 +- .../freecol/common/model/NationOptions.java | 4 +- .../sf/freecol/common/model/NationType.java | 4 +- .../sf/freecol/common/model/NativeTrade.java | 2 +- src/net/sf/freecol/common/model/Operand.java | 4 +- src/net/sf/freecol/common/model/Ownable.java | 4 +- src/net/sf/freecol/common/model/Player.java | 8 ++-- src/net/sf/freecol/common/model/Region.java | 2 +- .../freecol/common/model/Specification.java | 2 +- .../freecol/common/model/StringTemplate.java | 2 +- src/net/sf/freecol/common/model/Tension.java | 2 +- src/net/sf/freecol/common/model/TileType.java | 2 +- .../freecol/common/model/TradeLocation.java | 12 ++--- .../common/model/TransactionListener.java | 4 +- src/net/sf/freecol/common/model/Unit.java | 8 ++-- .../sf/freecol/common/model/UnitLocation.java | 2 +- .../freecol/common/model/mission/Mission.java | 10 ++-- .../common/model/pathfinding/CostDecider.java | 10 ++-- .../common/model/pathfinding/GoalDecider.java | 6 +-- .../sf/freecol/common/networking/Message.java | 2 +- .../common/networking/MessageHandler.java | 4 +- src/net/sf/freecol/common/option/Option.java | 18 +++---- .../common/option/OptionContainer.java | 4 +- .../freecol/common/option/UnitTypeOption.java | 2 +- src/net/sf/freecol/server/FreeColServer.java | 2 +- src/net/sf/freecol/server/ai/Cargo.java | 2 +- src/net/sf/freecol/server/ai/ColonyPlan.java | 2 +- .../server/ai/mission/TransportMission.java | 2 +- .../server/generator/MapLayerGenerator.java | 4 +- .../freecol/server/generator/MapLoader.java | 4 +- .../sf/freecol/server/generator/River.java | 2 +- .../sf/freecol/server/model/ServerPlayer.java | 2 +- .../sf/freecol/server/model/TurnTaker.java | 2 +- 84 files changed, 186 insertions(+), 186 deletions(-) diff --git a/src/net/sf/freecol/client/control/InGameController.java b/src/net/sf/freecol/client/control/InGameController.java index 1d08f32334..ab01ab35c4 100644 --- a/src/net/sf/freecol/client/control/InGameController.java +++ b/src/net/sf/freecol/client/control/InGameController.java @@ -149,7 +149,7 @@ public final class InGameController extends FreeColClientHolder { * Selecting next unit depends on mode--- either from the active list, * from the going-to list, or flush going-to and end the turn. */ - private static enum MoveMode { + private enum MoveMode { NEXT_ACTIVE_UNIT, EXECUTE_GOTO_ORDERS, END_TURN; diff --git a/src/net/sf/freecol/client/gui/FontLibrary.java b/src/net/sf/freecol/client/gui/FontLibrary.java index d2f143ae20..5813520fe7 100644 --- a/src/net/sf/freecol/client/gui/FontLibrary.java +++ b/src/net/sf/freecol/client/gui/FontLibrary.java @@ -54,7 +54,7 @@ public class FontLibrary { *
  • HEADER -- a stylized old-fashioned typeface for headers
  • * */ - public static enum FontType { + public enum FontType { NORMAL, SIMPLE, HEADER diff --git a/src/net/sf/freecol/client/gui/SwingGUI.java b/src/net/sf/freecol/client/gui/SwingGUI.java index ecf21cb0ac..9ce8086d68 100644 --- a/src/net/sf/freecol/client/gui/SwingGUI.java +++ b/src/net/sf/freecol/client/gui/SwingGUI.java @@ -129,7 +129,7 @@ public class SwingGUI extends GUI { /** A rough position to place dialogs and panels on the canvas. */ - public static enum PopupPosition { + public enum PopupPosition { ORIGIN, CENTERED, CENTERED_LEFT, diff --git a/src/net/sf/freecol/client/gui/action/ColopediaAction.java b/src/net/sf/freecol/client/gui/action/ColopediaAction.java index d448c9a731..44312b5bee 100644 --- a/src/net/sf/freecol/client/gui/action/ColopediaAction.java +++ b/src/net/sf/freecol/client/gui/action/ColopediaAction.java @@ -34,7 +34,7 @@ public class ColopediaAction extends FreeColAction { public static final String id = "colopediaAction."; // Order of elements will influence ingame order of menu items. - public static enum PanelType { + public enum PanelType { TERRAIN, RESOURCES, GOODS, UNITS, BUILDINGS, FATHERS, NATIONS, NATION_TYPES, CONCEPTS; diff --git a/src/net/sf/freecol/client/gui/action/DisplayTileTextAction.java b/src/net/sf/freecol/client/gui/action/DisplayTileTextAction.java index 10e94454c4..189b5b5d6a 100644 --- a/src/net/sf/freecol/client/gui/action/DisplayTileTextAction.java +++ b/src/net/sf/freecol/client/gui/action/DisplayTileTextAction.java @@ -39,7 +39,7 @@ public final class DisplayTileTextAction extends SelectableAction { public static final String id = "displayTileTextAction."; // FIXME: make ClientOptions use enum - public static enum DisplayText { + public enum DisplayText { EMPTY, NAMES, OWNERS, REGIONS; public String getKey() { diff --git a/src/net/sf/freecol/client/gui/animation/Animations.java b/src/net/sf/freecol/client/gui/animation/Animations.java index 51f2047149..2ec61fc85d 100644 --- a/src/net/sf/freecol/client/gui/animation/Animations.java +++ b/src/net/sf/freecol/client/gui/animation/Animations.java @@ -41,7 +41,7 @@ public class Animations { * used as a callback for an animation to trigger painting. */ public interface Procedure { - public void execute(); + void execute(); }; /** diff --git a/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java b/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java index c853a7b292..821dd681d0 100644 --- a/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java +++ b/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java @@ -69,7 +69,7 @@ public class FreeColDialog extends JDialog implements PropertyChangeListener private static final Logger logger = Logger.getLogger(FreeColDialog.class.getName()); - public static enum DialogType { + public enum DialogType { PLAIN, QUESTION, }; diff --git a/src/net/sf/freecol/client/gui/label/CargoLabel.java b/src/net/sf/freecol/client/gui/label/CargoLabel.java index 3397bb11f5..2be2d2f846 100644 --- a/src/net/sf/freecol/client/gui/label/CargoLabel.java +++ b/src/net/sf/freecol/client/gui/label/CargoLabel.java @@ -38,7 +38,7 @@ public interface CargoLabel { * @param cargoPanel The CargoPanel to affect. * @return True if the component was added. */ - public boolean addCargo(Component comp, Unit carrier, CargoPanel cargoPanel); + boolean addCargo(Component comp, Unit carrier, CargoPanel cargoPanel); /** @@ -47,7 +47,7 @@ public interface CargoLabel { * @param comp The Component to remove. * @param cargoPanel The {@link CargoPanel} to affect. */ - public default void removeCargo(Component comp, CargoPanel cargoPanel) { + default void removeCargo(Component comp, CargoPanel cargoPanel) { cargoPanel.update(); } diff --git a/src/net/sf/freecol/client/gui/label/Draggable.java b/src/net/sf/freecol/client/gui/label/Draggable.java index 07824111ef..f740045c2b 100644 --- a/src/net/sf/freecol/client/gui/label/Draggable.java +++ b/src/net/sf/freecol/client/gui/label/Draggable.java @@ -27,5 +27,5 @@ public interface Draggable { * * @return True if the object is on a carrier. */ - public boolean isOnCarrier(); + boolean isOnCarrier(); } diff --git a/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java b/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java index 1acfc1350b..569d4c3ffd 100644 --- a/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java +++ b/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java @@ -97,7 +97,7 @@ public final class MapViewer extends FreeColClientHolder { private static final Logger logger = Logger.getLogger(MapViewer.class.getName()); - private static enum BorderType { COUNTRY, REGION } + private enum BorderType { COUNTRY, REGION } /** * Calculates what part of the {@link Map} is visible on screen. This includes handling diff --git a/src/net/sf/freecol/client/gui/option/OptionUpdater.java b/src/net/sf/freecol/client/gui/option/OptionUpdater.java index b9d4354df7..5e2435d45c 100644 --- a/src/net/sf/freecol/client/gui/option/OptionUpdater.java +++ b/src/net/sf/freecol/client/gui/option/OptionUpdater.java @@ -32,11 +32,11 @@ public interface OptionUpdater { * Updates the value of the {@link net.sf.freecol.common.option.Option} * this object keeps. */ - public void updateOption(); + void updateOption(); /** * Reset with the value from the option. */ - public void reset(); + void reset(); } diff --git a/src/net/sf/freecol/client/gui/panel/DropTarget.java b/src/net/sf/freecol/client/gui/panel/DropTarget.java index bfd5425c1c..00b391e782 100644 --- a/src/net/sf/freecol/client/gui/panel/DropTarget.java +++ b/src/net/sf/freecol/client/gui/panel/DropTarget.java @@ -34,7 +34,7 @@ public interface DropTarget { * @param goods The {@code Goods} to check. * @return True if the goods are acceptable. */ - public default boolean accepts(Goods goods) { + default boolean accepts(Goods goods) { return false; } @@ -44,7 +44,7 @@ public default boolean accepts(Goods goods) { * @param goodsType The {@code GoodsType} to check. * @return True if the goods type is acceptable. */ - public default boolean accepts(GoodsType goodsType) { + default boolean accepts(GoodsType goodsType) { return false; } @@ -54,7 +54,7 @@ public default boolean accepts(GoodsType goodsType) { * @param unit The {@code Unit} to check. * @return True if the unit is acceptable. */ - public default boolean accepts(Unit unit) { + default boolean accepts(Unit unit) { return false; } @@ -71,7 +71,7 @@ public default boolean accepts(Unit unit) { * currently selected carrier. * @return The component argument on success, null on failure. */ - public Component add(Component comp, boolean editState); + Component add(Component comp, boolean editState); /** * Get a suggested amount of goods to add, used when partial @@ -80,7 +80,7 @@ public default boolean accepts(Unit unit) { * @param goodsType The {@code GoodsType} proposed to add. * @return A good amount of goods to add. */ - public default int suggested(GoodsType goodsType) { + default int suggested(GoodsType goodsType) { return -1; // Not applicable } } diff --git a/src/net/sf/freecol/client/gui/panel/EuropePanel.java b/src/net/sf/freecol/client/gui/panel/EuropePanel.java index 979908ae81..5e19376be6 100644 --- a/src/net/sf/freecol/client/gui/panel/EuropePanel.java +++ b/src/net/sf/freecol/client/gui/panel/EuropePanel.java @@ -592,7 +592,7 @@ public void logSale(GoodsType goodsType, int amount, } - public static enum EuropeAction { + public enum EuropeAction { EXIT, RECRUIT, PURCHASE, diff --git a/src/net/sf/freecol/client/gui/panel/FindSettlementPanel.java b/src/net/sf/freecol/client/gui/panel/FindSettlementPanel.java index 2970794472..b855883192 100644 --- a/src/net/sf/freecol/client/gui/panel/FindSettlementPanel.java +++ b/src/net/sf/freecol/client/gui/panel/FindSettlementPanel.java @@ -88,7 +88,7 @@ public void setLabelValues(JLabel label, Settlement value) { } } - private static enum DisplayListOption { + private enum DisplayListOption { ALL, ONLY_NATIVES, ONLY_EUROPEAN diff --git a/src/net/sf/freecol/client/gui/panel/InfoPanel.java b/src/net/sf/freecol/client/gui/panel/InfoPanel.java index e029df8836..2db70a4b02 100644 --- a/src/net/sf/freecol/client/gui/panel/InfoPanel.java +++ b/src/net/sf/freecol/client/gui/panel/InfoPanel.java @@ -71,7 +71,7 @@ public final class InfoPanel extends FreeColPanel private static final Logger logger = Logger.getLogger(InfoPanel.class.getName()); - private static enum InfoPanelMode { + private enum InfoPanelMode { NONE, END, MAP, TILE, UNIT; } diff --git a/src/net/sf/freecol/client/gui/panel/NewPanel.java b/src/net/sf/freecol/client/gui/panel/NewPanel.java index 96dbdf50f2..3f05802693 100644 --- a/src/net/sf/freecol/client/gui/panel/NewPanel.java +++ b/src/net/sf/freecol/client/gui/panel/NewPanel.java @@ -65,7 +65,7 @@ public final class NewPanel extends FreeColPanel implements ItemListener { private static final Logger logger = Logger.getLogger(NewPanel.class.getName()); /** The actions for this panel. */ - private static enum NewPanelAction { + private enum NewPanelAction { OK, CANCEL, SINGLE, diff --git a/src/net/sf/freecol/client/gui/panel/colopedia/ColopediaDetailPanel.java b/src/net/sf/freecol/client/gui/panel/colopedia/ColopediaDetailPanel.java index 5a65d25e04..504006ed35 100644 --- a/src/net/sf/freecol/client/gui/panel/colopedia/ColopediaDetailPanel.java +++ b/src/net/sf/freecol/client/gui/panel/colopedia/ColopediaDetailPanel.java @@ -35,7 +35,7 @@ public interface ColopediaDetailPanel { * * @param root a {@code DefaultMutableTreeNode} */ - public void addSubTrees(DefaultMutableTreeNode root); + void addSubTrees(DefaultMutableTreeNode root); /** * Builds the details panel for the given identifier. @@ -43,6 +43,6 @@ public interface ColopediaDetailPanel { * @param id The object identifier to display. * @param panel the detail panel to build */ - public void buildDetail(String id, JPanel panel); + void buildDetail(String id, JPanel panel); } diff --git a/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java b/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java index aa3868369f..1d3f716234 100644 --- a/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java +++ b/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java @@ -86,7 +86,7 @@ public final class ReportCompactColonyPanel extends ReportPanel { private static class ColonySummary { /** Types of production for a given goods type. */ - public static enum ProductionStatus { + public enum ProductionStatus { FAIL, // Negative production and below low alarm level BAD, // Negative production NONE, // No production at all diff --git a/src/net/sf/freecol/client/gui/video/VideoListener.java b/src/net/sf/freecol/client/gui/video/VideoListener.java index 8f5027c0b7..f1f23d1e90 100644 --- a/src/net/sf/freecol/client/gui/video/VideoListener.java +++ b/src/net/sf/freecol/client/gui/video/VideoListener.java @@ -27,5 +27,5 @@ public interface VideoListener { /** * Called when a playback has stopped. */ - public void stopped(); + void stopped(); } diff --git a/src/net/sf/freecol/common/ObjectWithId.java b/src/net/sf/freecol/common/ObjectWithId.java index 51c46199a5..a65b3e68f8 100644 --- a/src/net/sf/freecol/common/ObjectWithId.java +++ b/src/net/sf/freecol/common/ObjectWithId.java @@ -31,5 +31,5 @@ public interface ObjectWithId { * * @return The object identifier. */ - public String getId(); + String getId(); } diff --git a/src/net/sf/freecol/common/debug/FreeColDebugger.java b/src/net/sf/freecol/common/debug/FreeColDebugger.java index 39c5e9998d..cda4036cbc 100644 --- a/src/net/sf/freecol/common/debug/FreeColDebugger.java +++ b/src/net/sf/freecol/common/debug/FreeColDebugger.java @@ -49,7 +49,7 @@ public class FreeColDebugger { private static final Logger logger = Logger.getLogger(FreeColDebugger.class.getName()); /** The debug modes, any of which may be active. */ - public static enum DebugMode { + public enum DebugMode { COMMS, // Trace print full c-s communications, and verbose // (non-i18n) server errors. DESYNC,// Check frequently for desynchronization diff --git a/src/net/sf/freecol/common/i18n/Selector.java b/src/net/sf/freecol/common/i18n/Selector.java index 30aa2d3e09..c6164767a5 100644 --- a/src/net/sf/freecol/common/i18n/Selector.java +++ b/src/net/sf/freecol/common/i18n/Selector.java @@ -30,6 +30,6 @@ public interface Selector { * the selector (only used for error reporting) * @return a {@code String} value */ - public String getKey(String selector, String template); + String getKey(String selector, String template); } diff --git a/src/net/sf/freecol/common/io/FreeColXMLReader.java b/src/net/sf/freecol/common/io/FreeColXMLReader.java index 0547c0bda5..90f0aedc0e 100644 --- a/src/net/sf/freecol/common/io/FreeColXMLReader.java +++ b/src/net/sf/freecol/common/io/FreeColXMLReader.java @@ -90,7 +90,7 @@ public class FreeColXMLReader extends StreamReaderDelegate "ProcessingInstruction", "Space", "StartDocument", "StartElement" }); - public static enum ReadScope { + public enum ReadScope { SERVER, // Loading the game in the server NORMAL, // Normal interning read NOINTERN, // Do not intern any object that are read diff --git a/src/net/sf/freecol/common/io/FreeColXMLWriter.java b/src/net/sf/freecol/common/io/FreeColXMLWriter.java index 8926892302..badcadfea1 100644 --- a/src/net/sf/freecol/common/io/FreeColXMLWriter.java +++ b/src/net/sf/freecol/common/io/FreeColXMLWriter.java @@ -65,7 +65,7 @@ public class FreeColXMLWriter implements Closeable, XMLStreamWriter { private static final Logger logger = Logger.getLogger(FreeColXMLWriter.class.getName()); /** The scope of a FreeCol object write. */ - public static enum WriteScopeType { + public enum WriteScopeType { CLIENT, // Only the client-visible information SERVER, // Full server-visible information SAVE // Absolutely everything needed to save the game state diff --git a/src/net/sf/freecol/common/io/sza/ImageAnimationEvent.java b/src/net/sf/freecol/common/io/sza/ImageAnimationEvent.java index bf2006a394..fdd8c3f74e 100644 --- a/src/net/sf/freecol/common/io/sza/ImageAnimationEvent.java +++ b/src/net/sf/freecol/common/io/sza/ImageAnimationEvent.java @@ -31,12 +31,12 @@ public interface ImageAnimationEvent extends AnimationEvent { * Returns the image this event contains. * @return The image to be displayed. */ - public Image getImage(); + Image getImage(); /** * Returns the duration the image should be displayed. * @return The amount of milliseconds to display the * image. */ - public int getDurationInMs(); + int getDurationInMs(); } diff --git a/src/net/sf/freecol/common/metaserver/MetaServerUtils.java b/src/net/sf/freecol/common/metaserver/MetaServerUtils.java index 8f2e355b32..859e33687a 100644 --- a/src/net/sf/freecol/common/metaserver/MetaServerUtils.java +++ b/src/net/sf/freecol/common/metaserver/MetaServerUtils.java @@ -121,7 +121,7 @@ public Message read(Connection connection) null, -1, -1, -1, false, null, -1); /** Type of message to send. */ - private static enum MetaMessageType { + private enum MetaMessageType { REGISTER, REMOVE, SERVERLIST, diff --git a/src/net/sf/freecol/common/model/BaseProduction.java b/src/net/sf/freecol/common/model/BaseProduction.java index 4262462caf..af24aa35ec 100644 --- a/src/net/sf/freecol/common/model/BaseProduction.java +++ b/src/net/sf/freecol/common/model/BaseProduction.java @@ -41,7 +41,7 @@ public interface BaseProduction { * the work, if null the unattended production is considered. * @return The amount of goods produced. */ - public default int getBaseProduction(ProductionType productionType, + default int getBaseProduction(ProductionType productionType, GoodsType goodsType, UnitType unitType) { if (goodsType == null) return 0; if (productionType == null) { @@ -61,5 +61,5 @@ public default int getBaseProduction(ProductionType productionType, * @param unattended Whether the production is unattended. * @return A list of {@code ProductionType}s. */ - public abstract List getAvailableProductionTypes(boolean unattended); + List getAvailableProductionTypes(boolean unattended); } diff --git a/src/net/sf/freecol/common/model/Colony.java b/src/net/sf/freecol/common/model/Colony.java index 1231559226..13e00e3d74 100644 --- a/src/net/sf/freecol/common/model/Colony.java +++ b/src/net/sf/freecol/common/model/Colony.java @@ -72,7 +72,7 @@ public class Colony extends Settlement implements TradeLocation { /** Number of colonies that a player will trade down to. */ public static final int TRADE_MARGIN = 5; - public static enum ColonyChangeEvent { + public enum ColonyChangeEvent { POPULATION_CHANGE, PRODUCTION_CHANGE, BONUS_CHANGE, @@ -82,7 +82,7 @@ public static enum ColonyChangeEvent { } /** Reasons for not building a buildable. */ - public static enum NoBuildReason { + public enum NoBuildReason { NONE, NOT_BUILDING, NOT_BUILDABLE, diff --git a/src/net/sf/freecol/common/model/CombatModel.java b/src/net/sf/freecol/common/model/CombatModel.java index 5b3fed3961..47166daaa4 100644 --- a/src/net/sf/freecol/common/model/CombatModel.java +++ b/src/net/sf/freecol/common/model/CombatModel.java @@ -31,7 +31,7 @@ */ public abstract class CombatModel { - public static enum CombatEffectType { + public enum CombatEffectType { // Special results that set the sense of the result. NO_RESULT, LOSE, diff --git a/src/net/sf/freecol/common/model/Constants.java b/src/net/sf/freecol/common/model/Constants.java index ccc136d130..72ee3079d3 100644 --- a/src/net/sf/freecol/common/model/Constants.java +++ b/src/net/sf/freecol/common/model/Constants.java @@ -28,13 +28,13 @@ public interface Constants { /** Generic "huge" value. */ - public static final int INFINITY = Integer.MAX_VALUE; + int INFINITY = Integer.MAX_VALUE; /** Generic "unsure" value. */ - public static final int UNDEFINED = Integer.MIN_VALUE; + int UNDEFINED = Integer.MIN_VALUE; /** The result of checkIntegrity. */ - public static enum IntegrityType { + enum IntegrityType { INTEGRITY_FAIL(-1), INTEGRITY_FIXED(0), INTEGRITY_GOOD(1); @@ -92,69 +92,69 @@ public IntegrityType fail() { }; /** Actions when an armed unit contacts a settlement. */ - public static enum ArmedUnitSettlementAction { + enum ArmedUnitSettlementAction { SETTLEMENT_ATTACK, SETTLEMENT_TRIBUTE, } /** Actions when dealing with a boycott. */ - public static enum BoycottAction { + enum BoycottAction { BOYCOTT_PAY_ARREARS, BOYCOTT_DUMP_CARGO } /** Actions when claiming land. */ - public static enum ClaimAction { + enum ClaimAction { CLAIM_ACCEPT, CLAIM_STEAL } /** Actions surrounding native demands at colonies. */ - public static enum IndianDemandAction { + enum IndianDemandAction { INDIAN_DEMAND_ACCEPT, INDIAN_DEMAND_REJECT, INDIAN_DEMAND_DONE } /** Actions with a missionary at a native settlement. */ - public static enum MissionaryAction { + enum MissionaryAction { MISSIONARY_ESTABLISH_MISSION, MISSIONARY_DENOUNCE_HERESY, MISSIONARY_INCITE_INDIANS } /** Actions in scouting a colony. */ - public static enum ScoutColonyAction { + enum ScoutColonyAction { SCOUT_COLONY_NEGOTIATE, SCOUT_COLONY_SPY, SCOUT_COLONY_ATTACK } /** Actions in scouting a native settlement. */ - public static enum ScoutIndianSettlementAction { + enum ScoutIndianSettlementAction { SCOUT_SETTLEMENT_SPEAK, SCOUT_SETTLEMENT_TRIBUTE, SCOUT_SETTLEMENT_ATTACK } /** Price used to denote claiming land by stealing it. */ - public static final int STEAL_LAND = -1; + int STEAL_LAND = -1; /** Choice of sales action at a native settlement. */ - public static enum TradeAction { + enum TradeAction { BUY, SELL, GIFT } /** Actions when buying from the natives. */ - public static enum TradeBuyAction { + enum TradeBuyAction { BUY, HAGGLE } /** Actions when selling to the natives. */ - public static enum TradeSellAction { + enum TradeSellAction { SELL, HAGGLE, GIFT diff --git a/src/net/sf/freecol/common/model/Consumer.java b/src/net/sf/freecol/common/model/Consumer.java index 85cfa9eea0..a4a6e95348 100644 --- a/src/net/sf/freecol/common/model/Consumer.java +++ b/src/net/sf/freecol/common/model/Consumer.java @@ -33,39 +33,39 @@ public interface Consumer { /** Compare consumers by descending priority. */ - public static final Comparator COMPARATOR + Comparator COMPARATOR = Comparator.comparingInt(Consumer::getPriority).reversed(); /** * Default consumption priority for the Colony when producing new * colonists (from food). */ - public static final int POPULATION_PRIORITY = 300; + int POPULATION_PRIORITY = 300; /** * The consumption priority of the colony build queue. */ - public static final int COLONY_PRIORITY = 500; + int COLONY_PRIORITY = 500; /** * Default consumption priority for buildings. Individual building * types may have different priorities. */ - public static final int BUILDING_PRIORITY = 800; + int BUILDING_PRIORITY = 800; /** * Default consumption priority for units. Individual unit types * may have different priorities. Slave units, or converts, or * petty criminals, for example, might have a lower priority. */ - public static final int UNIT_PRIORITY = 1000; + int UNIT_PRIORITY = 1000; /** * Returns a list of GoodsTypes this Consumer consumes. * * @return a {@code List} value */ - public List getConsumedGoods(); + List getConsumedGoods(); /** * The priority of this Consumer. The higher the priority, the @@ -74,7 +74,7 @@ public interface Consumer { * * @return an {@code int} value */ - public int getPriority(); + int getPriority(); /** * Get the modifier set with the given id. The modifier most @@ -85,5 +85,5 @@ public interface Consumer { * @param id The object identifier. * @return The stream of {@code Modifier}s found. */ - public Stream getConsumptionModifiers(String id); + Stream getConsumptionModifiers(String id); } diff --git a/src/net/sf/freecol/common/model/DiplomaticTrade.java b/src/net/sf/freecol/common/model/DiplomaticTrade.java index 186a4f54cc..cfe9f1c376 100644 --- a/src/net/sf/freecol/common/model/DiplomaticTrade.java +++ b/src/net/sf/freecol/common/model/DiplomaticTrade.java @@ -42,7 +42,7 @@ public class DiplomaticTrade extends FreeColGameObject { public static final String TAG = "diplomaticTrade"; /** A context for the trade. */ - public static enum TradeContext { + public enum TradeContext { CONTACT, /** First contact between Europeans */ DIPLOMATIC, /** Scout negotiating */ TRADE, /** Carrier trading */ @@ -59,7 +59,7 @@ public String getKey() { } /** A type for the trade status. */ - public static enum TradeStatus { + public enum TradeStatus { PROPOSE_TRADE, ACCEPT_TRADE, REJECT_TRADE diff --git a/src/net/sf/freecol/common/model/Disaster.java b/src/net/sf/freecol/common/model/Disaster.java index da115f3e37..c43d931aa4 100644 --- a/src/net/sf/freecol/common/model/Disaster.java +++ b/src/net/sf/freecol/common/model/Disaster.java @@ -45,7 +45,7 @@ public class Disaster extends FreeColSpecObjectType { public static final String BANKRUPTCY = "model.disaster.bankruptcy"; /** Whether to apply one, many or all applicable disasters. */ - public static enum Effects { ONE, SEVERAL, ALL }; + public enum Effects { ONE, SEVERAL, ALL }; /** Whether this disaster is natural. Defaults to false. */ diff --git a/src/net/sf/freecol/common/model/Europe.java b/src/net/sf/freecol/common/model/Europe.java index 578e57b7df..a1c2d14094 100644 --- a/src/net/sf/freecol/common/model/Europe.java +++ b/src/net/sf/freecol/common/model/Europe.java @@ -80,7 +80,7 @@ public class Europe extends UnitLocation * The following constant should be used when the random choice * behaviour is desired. */ - public static enum MigrationType { + public enum MigrationType { NORMAL, // Unit decided to migrate RECRUIT, // Player is paying FOUNTAIN, // As a result of a Fountain of Youth discovery diff --git a/src/net/sf/freecol/common/model/FoundingFather.java b/src/net/sf/freecol/common/model/FoundingFather.java index 361d70fa50..c6e236965c 100644 --- a/src/net/sf/freecol/common/model/FoundingFather.java +++ b/src/net/sf/freecol/common/model/FoundingFather.java @@ -41,7 +41,7 @@ public class FoundingFather extends FreeColSpecObjectType { public static final String TAG = "founding-father"; - public static enum FoundingFatherType { + public enum FoundingFatherType { TRADE, EXPLORATION, MILITARY, diff --git a/src/net/sf/freecol/common/model/FreeColGameObjectListener.java b/src/net/sf/freecol/common/model/FreeColGameObjectListener.java index beea7fca7c..572e35a10e 100644 --- a/src/net/sf/freecol/common/model/FreeColGameObjectListener.java +++ b/src/net/sf/freecol/common/model/FreeColGameObjectListener.java @@ -33,14 +33,14 @@ public interface FreeColGameObjectListener { * @param id The object identifier. * @param fcgo The new {@code FreeColGameObject}. */ - public void setFreeColGameObject(String id, FreeColGameObject fcgo); + void setFreeColGameObject(String id, FreeColGameObject fcgo); /** * Notify a listener (if any) of that an object has gone. * * @param id The object identifier. */ - public void removeFreeColGameObject(String id); + void removeFreeColGameObject(String id); /** * Notify a listener (if any) of that an object has changed owner. @@ -49,6 +49,6 @@ public interface FreeColGameObjectListener { * @param oldOwner The old owning {@code Player}. * @param newOwner The new owning {@code Player}. */ - public void ownerChanged(FreeColGameObject source, + void ownerChanged(FreeColGameObject source, Player oldOwner, Player newOwner); } diff --git a/src/net/sf/freecol/common/model/Game.java b/src/net/sf/freecol/common/model/Game.java index 645917a95e..74d9a49a34 100644 --- a/src/net/sf/freecol/common/model/Game.java +++ b/src/net/sf/freecol/common/model/Game.java @@ -73,7 +73,7 @@ public class Game extends FreeColGameObject { public static final String TAG = "game"; /** Reasons for logging out. */ - public static enum LogoutReason { + public enum LogoutReason { DEFEATED, // Game over, player lost LOGIN, // Logging in again FIXME: this should go away LOGOUT, // Player quits but game continues @@ -84,7 +84,7 @@ public static enum LogoutReason { }; /** State for the FCGO iterator, out here because it has to be static. */ - private static enum FcgoState { + private enum FcgoState { INVALID, VALID, CONSUMED, diff --git a/src/net/sf/freecol/common/model/HighScore.java b/src/net/sf/freecol/common/model/HighScore.java index db0e6fb536..d745d21737 100644 --- a/src/net/sf/freecol/common/model/HighScore.java +++ b/src/net/sf/freecol/common/model/HighScore.java @@ -68,7 +68,7 @@ public class HighScore extends FreeColObject { * On retirement, an object will be named in honour of the * player. The nature of the object depends on the player's score. */ - public static enum ScoreLevel { + public enum ScoreLevel { CONTINENT(40000), COUNTRY(35000), STATE(30000), diff --git a/src/net/sf/freecol/common/model/HistoryEvent.java b/src/net/sf/freecol/common/model/HistoryEvent.java index 2e33a061e9..50cc601b93 100644 --- a/src/net/sf/freecol/common/model/HistoryEvent.java +++ b/src/net/sf/freecol/common/model/HistoryEvent.java @@ -35,7 +35,7 @@ public class HistoryEvent extends StringTemplate { public static final String TAG = "historyEvent"; - public static enum HistoryEventType implements Named { + public enum HistoryEventType implements Named { DISCOVER_NEW_WORLD, DISCOVER_REGION, MEET_NATION, diff --git a/src/net/sf/freecol/common/model/IndianSettlement.java b/src/net/sf/freecol/common/model/IndianSettlement.java index f6e02f7d9a..b77d6ce60f 100644 --- a/src/net/sf/freecol/common/model/IndianSettlement.java +++ b/src/net/sf/freecol/common/model/IndianSettlement.java @@ -69,7 +69,7 @@ public class IndianSettlement extends Settlement implements TradeLocation { public static final String TAG = "indianSettlement"; /** The level of contact between a player and this settlement. */ - public static enum ContactLevel { + public enum ContactLevel { UNCONTACTED, // Nothing known other than location? CONTACTED, // Name, wanted-goods now visible VISITED, // Skill now known diff --git a/src/net/sf/freecol/common/model/Limit.java b/src/net/sf/freecol/common/model/Limit.java index 22a7e08c8a..8ef5be23f2 100644 --- a/src/net/sf/freecol/common/model/Limit.java +++ b/src/net/sf/freecol/common/model/Limit.java @@ -39,7 +39,7 @@ public final class Limit extends FreeColSpecObjectType { public static final String TAG = "limit"; /** The basic operation used in evaluating this limit. */ - public static enum Operator { + public enum Operator { EQ, LT, GT, LE, GE } diff --git a/src/net/sf/freecol/common/model/Locatable.java b/src/net/sf/freecol/common/model/Locatable.java index e63bb2ad75..107d62db71 100644 --- a/src/net/sf/freecol/common/model/Locatable.java +++ b/src/net/sf/freecol/common/model/Locatable.java @@ -30,7 +30,7 @@ public interface Locatable { * * @return The location of this {@code Locatable}. */ - public Location getLocation(); + Location getLocation(); /** * Sets the location for this {@code Locatable}. @@ -39,14 +39,14 @@ public interface Locatable { * {@code Locatable}. * @return True if the location change succeeds. */ - public boolean setLocation(Location newLocation); + boolean setLocation(Location newLocation); /** * Is this locatable in Europe. * * @return True if the {@code Locatable} is in {@code Europe}. */ - public boolean isInEurope(); + boolean isInEurope(); /** * Get the {@code Tile} where this {@code Locatable} is @@ -55,7 +55,7 @@ public interface Locatable { * @return The {@code Tile} where this {@code Locatable} * is located, if any. */ - public Tile getTile(); + Tile getTile(); /** * Gets the number of cargo slots consumed when this @@ -63,5 +63,5 @@ public interface Locatable { * * @return The number of cargo slots required. */ - public int getSpaceTaken(); + int getSpaceTaken(); } diff --git a/src/net/sf/freecol/common/model/Location.java b/src/net/sf/freecol/common/model/Location.java index d9be0ce341..2fa2455578 100644 --- a/src/net/sf/freecol/common/model/Location.java +++ b/src/net/sf/freecol/common/model/Location.java @@ -35,9 +35,9 @@ public interface Location extends ObjectWithId { // "Rank" constants for location ordering. // Tile ranks are distinct and non-negative. // Other locations devolve to {europe,highseas,tile} rank. - public static final int LOCATION_RANK_NOWHERE = -3; - public static final int LOCATION_RANK_EUROPE = -2; - public static final int LOCATION_RANK_HIGHSEAS = -1; + int LOCATION_RANK_NOWHERE = -3; + int LOCATION_RANK_EUROPE = -2; + int LOCATION_RANK_HIGHSEAS = -1; /** * Gets the identifier of this {@code Location}. @@ -46,21 +46,21 @@ public interface Location extends ObjectWithId { * @see FreeColGameObject#getId */ @Override - public String getId(); + String getId(); /** * Gets the Tile associated with this Location. * * @return The Tile associated with this Location, or null if none found. */ - public Tile getTile(); + Tile getTile(); /** * Get a label for this location. * * @return A label for this location. */ - public StringTemplate getLocationLabel(); + StringTemplate getLocationLabel(); /** * Get a label for this location for a particular player. @@ -68,7 +68,7 @@ public interface Location extends ObjectWithId { * @param player The {@code Player} to return the name for. * @return A label for this location. */ - public StringTemplate getLocationLabelFor(Player player); + StringTemplate getLocationLabelFor(Player player); /** * Adds a {@code Locatable} to this Location. @@ -76,7 +76,7 @@ public interface Location extends ObjectWithId { * @param locatable The {@code Locatable} to add to this Location. * @return True if the locatable was added. */ - public boolean add(Locatable locatable); + boolean add(Locatable locatable); /** * Removes a {@code Locatable} from this Location. @@ -85,7 +85,7 @@ public interface Location extends ObjectWithId { * Location. * @return True if the locatable was removed. */ - public boolean remove(Locatable locatable); + boolean remove(Locatable locatable); /** * Checks if this {@code Location} contains the specified @@ -94,7 +94,7 @@ public interface Location extends ObjectWithId { * @param locatable The {@code Locatable} to test the presence of. * @return True if the locatable is present at this location. */ - public boolean contains(Locatable locatable); + boolean contains(Locatable locatable); /** * Checks whether or not the specified locatable may be added to this @@ -103,28 +103,28 @@ public interface Location extends ObjectWithId { * @param locatable The {@code Locatable} to add. * @return True if the locatable can be added to this location. */ - public boolean canAdd(Locatable locatable); + boolean canAdd(Locatable locatable); /** * Gets the number of units at this Location. * * @return The number of units at this Location. */ - public int getUnitCount(); + int getUnitCount(); /** * Gets a stream of all the units present at this location. * * @return A stream of all the units at this location. */ - public Stream getUnits(); + Stream getUnits(); /** * Gets a list of all the units present at this location. * * @return A list of all the units at this location. */ - public List getUnitList(); + List getUnitList(); /** * Gets the {@code GoodsContainer} this {@code Location} use @@ -133,7 +133,7 @@ public interface Location extends ObjectWithId { * @return The {@code GoodsContainer} or {@code null} if the * {@code Location} cannot store any goods. */ - public GoodsContainer getGoodsContainer(); + GoodsContainer getGoodsContainer(); /** * Gets the {@code Settlement} this {@code Location} is @@ -141,7 +141,7 @@ public interface Location extends ObjectWithId { * * @return The associated {@code Settlement}, or null if none. */ - public Settlement getSettlement(); + Settlement getSettlement(); /** * Get the colony at this location. @@ -149,7 +149,7 @@ public interface Location extends ObjectWithId { * @return A {@code Colony} at this location if any, or null * if none found. */ - public Colony getColony(); + Colony getColony(); /** * Gets the native settlement at this location. @@ -157,7 +157,7 @@ public interface Location extends ObjectWithId { * @return The {@code IndianSettlement} at this location if * any, or null if none found. */ - public IndianSettlement getIndianSettlement(); + IndianSettlement getIndianSettlement(); /** * Promote this location to a more meaningful one if possible. @@ -167,7 +167,7 @@ public interface Location extends ObjectWithId { * * @return A more meaningful {@code Location}, or this one. */ - public Location up(); + Location up(); /** * Get a integer for this location, for the benefit of location @@ -175,14 +175,14 @@ public interface Location extends ObjectWithId { * * @return A suitable integer. */ - public int getRank(); + int getRank(); /** * Get a short description of this location. * * @return A short description. */ - public String toShortString(); + String toShortString(); /** @@ -191,7 +191,7 @@ public interface Location extends ObjectWithId { * @param loc The {@code Location} to improve. * @return The improved {@code Location}. */ - public static Location upLoc(Location loc) { + static Location upLoc(Location loc) { return (loc == null) ? null : loc.up(); } @@ -201,7 +201,7 @@ public static Location upLoc(Location loc) { * @param loc A {@code Location} to check. * @return The integer rank of the given location. */ - public static int rankOf(Location loc) { + static int rankOf(Location loc) { return (loc == null) ? Location.LOCATION_RANK_NOWHERE : loc.getRank(); } @@ -210,7 +210,7 @@ public static int rankOf(Location loc) { * * @return A key for image lookup, null by default. */ - public default String getLocationImageKey() { + default String getLocationImageKey() { return null; } } diff --git a/src/net/sf/freecol/common/model/LostCityRumour.java b/src/net/sf/freecol/common/model/LostCityRumour.java index ee52bae4e1..41869e980b 100644 --- a/src/net/sf/freecol/common/model/LostCityRumour.java +++ b/src/net/sf/freecol/common/model/LostCityRumour.java @@ -56,7 +56,7 @@ public class LostCityRumour extends TileItem { private static int rumourNothing = -1; /** Constants describing types of Lost City Rumours. */ - public static enum RumourType { + public enum RumourType { NO_SUCH_RUMOUR, BURIAL_GROUND, EXPEDITION_VANISHES, diff --git a/src/net/sf/freecol/common/model/Map.java b/src/net/sf/freecol/common/model/Map.java index 633b2667b7..b8ecd252e6 100644 --- a/src/net/sf/freecol/common/model/Map.java +++ b/src/net/sf/freecol/common/model/Map.java @@ -84,7 +84,7 @@ public class Map extends FreeColGameObject implements Location { * Possible actions by the unit travelling along a path in consideration * of the next tile. */ - private static enum MoveStep { FAIL, BYLAND, BYWATER, EMBARK, DISEMBARK }; + private enum MoveStep { FAIL, BYLAND, BYWATER, EMBARK, DISEMBARK }; /** * The number of tiles from the upper edge that are considered @@ -96,7 +96,7 @@ private static enum MoveStep { FAIL, BYLAND, BYWATER, EMBARK, DISEMBARK }; * The layers included in the map. The RIVERS layer includes all * natural tile improvements that are not resources. */ - public static enum Layer { + public enum Layer { NONE, LAND, TERRAIN, REGIONS, RIVERS, RESOURCES, RUMOURS, NATIVES, ALL; }; diff --git a/src/net/sf/freecol/common/model/Market.java b/src/net/sf/freecol/common/model/Market.java index 0fba2906fc..8e706ba216 100644 --- a/src/net/sf/freecol/common/model/Market.java +++ b/src/net/sf/freecol/common/model/Market.java @@ -56,7 +56,7 @@ public final class Market extends FreeColGameObject implements Ownable { * Constant for specifying the access to this {@code Market} * when selling goods. */ - public static enum Access { + public enum Access { EUROPE, CUSTOM_HOUSE, } diff --git a/src/net/sf/freecol/common/model/ModelMessage.java b/src/net/sf/freecol/common/model/ModelMessage.java index 6b44ce1085..c7e5a4b81a 100644 --- a/src/net/sf/freecol/common/model/ModelMessage.java +++ b/src/net/sf/freecol/common/model/ModelMessage.java @@ -47,7 +47,7 @@ public class ModelMessage extends StringTemplate { * When this changes, be sure to update client-options.xml and the * messages file appropriately. */ - public static enum MessageType implements Named { + public enum MessageType implements Named { DEFAULT(""), BUILDING_COMPLETED("model.option.guiShowBuildingCompleted"), COMBAT_RESULT(null), // No option, always display diff --git a/src/net/sf/freecol/common/model/Modifier.java b/src/net/sf/freecol/common/model/Modifier.java index ac3a0ebba2..50e8da2423 100644 --- a/src/net/sf/freecol/common/model/Modifier.java +++ b/src/net/sf/freecol/common/model/Modifier.java @@ -161,7 +161,7 @@ public class Modifier extends Feature { public static final int ROLE_COMBAT_INDEX = 30; public static final int GENERAL_COMBAT_INDEX = 50; - public static enum ModifierType { + public enum ModifierType { ADDITIVE, MULTIPLICATIVE, PERCENTAGE diff --git a/src/net/sf/freecol/common/model/Monarch.java b/src/net/sf/freecol/common/model/Monarch.java index 146d6fd4bd..ca9f743a4c 100644 --- a/src/net/sf/freecol/common/model/Monarch.java +++ b/src/net/sf/freecol/common/model/Monarch.java @@ -54,7 +54,7 @@ public final class Monarch extends FreeColGameObject implements Named { public static final String TAG = "monarch"; /** Constants describing monarch actions. */ - public static enum MonarchAction { + public enum MonarchAction { NO_ACTION, RAISE_TAX_ACT, RAISE_TAX_WAR, diff --git a/src/net/sf/freecol/common/model/Movable.java b/src/net/sf/freecol/common/model/Movable.java index 549c90d379..cf6e381772 100644 --- a/src/net/sf/freecol/common/model/Movable.java +++ b/src/net/sf/freecol/common/model/Movable.java @@ -31,7 +31,7 @@ public interface Movable { * * @return The amount of moves this Movable has left. */ - public int getMovesLeft(); + int getMovesLeft(); /** * Gets the amount of moves this Movable has at the beginning of @@ -40,5 +40,5 @@ public interface Movable { * @return The amount of moves this Movable has at the beginning * of each turn. */ - public int getInitialMovesLeft(); + int getInitialMovesLeft(); } diff --git a/src/net/sf/freecol/common/model/Nameable.java b/src/net/sf/freecol/common/model/Nameable.java index c468020cd7..90a5733ea9 100644 --- a/src/net/sf/freecol/common/model/Nameable.java +++ b/src/net/sf/freecol/common/model/Nameable.java @@ -30,13 +30,13 @@ public interface Nameable { * * @return The name of the {@code Nameable}. */ - public String getName(); + String getName(); /** * Sets the name for this {@code Nameable}. * * @param newName The new name for the {@code Nameable}. */ - public void setName(String newName); + void setName(String newName); } diff --git a/src/net/sf/freecol/common/model/Named.java b/src/net/sf/freecol/common/model/Named.java index beb353d8f4..e2fc9c8bdd 100644 --- a/src/net/sf/freecol/common/model/Named.java +++ b/src/net/sf/freecol/common/model/Named.java @@ -33,5 +33,5 @@ public interface Named { * * @return The name of the {@code Named}. */ - public String getNameKey(); + String getNameKey(); } diff --git a/src/net/sf/freecol/common/model/NationOptions.java b/src/net/sf/freecol/common/model/NationOptions.java index b424936ed2..24d164f07d 100644 --- a/src/net/sf/freecol/common/model/NationOptions.java +++ b/src/net/sf/freecol/common/model/NationOptions.java @@ -43,7 +43,7 @@ public class NationOptions extends FreeColSpecObject { public static final String TAG = "nationOptions"; /** Type of national advantages for European players. */ - public static enum Advantages implements Named { + public enum Advantages implements Named { NONE, FIXED, SELECTABLE; @@ -76,7 +76,7 @@ public final String getNameKey() { * Nations may be available to all players, to AI players only, or * to no players. */ - public static enum NationState implements Named { + public enum NationState implements Named { AVAILABLE, AI_ONLY, NOT_AVAILABLE; diff --git a/src/net/sf/freecol/common/model/NationType.java b/src/net/sf/freecol/common/model/NationType.java index 4dfed81384..04d23c8154 100644 --- a/src/net/sf/freecol/common/model/NationType.java +++ b/src/net/sf/freecol/common/model/NationType.java @@ -36,7 +36,7 @@ */ public abstract class NationType extends FreeColSpecObjectType { - public static enum SettlementNumber { + public enum SettlementNumber { LOW, AVERAGE, HIGH; /** @@ -49,7 +49,7 @@ public String getKey() { } } - public static enum AggressionLevel { + public enum AggressionLevel { LOW, AVERAGE, HIGH; /** diff --git a/src/net/sf/freecol/common/model/NativeTrade.java b/src/net/sf/freecol/common/model/NativeTrade.java index 3b474ab233..8b4ccc66bb 100644 --- a/src/net/sf/freecol/common/model/NativeTrade.java +++ b/src/net/sf/freecol/common/model/NativeTrade.java @@ -46,7 +46,7 @@ public class NativeTrade extends FreeColGameObject { = StringTemplate.template(""); /** The type of native trade command. */ - public static enum NativeTradeAction { + public enum NativeTradeAction { // Requests from European trader OPEN(false, true), // Start a new trade session CLOSE(true, true), // End an existing session diff --git a/src/net/sf/freecol/common/model/Operand.java b/src/net/sf/freecol/common/model/Operand.java index a53a3028c9..85cd65ef72 100644 --- a/src/net/sf/freecol/common/model/Operand.java +++ b/src/net/sf/freecol/common/model/Operand.java @@ -50,11 +50,11 @@ public class Operand extends Scope { private static final Logger logger = Logger.getLogger(Operand.class.getName()); - public static enum OperandType { + public enum OperandType { UNITS, BUILDINGS, SETTLEMENTS, FOUNDING_FATHERS, YEAR, OPTION, NONE } - public static enum ScopeLevel { + public enum ScopeLevel { SETTLEMENT, PLAYER, GAME, NONE } diff --git a/src/net/sf/freecol/common/model/Ownable.java b/src/net/sf/freecol/common/model/Ownable.java index 65a14f1724..a8a562a61a 100644 --- a/src/net/sf/freecol/common/model/Ownable.java +++ b/src/net/sf/freecol/common/model/Ownable.java @@ -32,7 +32,7 @@ public interface Ownable { * * @return The {@code Player} controlling this {@code Ownable}. */ - public Player getOwner(); + Player getOwner(); /** * Sets the owner of this {@code Ownable}. @@ -41,5 +41,5 @@ public interface Ownable { * of this {@code Ownable}. * @exception UnsupportedOperationException if not implemented. */ - public void setOwner(Player p); + void setOwner(Player p); } diff --git a/src/net/sf/freecol/common/model/Player.java b/src/net/sf/freecol/common/model/Player.java index ba182eb9d8..72aaac2927 100644 --- a/src/net/sf/freecol/common/model/Player.java +++ b/src/net/sf/freecol/common/model/Player.java @@ -96,12 +96,12 @@ public class Player extends FreeColGameObject implements Nameable { // /** Types of players. */ - public static enum PlayerType { + public enum PlayerType { NATIVE, COLONIAL, REBEL, INDEPENDENT, ROYAL, UNDEAD, RETIRED } /** Colony value categories. */ - public static enum ColonyValueCategory { + public enum ColonyValueCategory { A_OVERRIDE, // override slot containing showstopper NoValueType values A_PROD, // general production level A_TILE, // strangeness with the tile @@ -127,7 +127,7 @@ public String toString() { } /** Special return values for showstopper getColonyValue fail. */ - public static enum NoValueType { + public enum NoValueType { BOGUS(-1), // bad value from canClaimToFoundSettlementReason TERRAIN(-2), // can not settle on tile (e.g. moutain, water) RUMOUR(-3), // LCR present @@ -3341,7 +3341,7 @@ public static double strengthRatio(double ours, double theirs) { * to found a settlement or just to be used by one, including the * double negative NONE == "no reason" case. */ - public static enum NoClaimReason implements Named { + public enum NoClaimReason implements Named { NONE, // Actually, tile can be claimed TERRAIN, // Not on settleable terrain RUMOUR, // Europeans can not claim tiles with LCR diff --git a/src/net/sf/freecol/common/model/Region.java b/src/net/sf/freecol/common/model/Region.java index b026516680..55238aa7b6 100644 --- a/src/net/sf/freecol/common/model/Region.java +++ b/src/net/sf/freecol/common/model/Region.java @@ -56,7 +56,7 @@ public class Region extends FreeColGameObject implements Nameable { public static final String PACIFIC_KEY = "model.region.pacific"; /** The type of region. */ - public static enum RegionType implements Named { + public enum RegionType implements Named { OCEAN(false), COAST(false), LAKE(false), diff --git a/src/net/sf/freecol/common/model/Specification.java b/src/net/sf/freecol/common/model/Specification.java index 03ec160492..a9dccb98d5 100644 --- a/src/net/sf/freecol/common/model/Specification.java +++ b/src/net/sf/freecol/common/model/Specification.java @@ -90,7 +90,7 @@ public final class Specification implements OptionContainer { // Special reader classes for spec objects private interface ChildReader { - public void readChildren(FreeColXMLReader xr) throws XMLStreamException; + void readChildren(FreeColXMLReader xr) throws XMLStreamException; } /** diff --git a/src/net/sf/freecol/common/model/StringTemplate.java b/src/net/sf/freecol/common/model/StringTemplate.java index 25dc028b45..c54261859e 100644 --- a/src/net/sf/freecol/common/model/StringTemplate.java +++ b/src/net/sf/freecol/common/model/StringTemplate.java @@ -63,7 +63,7 @@ public class StringTemplate extends FreeColObject { * value of the key, or LABEL, a separator string that will be * used to join the replacement values. */ - public static enum TemplateType { NAME, KEY, TEMPLATE, LABEL } + public enum TemplateType { NAME, KEY, TEMPLATE, LABEL } /** The TemplateType of this StringTemplate. Defaults to KEY. */ private TemplateType templateType = TemplateType.KEY; diff --git a/src/net/sf/freecol/common/model/Tension.java b/src/net/sf/freecol/common/model/Tension.java index c518c0aa66..81d7f29753 100644 --- a/src/net/sf/freecol/common/model/Tension.java +++ b/src/net/sf/freecol/common/model/Tension.java @@ -68,7 +68,7 @@ public class Tension implements Named { /** * Constants for describing alarm levels. */ - public static enum Level { + public enum Level { HAPPY(100), CONTENT(600), DISPLEASED(700), diff --git a/src/net/sf/freecol/common/model/TileType.java b/src/net/sf/freecol/common/model/TileType.java index f32ba6e48a..69c03c1ccb 100644 --- a/src/net/sf/freecol/common/model/TileType.java +++ b/src/net/sf/freecol/common/model/TileType.java @@ -45,7 +45,7 @@ public final class TileType extends FreeColSpecObjectType public static final String TAG = "tile-type"; - public static enum RangeType { HUMIDITY, TEMPERATURE, ALTITUDE }; + public enum RangeType { HUMIDITY, TEMPERATURE, ALTITUDE }; public static final int HILLS_ALTITUDE = 15; public static final int MOUNTAINS_ALTITUDE = 25; diff --git a/src/net/sf/freecol/common/model/TradeLocation.java b/src/net/sf/freecol/common/model/TradeLocation.java index 91c35eb013..3d3fc358e8 100644 --- a/src/net/sf/freecol/common/model/TradeLocation.java +++ b/src/net/sf/freecol/common/model/TradeLocation.java @@ -35,7 +35,7 @@ public interface TradeLocation { * @param goodsType The {@code GoodsType} to check. * @return The amount of goods present. */ - public int getAvailableGoodsCount(GoodsType goodsType); + int getAvailableGoodsCount(GoodsType goodsType); /** * Gets the amount of a given goods type that can be exported from @@ -45,7 +45,7 @@ public interface TradeLocation { * @param turns The number of turns before the goods is required. * @return The amount of goods to export. */ - public int getExportAmount(GoodsType goodsType, int turns); + int getExportAmount(GoodsType goodsType, int turns); /** * Gets the amount of a given goods type that can be imported to @@ -55,7 +55,7 @@ public interface TradeLocation { * @param turns The number of turns before the goods will arrive. * @return The amount of goods to import. */ - public int getImportAmount(GoodsType goodsType, int turns); + int getImportAmount(GoodsType goodsType, int turns); /** * Function for returning the name of a TradeLocation @@ -63,7 +63,7 @@ public interface TradeLocation { * @param tradeLocation The {@code TradeLocation} to return the name. * @return The name. */ - public String getLocationName(TradeLocation tradeLocation); + String getLocationName(TradeLocation tradeLocation); /** * Get the name of this instance as a JLabel. @@ -71,7 +71,7 @@ public interface TradeLocation { * @return The {@code JLabel} with the result of * {@link #getLocationName(TradeLocation)} */ - public default JLabel getNameAsJlabel() { + default JLabel getNameAsJlabel() { return new JLabel(getLocationName(this)); } @@ -81,7 +81,7 @@ public default JLabel getNameAsJlabel() { * * @return True if possible, false by default. */ - public default boolean canBeInput() { + default boolean canBeInput() { return false; } } diff --git a/src/net/sf/freecol/common/model/TransactionListener.java b/src/net/sf/freecol/common/model/TransactionListener.java index 1b43add3cf..f4f8f70a07 100644 --- a/src/net/sf/freecol/common/model/TransactionListener.java +++ b/src/net/sf/freecol/common/model/TransactionListener.java @@ -33,7 +33,7 @@ public interface TransactionListener { * @param amount The amount of goods which have been purchased * @param price The unit price of the goods */ - public void logPurchase(GoodsType goodsType, int amount, int price); + void logPurchase(GoodsType goodsType, int amount, int price); /** * Logs a sale @@ -43,5 +43,5 @@ public interface TransactionListener { * @param price The unit price of the goods * @param tax The tax which has been applied */ - public void logSale(GoodsType goodsType, int amount, int price, int tax); + void logSale(GoodsType goodsType, int amount, int price, int tax); } diff --git a/src/net/sf/freecol/common/model/Unit.java b/src/net/sf/freecol/common/model/Unit.java index 231697434f..a9949ebcef 100644 --- a/src/net/sf/freecol/common/model/Unit.java +++ b/src/net/sf/freecol/common/model/Unit.java @@ -189,7 +189,7 @@ public boolean check(Unit u, PathNode path) { !u.isNaval() && u.getState() == UnitState.SENTRY; /** A state a Unit can have. */ - public static enum UnitState { + public enum UnitState { ACTIVE, FORTIFIED, SENTRY, @@ -209,7 +209,7 @@ public String getKey() { } /** Internal state for findIntermediatePort. */ - private static enum PortMode { + private enum PortMode { LAKE, NO_HIGH_SEAS, BLOCKED, @@ -387,7 +387,7 @@ public StringTemplate getApparentOwnerName() { } /** What type of unit label do we want? */ - public static enum UnitLabelType { + public enum UnitLabelType { PLAIN, // Just the basics NATIONAL, // Add the nation FULL // Add the equipment and extras @@ -2115,7 +2115,7 @@ public void damageShip(Location repair) { * * @see Unit#getMoveType(Direction) */ - public static enum MoveType { + public enum MoveType { MOVE(null, true), MOVE_HIGH_SEAS(null, true), EXPLORE_LOST_CITY_RUMOUR(null, true), diff --git a/src/net/sf/freecol/common/model/UnitLocation.java b/src/net/sf/freecol/common/model/UnitLocation.java index fda4f110db..c66422a6eb 100644 --- a/src/net/sf/freecol/common/model/UnitLocation.java +++ b/src/net/sf/freecol/common/model/UnitLocation.java @@ -53,7 +53,7 @@ public abstract class UnitLocation extends FreeColGameObject implements Location private static final Logger logger = Logger.getLogger(UnitLocation.class.getName()); - public static enum NoAddReason { + public enum NoAddReason { /** * No reason why Locatable can not be added. */ diff --git a/src/net/sf/freecol/common/model/mission/Mission.java b/src/net/sf/freecol/common/model/mission/Mission.java index ff0c484bcd..9047b9b24f 100644 --- a/src/net/sf/freecol/common/model/mission/Mission.java +++ b/src/net/sf/freecol/common/model/mission/Mission.java @@ -34,7 +34,7 @@ */ public interface Mission { - public static enum MissionState { + enum MissionState { /** * Mission is in progress. */ @@ -61,7 +61,7 @@ public static enum MissionState { * * @return a {@code MissionState} value */ - public MissionState doMission(); + MissionState doMission(); /** @@ -72,7 +72,7 @@ public static enum MissionState { * * @return a {@code boolean} value */ - public boolean isValid(); + boolean isValid(); /** @@ -80,7 +80,7 @@ public static enum MissionState { * * @return an {@code Unit} value */ - public Unit getUnit(); + Unit getUnit(); /** * This method writes an XML-representation of this object to @@ -90,5 +90,5 @@ public static enum MissionState { * @throws XMLStreamException if there are any problems writing * to the stream. */ - public void toXML(FreeColXMLWriter xw) throws XMLStreamException; + void toXML(FreeColXMLWriter xw) throws XMLStreamException; } diff --git a/src/net/sf/freecol/common/model/pathfinding/CostDecider.java b/src/net/sf/freecol/common/model/pathfinding/CostDecider.java index b152ee2b9c..7038e7d8cc 100644 --- a/src/net/sf/freecol/common/model/pathfinding/CostDecider.java +++ b/src/net/sf/freecol/common/model/pathfinding/CostDecider.java @@ -31,7 +31,7 @@ */ public interface CostDecider { - public static final int ILLEGAL_MOVE = -1; + int ILLEGAL_MOVE = -1; /** * Determines the cost of a single move. @@ -45,7 +45,7 @@ public interface CostDecider { * @return The cost of moving the given unit from the * {@code oldLocation} to the {@code newLocation}. */ - public int getCost(Unit unit, Location oldLocation, Location newLocation, + int getCost(Unit unit, Location oldLocation, Location newLocation, int movesLeftBefore); /** @@ -54,13 +54,13 @@ public int getCost(Unit unit, Location oldLocation, Location newLocation, * * @return The number of moves left. */ - public int getMovesLeft(); + int getMovesLeft(); /** * Gets the number of turns consumed. * This method should be called after invoking {@link #getCost}. * * @return The number of turns consumed. - */ - public int getNewTurns(); + */ + int getNewTurns(); } diff --git a/src/net/sf/freecol/common/model/pathfinding/GoalDecider.java b/src/net/sf/freecol/common/model/pathfinding/GoalDecider.java index b56eb0e6f1..e571bce2d5 100644 --- a/src/net/sf/freecol/common/model/pathfinding/GoalDecider.java +++ b/src/net/sf/freecol/common/model/pathfinding/GoalDecider.java @@ -47,7 +47,7 @@ public interface GoalDecider { * @return The {@code PathNode} where the {@code Tile} * returned by {@code pathNode.getTile()} is the goal. */ - public PathNode getGoal(); + PathNode getGoal(); /** * Determines whether this {@code GoalDecider} has any @@ -56,7 +56,7 @@ public interface GoalDecider { * @return {@code true} if there are any sub goals * and {@code false} otherwise. */ - public boolean hasSubGoals(); + boolean hasSubGoals(); /** * Checks whether the given {@code PathNode} is a @@ -74,5 +74,5 @@ public interface GoalDecider { * {@code true} and {@link #hasSubGoals()} returns * {@code false}. */ - public boolean check(Unit u, PathNode pathNode); + boolean check(Unit u, PathNode pathNode); } diff --git a/src/net/sf/freecol/common/networking/Message.java b/src/net/sf/freecol/common/networking/Message.java index e4e6dfce83..6f02f33ae1 100644 --- a/src/net/sf/freecol/common/networking/Message.java +++ b/src/net/sf/freecol/common/networking/Message.java @@ -70,7 +70,7 @@ public abstract class Message { // Convenient way to specify the relative priorities of the messages // types in one place. - public static enum MessagePriority { + public enum MessagePriority { ATTRIBUTE(-1), // N/A ANIMATION(0), // Do animations first REMOVE(100), // Do removes last diff --git a/src/net/sf/freecol/common/networking/MessageHandler.java b/src/net/sf/freecol/common/networking/MessageHandler.java index 770638861b..aea6e61241 100644 --- a/src/net/sf/freecol/common/networking/MessageHandler.java +++ b/src/net/sf/freecol/common/networking/MessageHandler.java @@ -38,7 +38,7 @@ public interface MessageHandler { * @return A reply message, if any. * @exception FreeColException if the message is malformed. */ - public Message handle(Connection connection, Message message) + Message handle(Connection connection, Message message) throws FreeColException; /** @@ -50,6 +50,6 @@ public Message handle(Connection connection, Message message) * @exception XMLStreamException if there is a problem reading the * message. */ - public Message read(Connection connection) + Message read(Connection connection) throws FreeColException, XMLStreamException; } diff --git a/src/net/sf/freecol/common/option/Option.java b/src/net/sf/freecol/common/option/Option.java index af151d8eb9..44d16eb058 100644 --- a/src/net/sf/freecol/common/option/Option.java +++ b/src/net/sf/freecol/common/option/Option.java @@ -38,35 +38,35 @@ public interface Option extends Cloneable, ObjectWithId { * @return A clone of this option. * @exception CloneNotSupportedException if we can not clone. */ - public Option cloneOption() throws CloneNotSupportedException; + Option cloneOption() throws CloneNotSupportedException; /** * Gets the option group identifier for this option. * * @return The option group identifier. */ - public String getGroup(); + String getGroup(); /** * Set the option group for this option. * * @param group The identifier for the option group. */ - public void setGroup(String group); + void setGroup(String group); /** * Gets the value of this option. * * @return The value of this {@code Option}. */ - public T getValue(); + T getValue(); /** * Sets the value of this option. * * @param value The new value of this {@code Option}. */ - public void setValue(T value); + void setValue(T value); /** * Gets the key of an {@code BooleanOption} that must be true for this @@ -74,7 +74,7 @@ public interface Option extends Cloneable, ObjectWithId { * * @return The key of the {@code BooleanOption} that needs to be enabled. */ - public String getEnabledBy(); + String getEnabledBy(); /** * Initializes this object from an XML-representation of this object. @@ -82,7 +82,7 @@ public interface Option extends Cloneable, ObjectWithId { * @param xr The input stream with the XML. * @throws XMLStreamException if there are any problems reading the stream. */ - public void readFromXML(FreeColXMLReader xr) throws XMLStreamException; + void readFromXML(FreeColXMLReader xr) throws XMLStreamException; /** * Makes an XML-representation of this object. @@ -90,11 +90,11 @@ public interface Option extends Cloneable, ObjectWithId { * @param xw The {@code FreeColXMLWriter} to write to. * @throws XMLStreamException if there are any problems writing the stream. */ - public void toXML(FreeColXMLWriter xw) throws XMLStreamException; + void toXML(FreeColXMLWriter xw) throws XMLStreamException; /** * {@inheritDoc} */ @Override - public String toString(); + String toString(); } diff --git a/src/net/sf/freecol/common/option/OptionContainer.java b/src/net/sf/freecol/common/option/OptionContainer.java index 1a2424e560..11260112a1 100644 --- a/src/net/sf/freecol/common/option/OptionContainer.java +++ b/src/net/sf/freecol/common/option/OptionContainer.java @@ -40,7 +40,7 @@ public interface OptionContainer { * @param returnClass The expected option class. * @return True if the option is present. */ - public boolean hasOption(String id, Class returnClass); + boolean hasOption(String id, Class returnClass); /** * Get an option in this group (or descendents) by object identifier. @@ -51,7 +51,7 @@ public interface OptionContainer { * @return The option, or a run time exception if the option does not * exist or is of the wrong class. */ - public T getOption(String id, Class returnClass); + T getOption(String id, Class returnClass); /** * Gets the value of a {@code BooleanOption}. diff --git a/src/net/sf/freecol/common/option/UnitTypeOption.java b/src/net/sf/freecol/common/option/UnitTypeOption.java index 7b2f8b68c3..fbb8994d67 100644 --- a/src/net/sf/freecol/common/option/UnitTypeOption.java +++ b/src/net/sf/freecol/common/option/UnitTypeOption.java @@ -46,7 +46,7 @@ public class UnitTypeOption extends AbstractOption { /** * FIXME: replace with Predicates. */ - public static enum TypeSelector { + public enum TypeSelector { UNITS, IMMIGRANTS, LAND_UNITS, NAVAL_UNITS } diff --git a/src/net/sf/freecol/server/FreeColServer.java b/src/net/sf/freecol/server/FreeColServer.java index 9083545b30..1a55e32d72 100644 --- a/src/net/sf/freecol/server/FreeColServer.java +++ b/src/net/sf/freecol/server/FreeColServer.java @@ -166,7 +166,7 @@ public final class FreeColServer { public static final String DEFAULT_SPEC = "freecol"; /** The server is either starting, loading, being played, or ending. */ - public static enum ServerState { + public enum ServerState { PRE_GAME(0), LOAD_GAME(0), IN_GAME(1), diff --git a/src/net/sf/freecol/server/ai/Cargo.java b/src/net/sf/freecol/server/ai/Cargo.java index 5745a3907d..7883b52c12 100644 --- a/src/net/sf/freecol/server/ai/Cargo.java +++ b/src/net/sf/freecol/server/ai/Cargo.java @@ -58,7 +58,7 @@ public final class Cargo { private static final int MAX_TRY = 3; /** The actions to perform at the target. */ - public static enum CargoMode { + public enum CargoMode { LOAD, // Go to target and load transportable UNLOAD, // Go to target and unload transportable PICKUP, // Go to drop node target, transportable unit to embark diff --git a/src/net/sf/freecol/server/ai/ColonyPlan.java b/src/net/sf/freecol/server/ai/ColonyPlan.java index 3eb600cd51..63633650ab 100644 --- a/src/net/sf/freecol/server/ai/ColonyPlan.java +++ b/src/net/sf/freecol/server/ai/ColonyPlan.java @@ -128,7 +128,7 @@ public String toString() { private static final int PRODUCTION_TURNOVER_TURNS = 5; /** The profile of the colony (a sort of general flavour). */ - private static enum ProfileType { + private enum ProfileType { OUTPOST, SMALL, MEDIUM, diff --git a/src/net/sf/freecol/server/ai/mission/TransportMission.java b/src/net/sf/freecol/server/ai/mission/TransportMission.java index 2940c73244..cd2ecb05be 100644 --- a/src/net/sf/freecol/server/ai/mission/TransportMission.java +++ b/src/net/sf/freecol/server/ai/mission/TransportMission.java @@ -71,7 +71,7 @@ public final class TransportMission extends Mission { private static final String tag = "AI transport"; - private static enum CargoResult { + private enum CargoResult { TCONTINUE, // Cargo should continue TDONE, // Cargo completed successfully TFAIL, // Cargo failed badly diff --git a/src/net/sf/freecol/server/generator/MapLayerGenerator.java b/src/net/sf/freecol/server/generator/MapLayerGenerator.java index e90e75ccbd..0f91ef2051 100644 --- a/src/net/sf/freecol/server/generator/MapLayerGenerator.java +++ b/src/net/sf/freecol/server/generator/MapLayerGenerator.java @@ -34,13 +34,13 @@ public interface MapLayerGenerator { * @param game a {@code Game} value * @return a {@code boolean} value */ - public boolean generateLayer(Game game); + boolean generateLayer(Game game); /** * Returns the Layer this MapLayerGenerator is able to generate. * * @return a {@code Layer} value */ - public Layer getLayer(); + Layer getLayer(); } \ No newline at end of file diff --git a/src/net/sf/freecol/server/generator/MapLoader.java b/src/net/sf/freecol/server/generator/MapLoader.java index bfd2aaa509..aee88e002d 100644 --- a/src/net/sf/freecol/server/generator/MapLoader.java +++ b/src/net/sf/freecol/server/generator/MapLoader.java @@ -35,7 +35,7 @@ public interface MapLoader { * @param layer a {@code Layer} value * @return a {@code Layer} value */ - public Layer loadMap(Game game, Layer layer); + Layer loadMap(Game game, Layer layer); /** @@ -43,6 +43,6 @@ public interface MapLoader { * * @return a {@code Layer} value */ - public Layer getHighestLayer(); + Layer getHighestLayer(); } \ No newline at end of file diff --git a/src/net/sf/freecol/server/generator/River.java b/src/net/sf/freecol/server/generator/River.java index e2086de781..c81b7ad18b 100644 --- a/src/net/sf/freecol/server/generator/River.java +++ b/src/net/sf/freecol/server/generator/River.java @@ -49,7 +49,7 @@ public class River { * Possible direction changes for a river. * @see net.sf.freecol.common.model.Map */ - private static enum DirectionChange { + private enum DirectionChange { STRAIGHT_AHEAD, RIGHT_TURN, LEFT_TURN; diff --git a/src/net/sf/freecol/server/model/ServerPlayer.java b/src/net/sf/freecol/server/model/ServerPlayer.java index 43c121b038..008ce02784 100644 --- a/src/net/sf/freecol/server/model/ServerPlayer.java +++ b/src/net/sf/freecol/server/model/ServerPlayer.java @@ -146,7 +146,7 @@ public class ServerPlayer extends Player implements TurnTaker { public static final int ALARM_TILE_IN_USE = 2; // checkForDeath result type - public static enum DeadCheck { + public enum DeadCheck { IS_DEAD, IS_DEFEATED, IS_AUTORECRUIT, diff --git a/src/net/sf/freecol/server/model/TurnTaker.java b/src/net/sf/freecol/server/model/TurnTaker.java index 10916cbc3e..0fe9805ce6 100644 --- a/src/net/sf/freecol/server/model/TurnTaker.java +++ b/src/net/sf/freecol/server/model/TurnTaker.java @@ -37,5 +37,5 @@ public interface TurnTaker { * @param lb A {@code LogBuilder} to log to. * @param cs A {@code ChangeSet} to update. */ - public void csNewTurn(Random random, LogBuilder lb, ChangeSet cs); + void csNewTurn(Random random, LogBuilder lb, ChangeSet cs); } From bbce18786382c9ea54475a80ea3cdff200b0fa87 Mon Sep 17 00:00:00 2001 From: FlavianIuga <121820069+FlavianIuga@users.noreply.github.com> Date: Wed, 25 Jan 2023 16:22:50 +0200 Subject: [PATCH 4/4] Miscellaneous code cleanup --- src/net/sf/freecol/client/control/ConnectController.java | 4 +--- src/net/sf/freecol/client/gui/animation/Animations.java | 2 +- src/net/sf/freecol/client/gui/dialog/Flag.java | 4 ++-- src/net/sf/freecol/client/gui/dialog/FreeColDialog.java | 2 +- .../sf/freecol/client/gui/dialog/NegotiationDialog.java | 8 ++++---- .../client/gui/images/BaseTileTransitionImageCreator.java | 2 +- src/net/sf/freecol/client/gui/menu/InGameMenuBar.java | 2 +- src/net/sf/freecol/client/gui/option/OptionGroupUI.java | 2 +- src/net/sf/freecol/client/gui/panel/ColonyPanel.java | 3 +-- .../sf/freecol/client/gui/panel/FreeColImageBorder.java | 4 ++-- src/net/sf/freecol/client/gui/panel/MainPanel.java | 3 +-- src/net/sf/freecol/client/gui/panel/NewPanel.java | 2 +- 12 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/net/sf/freecol/client/control/ConnectController.java b/src/net/sf/freecol/client/control/ConnectController.java index e1cdac20d7..64faf9bd3f 100644 --- a/src/net/sf/freecol/client/control/ConnectController.java +++ b/src/net/sf/freecol/client/control/ConnectController.java @@ -154,9 +154,7 @@ public boolean logout(LogoutReason reason) { switch (reason) { case DEFEATED: case QUIT: fcc.logout(false); - SwingUtilities.invokeLater(() -> { - mainTitle(); - }); + SwingUtilities.invokeLater(this::mainTitle); break; case LOGIN: // Occurs when you Open a new game during a current one fcc.logout(false); diff --git a/src/net/sf/freecol/client/gui/animation/Animations.java b/src/net/sf/freecol/client/gui/animation/Animations.java index 2ec61fc85d..5d3bd1844b 100644 --- a/src/net/sf/freecol/client/gui/animation/Animations.java +++ b/src/net/sf/freecol/client/gui/animation/Animations.java @@ -42,7 +42,7 @@ public class Animations { */ public interface Procedure { void execute(); - }; + } /** * Collect animations for a unit move. diff --git a/src/net/sf/freecol/client/gui/dialog/Flag.java b/src/net/sf/freecol/client/gui/dialog/Flag.java index e510250148..15d9dc8032 100644 --- a/src/net/sf/freecol/client/gui/dialog/Flag.java +++ b/src/net/sf/freecol/client/gui/dialog/Flag.java @@ -123,7 +123,7 @@ public UnionShape getUnionShape() { public Set getUnionPositions() { return this.unionPositions; } - }; + } /** * The shape of the "union", which generally depends on the @@ -135,7 +135,7 @@ public enum UnionShape { CHEVRON, BEND, RHOMBUS - }; + } /** * The position of the "union", which depends on the alignment of diff --git a/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java b/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java index 821dd681d0..983202aa91 100644 --- a/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java +++ b/src/net/sf/freecol/client/gui/dialog/FreeColDialog.java @@ -72,7 +72,7 @@ public class FreeColDialog extends JDialog implements PropertyChangeListener public enum DialogType { PLAIN, QUESTION, - }; + } /** The enclosing client. */ protected final FreeColClient freeColClient; diff --git a/src/net/sf/freecol/client/gui/dialog/NegotiationDialog.java b/src/net/sf/freecol/client/gui/dialog/NegotiationDialog.java index 806e7a1de3..8569abac66 100644 --- a/src/net/sf/freecol/client/gui/dialog/NegotiationDialog.java +++ b/src/net/sf/freecol/client/gui/dialog/NegotiationDialog.java @@ -365,7 +365,7 @@ public GoodsTradeItemPanel(Player source, List allGoods) { super(new MigLayout("wrap 1", "", "")); this.source = source; - this.goodsBox = new JComboBox<>(new DefaultComboBoxModel()); + this.goodsBox = new JComboBox<>(new DefaultComboBoxModel<>()); this.goodsBox.setRenderer(new GoodsBoxRenderer()); this.clearButton = Utility.localizedButton("negotiationDialog.clear"); this.clearButton.addActionListener(this); @@ -494,7 +494,7 @@ public InciteTradeItemPanel(Player source, Player other) { this.source = source; this.other = other; - this.victimBox = new JComboBox<>(new DefaultComboBoxModel()); + this.victimBox = new JComboBox<>(new DefaultComboBoxModel<>()); this.victimBox.setRenderer(new InciteBoxRenderer()); this.clearButton = Utility.localizedButton("negotiationDialog.clear"); this.clearButton.addActionListener(this); @@ -615,7 +615,7 @@ public StanceTradeItemPanel(Player source, Player target) { this.source = source; this.target = target; - this.stanceBox = new JComboBox<>(new DefaultComboBoxModel()); + this.stanceBox = new JComboBox<>(new DefaultComboBoxModel<>()); this.stanceBox.setRenderer(new StanceBoxRenderer()); this.clearButton = Utility.localizedButton("negotiationDialog.clear"); this.clearButton.addActionListener(this); @@ -733,7 +733,7 @@ public UnitTradeItemPanel(Player source, List allUnits) { super(new MigLayout("wrap 1", "", "")); this.source = source; - this.unitBox = new JComboBox<>(new DefaultComboBoxModel()); + this.unitBox = new JComboBox<>(new DefaultComboBoxModel<>()); this.unitBox.setRenderer(new UnitBoxRenderer()); this.clearButton = Utility.localizedButton("negotiationDialog.clear"); this.clearButton.addActionListener(this); diff --git a/src/net/sf/freecol/client/gui/images/BaseTileTransitionImageCreator.java b/src/net/sf/freecol/client/gui/images/BaseTileTransitionImageCreator.java index df872e9e06..52d47ec9b5 100644 --- a/src/net/sf/freecol/client/gui/images/BaseTileTransitionImageCreator.java +++ b/src/net/sf/freecol/client/gui/images/BaseTileTransitionImageCreator.java @@ -253,7 +253,7 @@ private ImageResource getTerrainOrBeachImageResource(Tile tile, final Tile borde return null; } final ImageResource terrainImageResource; - final boolean notABeachTransition = borderingTile.isLand() || !borderingTile.isLand() && !tile.isLand();; + final boolean notABeachTransition = borderingTile.isLand() || !borderingTile.isLand() && !tile.isLand(); if (notABeachTransition) { terrainImageResource = ImageCache.getImageResource(ImageLibrary.getTerrainImageKey(borderingTile.getType())); } else { diff --git a/src/net/sf/freecol/client/gui/menu/InGameMenuBar.java b/src/net/sf/freecol/client/gui/menu/InGameMenuBar.java index 84809e371f..fac8fb722b 100644 --- a/src/net/sf/freecol/client/gui/menu/InGameMenuBar.java +++ b/src/net/sf/freecol/client/gui/menu/InGameMenuBar.java @@ -334,7 +334,7 @@ public void paintComponent(Graphics g) { final FontMetrics fm = g2d.getFontMetrics(); final Rectangle2D d = fm.getStringBounds(text, g2d); final int textWidth = (int) d.getWidth(); - final int textHeight = (int) d.getHeight();; + final int textHeight = (int) d.getHeight(); final int rightSidePaddingInPx = 10; final int centerHeight = getHeight() - getInsets().bottom; diff --git a/src/net/sf/freecol/client/gui/option/OptionGroupUI.java b/src/net/sf/freecol/client/gui/option/OptionGroupUI.java index 316af62f44..415430c974 100644 --- a/src/net/sf/freecol/client/gui/option/OptionGroupUI.java +++ b/src/net/sf/freecol/client/gui/option/OptionGroupUI.java @@ -84,7 +84,7 @@ public String convertValueToText(Object value, boolean selected, Option option = (Option)node.getUserObject(); return Messages.getName(option.getId()); } - }; + } private final List optionUpdaters = new ArrayList<>(); diff --git a/src/net/sf/freecol/client/gui/panel/ColonyPanel.java b/src/net/sf/freecol/client/gui/panel/ColonyPanel.java index f1bfd6a983..bc5e14d6d6 100644 --- a/src/net/sf/freecol/client/gui/panel/ColonyPanel.java +++ b/src/net/sf/freecol/client/gui/panel/ColonyPanel.java @@ -1276,8 +1276,7 @@ public void update() { */ @Override public JToolTip createToolTip() { - JToolTip toolTip = new RebelToolTip(getFreeColClient(), getColony()); - return toolTip; + return new RebelToolTip(getFreeColClient(), getColony()); } diff --git a/src/net/sf/freecol/client/gui/panel/FreeColImageBorder.java b/src/net/sf/freecol/client/gui/panel/FreeColImageBorder.java index c8e0e44b55..0950b8fbe5 100644 --- a/src/net/sf/freecol/client/gui/panel/FreeColImageBorder.java +++ b/src/net/sf/freecol/client/gui/panel/FreeColImageBorder.java @@ -187,8 +187,8 @@ private BufferedImage getImage(String key) { return image; } final Dimension scaledDimensions = new Dimension( - (int) Math.round(image.getWidth() * scaleFactor), - (int) Math.round(image.getHeight() * scaleFactor) + Math.round(image.getWidth() * scaleFactor), + Math.round(image.getHeight() * scaleFactor) ); return ir.getImage(scaledDimensions, false); } diff --git a/src/net/sf/freecol/client/gui/panel/MainPanel.java b/src/net/sf/freecol/client/gui/panel/MainPanel.java index 196b116660..8da0f3657f 100644 --- a/src/net/sf/freecol/client/gui/panel/MainPanel.java +++ b/src/net/sf/freecol/client/gui/panel/MainPanel.java @@ -101,8 +101,7 @@ public MainPanel(FreeColClient freeColClient) { } private JButton createImportantButton(Action action) { - final FreeColButton button = new FreeColButton(ButtonStyle.IMPORTANT, action); - return button; + return new FreeColButton(ButtonStyle.IMPORTANT, action); } diff --git a/src/net/sf/freecol/client/gui/panel/NewPanel.java b/src/net/sf/freecol/client/gui/panel/NewPanel.java index 3f05802693..c0f966b3d2 100644 --- a/src/net/sf/freecol/client/gui/panel/NewPanel.java +++ b/src/net/sf/freecol/client/gui/panel/NewPanel.java @@ -73,7 +73,7 @@ private enum NewPanelAction { START, META_SERVER, SHOW_DIFFICULTY - }; + } /** * A particular specification to use for the new game. If not