Compare commits

...

5 Commits

Author SHA1 Message Date
FlavianIuga 65cec4f0ca
Merge bbce187863 into a6346d8078 2024-04-09 20:50:31 +02:00
FlavianIuga bbce187863 Miscellaneous code cleanup 2023-01-25 16:22:50 +02:00
FlavianIuga 4db447e9e6 Removed unnecessary modifiers - code cleanup 2023-01-25 14:56:52 +02:00
FlavianIuga 44724605f8 Move array indicators on type declaration - code cleanup 2023-01-25 14:23:03 +02:00
FlavianIuga a17ccaa226 Reordering modifiers - code cleanup 2023-01-25 14:19:54 +02:00
103 changed files with 238 additions and 242 deletions

View File

@ -154,9 +154,7 @@ public final class ConnectController extends FreeColClientHolder {
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);

View File

@ -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;

View File

@ -54,7 +54,7 @@ public class FontLibrary {
* <li>HEADER -- a stylized old-fashioned typeface for headers</li>
* </ul>
*/
public static enum FontType {
public enum FontType {
NORMAL,
SIMPLE,
HEADER

View File

@ -116,7 +116,7 @@ public class GUI extends FreeColClientHolder {
};
/** Levels (danger, finance) for confirmEuropeanTribute(). */
private static final String levels[] = { "low", "normal", "high" };
private static final String[] levels = { "low", "normal", "high" };
/**

View File

@ -138,7 +138,7 @@ import net.sf.freecol.common.util.Utils;
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,

View File

@ -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;

View File

@ -39,7 +39,7 @@ public final class DisplayTileTextAction extends SelectableOptionAction {
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() {

View File

@ -41,8 +41,8 @@ public class Animations {
* used as a callback for an animation to trigger painting.
*/
public interface Procedure {
public void execute();
};
void execute();
}
/**
* Collect animations for a unit move.

View File

@ -96,7 +96,7 @@ public final class UnitImageAnimation extends Animation {
* @param direction The preferred {@code Direction}.
* @return A list of {@code Direction}s.
*/
private synchronized static List<Direction> trialDirections(Direction direction) {
private static synchronized List<Direction> trialDirections(Direction direction) {
if (alternatives.isEmpty()) { // Populate first time
// Favour the closest E-W cases
for (Direction d : Direction.allDirections) {

View File

@ -123,7 +123,7 @@ public class Flag {
public Set<UnionPosition> getUnionPositions() {
return this.unionPositions;
}
};
}
/**
* The shape of the "union", which generally depends on the
@ -135,7 +135,7 @@ public class Flag {
CHEVRON,
BEND,
RHOMBUS
};
}
/**
* The position of the "union", which depends on the alignment of

View File

@ -69,10 +69,10 @@ public class FreeColDialog<T> extends JDialog implements PropertyChangeListener
private static final Logger logger = Logger.getLogger(FreeColDialog.class.getName());
public static enum DialogType {
public enum DialogType {
PLAIN,
QUESTION,
};
}
/** The enclosing client. */
protected final FreeColClient freeColClient;

View File

@ -365,7 +365,7 @@ public final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
super(new MigLayout("wrap 1", "", ""));
this.source = source;
this.goodsBox = new JComboBox<>(new DefaultComboBoxModel<Goods>());
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 final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
this.source = source;
this.other = other;
this.victimBox = new JComboBox<>(new DefaultComboBoxModel<Player>());
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 final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
this.source = source;
this.target = target;
this.stanceBox = new JComboBox<>(new DefaultComboBoxModel<Stance>());
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 final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
super(new MigLayout("wrap 1", "", ""));
this.source = source;
this.unitBox = new JComboBox<>(new DefaultComboBoxModel<Unit>());
this.unitBox = new JComboBox<>(new DefaultComboBoxModel<>());
this.unitBox.setRenderer(new UnitBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);

View File

@ -253,7 +253,7 @@ public final class BaseTileTransitionImageCreator {
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 {

View File

@ -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();
}

View File

@ -27,5 +27,5 @@ public interface Draggable {
*
* @return True if the object is on a carrier.
*/
public boolean isOnCarrier();
boolean isOnCarrier();
}

View File

@ -106,7 +106,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

View File

@ -84,7 +84,7 @@ public final class OptionGroupUI extends MigPanel
Option option = (Option)node.getUserObject();
return Messages.getName(option.getId());
}
};
}
private final List<OptionUpdater> optionUpdaters = new ArrayList<>();

View File

@ -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();
}

View File

@ -1602,8 +1602,7 @@ public final class ColonyPanel extends PortPanel
*/
@Override
public JToolTip createToolTip() {
JToolTip toolTip = new RebelToolTip(getFreeColClient(), getColony());
return toolTip;
return new RebelToolTip(getFreeColClient(), getColony());
}

View File

@ -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 interface DropTarget {
* @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 interface DropTarget {
* @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 interface DropTarget {
* 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 interface DropTarget {
* @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
}
}

View File

@ -592,7 +592,7 @@ public final class EuropePanel extends PortPanel {
}
public static enum EuropeAction {
public enum EuropeAction {
EXIT,
RECRUIT,
PURCHASE,

View File

@ -88,7 +88,7 @@ public final class FindSettlementPanel extends FreeColPanel
}
}
private static enum DisplayListOption {
private enum DisplayListOption {
ALL,
ONLY_NATIVES,
ONLY_EUROPEAN

View File

@ -258,8 +258,8 @@ public class FreeColImageBorder extends AbstractBorder {
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);
}

View File

@ -74,7 +74,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;
}

View File

@ -101,8 +101,7 @@ public final class MainPanel extends FreeColPanel {
}
private JButton createImportantButton(Action action) {
final FreeColButton button = new FreeColButton(ButtonStyle.IMPORTANT, action);
return button;
return new FreeColButton(ButtonStyle.IMPORTANT, action);
}

View File

@ -66,7 +66,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,
@ -74,7 +74,7 @@ public final class NewPanel extends FreeColPanel implements ItemListener {
START,
META_SERVER,
SHOW_DIFFICULTY
};
}
/**
* A particular specification to use for the new game. If not

View File

@ -35,7 +35,7 @@ public interface ColopediaDetailPanel<T> {
*
* @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<T> {
* @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);
}

View File

@ -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

View File

@ -113,7 +113,7 @@ public class FreeColLookAndFeel extends MetalLookAndFeel {
private static final String transparentPanelUI
= "net.sf.freecol.client.gui.plaf.FreeColTransparentPanelUI";
private static final Class uiClasses[] = {
private static final Class[] uiClasses = {
FreeColButtonUI.class,
FreeColCheckBoxMenuItemUI.class,
FreeColCheckBoxUI.class,

View File

@ -27,5 +27,5 @@ public interface VideoListener {
/**
* Called when a playback has stopped.
*/
public void stopped();
void stopped();
}

View File

@ -31,5 +31,5 @@ public interface ObjectWithId {
*
* @return The object identifier.
*/
public String getId();
String getId();
}

View File

@ -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

View File

@ -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. */

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -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();
}

View File

@ -121,7 +121,7 @@ public class MetaServerUtils {
null, -1, -1, -1, false, null, -1);
/** Type of message to send. */
private static enum MetaMessageType {
private enum MetaMessageType {
REGISTER,
REMOVE,
SERVERLIST,

View File

@ -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 interface BaseProduction {
* @param unattended Whether the production is unattended.
* @return A list of {@code ProductionType}s.
*/
public abstract List<ProductionType> getAvailableProductionTypes(boolean unattended);
List<ProductionType> getAvailableProductionTypes(boolean unattended);
}

View File

@ -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";

View File

@ -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 class Colony extends Settlement implements TradeLocation {
}
/** Reasons for not building a buildable. */
public static enum NoBuildReason {
public enum NoBuildReason {
NONE,
NOT_BUILDING,
NOT_BUILDABLE,

View File

@ -31,7 +31,7 @@ import java.util.Set;
*/
public abstract class CombatModel {
public static enum CombatEffectType {
public enum CombatEffectType {
// Special results that set the sense of the result.
NO_RESULT,
LOSE,

View File

@ -28,13 +28,13 @@ package net.sf.freecol.common.model;
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 interface Constants {
};
/** 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

View File

@ -33,39 +33,39 @@ import java.util.stream.Stream;
public interface Consumer {
/** Compare consumers by descending priority. */
public static final Comparator<Consumer> COMPARATOR
Comparator<Consumer> 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<AbstractGoods> getConsumedGoods();
List<AbstractGoods> 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<Modifier> getConsumptionModifiers(String id);
Stream<Modifier> getConsumptionModifiers(String id);
}

View File

@ -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 class DiplomaticTrade extends FreeColGameObject {
}
/** A type for the trade status. */
public static enum TradeStatus {
public enum TradeStatus {
PROPOSE_TRADE,
ACCEPT_TRADE,
REJECT_TRADE

View File

@ -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<Direction> allDirections
= makeUnmodifiableList(Direction.N, Direction.NE,

View File

@ -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. */

View File

@ -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

View File

@ -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,

View File

@ -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);
}

View File

@ -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 class Game extends FreeColGameObject {
};
/** State for the FCGO iterator, out here because it has to be static. */
private static enum FcgoState {
private enum FcgoState {
INVALID,
VALID,
CONSUMED,

View File

@ -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),

View File

@ -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,

View File

@ -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

View File

@ -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
}

View File

@ -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();
}

View File

@ -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<Unit> getUnits();
Stream<Unit> getUnits();
/**
* Gets a list of all the units present at this location.
*
* @return A list of all the units at this location.
*/
public List<Unit> getUnitList();
List<Unit> 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 interface Location extends ObjectWithId {
* @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 interface Location extends ObjectWithId {
*
* @return A key for image lookup, null by default.
*/
public default String getLocationImageKey() {
default String getLocationImageKey() {
return null;
}
}

View File

@ -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,

View File

@ -84,19 +84,19 @@ public class Map extends FreeColGameObject implements Location, Iterable<Tile> {
* 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
* 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
* natural tile improvements that are not resources.
*/
public static enum Layer {
public enum Layer {
NONE, LAND, TERRAIN, REGIONS, RIVERS, RESOURCES, RUMOURS, NATIVES, ALL;
};

View File

@ -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,
}

View File

@ -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
@ -284,7 +284,7 @@ public class ModelMessage extends StringTemplate {
* @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) {

View File

@ -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

View File

@ -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,

View File

@ -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();
}

View File

@ -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);
}

View File

@ -33,5 +33,5 @@ public interface Named {
*
* @return The name of the {@code Named}.
*/
public String getNameKey();
String getNameKey();
}

View File

@ -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 class NationOptions extends FreeColSpecObject {
* 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;

View File

@ -36,7 +36,7 @@ import static net.sf.freecol.common.util.StringUtils.*;
*/
public abstract class NationType extends FreeColSpecObjectType {
public static enum SettlementNumber {
public enum SettlementNumber {
LOW, AVERAGE, HIGH;
/**
@ -49,7 +49,7 @@ public abstract class NationType extends FreeColSpecObjectType {
}
}
public static enum AggressionLevel {
public enum AggressionLevel {
LOW, AVERAGE, HIGH;
/**

View File

@ -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

View File

@ -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
}

View File

@ -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);
}

View File

@ -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 class Player extends FreeColGameObject implements Nameable {
}
/** 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 class Player extends FreeColGameObject implements Nameable {
* 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

View File

@ -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),

View File

@ -91,7 +91,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;
}
/**
@ -794,7 +794,7 @@ public final class Specification implements OptionContainer {
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 {

View File

@ -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;

View File

@ -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),

View File

@ -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;

View File

@ -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 interface TradeLocation {
*
* @return True if possible, false by default.
*/
public default boolean canBeInput() {
default boolean canBeInput() {
return false;
}
}

View File

@ -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);
}

View File

@ -189,7 +189,7 @@ public class Unit extends GoodsLocation
!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 class Unit extends GoodsLocation
}
/** Internal state for findIntermediatePort. */
private static enum PortMode {
private enum PortMode {
LAKE,
NO_HIGH_SEAS,
BLOCKED,
@ -387,7 +387,7 @@ public class Unit extends GoodsLocation
}
/** 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 class Unit extends GoodsLocation
*
* @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),

View File

@ -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.
*/

View File

@ -154,7 +154,7 @@ public class CompoundMission extends AbstractMission {
// Serialization.
private final static String INDEX_TAG = "index";
private static final String INDEX_TAG = "index";
/**

View File

@ -34,7 +34,7 @@ import net.sf.freecol.common.model.Unit;
*/
public interface Mission {
public static enum MissionState {
enum MissionState {
/**
* Mission is in progress.
*/
@ -61,7 +61,7 @@ public interface Mission {
*
* @return a {@code MissionState} value
*/
public MissionState doMission();
MissionState doMission();
/**
@ -72,7 +72,7 @@ public interface Mission {
*
* @return a {@code boolean} value
*/
public boolean isValid();
boolean isValid();
/**
@ -80,7 +80,7 @@ public interface Mission {
*
* @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 interface Mission {
* @throws XMLStreamException if there are any problems writing
* to the stream.
*/
public void toXML(FreeColXMLWriter xw) throws XMLStreamException;
void toXML(FreeColXMLWriter xw) throws XMLStreamException;
}

View File

@ -31,7 +31,7 @@ import net.sf.freecol.common.model.Unit;
*/
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 interface CostDecider {
*
* @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();
}

View File

@ -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);
}

View File

@ -56,7 +56,7 @@ import net.sf.freecol.common.option.GameOptions;
* 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;

View File

@ -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<String, Constructor<? extends Message>> builders
private static final Map<String, Constructor<? extends Message>> builders
= Collections.synchronizedMap(new HashMap<String,
Constructor<? extends Message>>());
@ -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
@ -114,14 +114,14 @@ public abstract class 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 @@ public abstract class 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 @@ public abstract class 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 @@ public abstract class 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<String,String> getStringAttributeMap();
protected abstract Map<String,String> 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<FreeColObject> getChildren();
protected abstract List<FreeColObject> 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<? extends FreeColObject> fcos);
protected abstract void setChildren(List<? extends FreeColObject> fcos);
/**
* Append a new child.
@ -181,7 +181,7 @@ public abstract class Message {
* @param <T> The child type.
* @param fco The new child object.
*/
abstract protected <T extends FreeColObject> void appendChild(T fco);
protected abstract <T extends FreeColObject> void appendChild(T fco);
/**
* Append a multiple new children.
@ -189,21 +189,21 @@ public abstract class Message {
* @param <T> The child type.
* @param fcos The new child objects.
*/
abstract protected <T extends FreeColObject> void appendChildren(Collection<T> fcos);
protected abstract <T extends FreeColObject> void appendChildren(Collection<T> 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 abstract class Message {
* @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 @@ public abstract class Message {
* @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 @@ public abstract class Message {
* @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);

View File

@ -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 interface MessageHandler {
* @exception XMLStreamException if there is a problem reading the
* message.
*/
public Message read(Connection connection)
Message read(Connection connection)
throws FreeColException, XMLStreamException;
}

View File

@ -38,35 +38,35 @@ public interface Option<T> extends Cloneable, ObjectWithId {
* @return A clone of this option.
* @exception CloneNotSupportedException if we can not clone.
*/
public Option<T> cloneOption() throws CloneNotSupportedException;
Option<T> 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<T> 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<T> 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<T> 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();
}

View File

@ -40,7 +40,7 @@ public interface OptionContainer {
* @param returnClass The expected option class.
* @return True if the option is present.
*/
public <T extends Option> boolean hasOption(String id, Class<T> returnClass);
<T extends Option> boolean hasOption(String id, Class<T> 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 extends Option> T getOption(String id, Class<T> returnClass);
<T extends Option> T getOption(String id, Class<T> returnClass);
/**
* Gets the value of a {@code BooleanOption}.

View File

@ -46,7 +46,7 @@ public class UnitTypeOption extends AbstractOption<UnitType> {
/**
* FIXME: replace with Predicates.
*/
public static enum TypeSelector {
public enum TypeSelector {
UNITS, IMMIGRANTS, LAND_UNITS, NAVAL_UNITS
}

View File

@ -76,7 +76,7 @@ public class OSUtils {
*
* @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 @@ public class OSUtils {
*
* @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 };

View File

@ -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),

View File

@ -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

View File

@ -128,7 +128,7 @@ public class ColonyPlan {
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,

View File

@ -77,7 +77,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

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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,

Some files were not shown because too many files have changed in this diff Show More