Reordering modifiers - code cleanup

This commit is contained in:
FlavianIuga 2023-01-25 14:19:54 +02:00
parent 09e354a091
commit a17ccaa226
11 changed files with 30 additions and 30 deletions

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

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

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

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

@ -90,7 +90,7 @@ public class Map extends FreeColGameObject implements Location {
* 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

View File

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

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

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

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

@ -27,9 +27,9 @@ import java.util.Arrays;
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"
};