Added lots of 'final' modifiers to class fields where applicable.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-08-20 21:11:55 -05:00
parent 0a7aef7347
commit 441bb95a09
22 changed files with 74 additions and 74 deletions

View File

@ -90,7 +90,7 @@ public class GameData {
D (GameImage.RANKING_D, GameImage.RANKING_D_SMALL); D (GameImage.RANKING_D, GameImage.RANKING_D_SMALL);
/** GameImages associated with this grade (large and small sizes). */ /** GameImages associated with this grade (large and small sizes). */
private GameImage large, small; private final GameImage large, small;
/** Large-size image scaled for use in song menu. */ /** Large-size image scaled for use in song menu. */
private Image menuImage; private Image menuImage;
@ -202,14 +202,14 @@ public class GameData {
*/ */
private class HitErrorInfo { private class HitErrorInfo {
/** The correct hit time. */ /** The correct hit time. */
private int time; private final int time;
/** The coordinates of the hit. */ /** The coordinates of the hit. */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private int x, y; private final int x, y;
/** The difference between the correct and actual hit times. */ /** The difference between the correct and actual hit times. */
private int timeDiff; private final int timeDiff;
/** /**
* Constructor. * Constructor.
@ -235,32 +235,32 @@ public class GameData {
/** Hit result helper class. */ /** Hit result helper class. */
private class HitObjectResult { private class HitObjectResult {
/** Object start time. */ /** Object start time. */
public int time; public final int time;
/** Hit result. */ /** Hit result. */
public int result; public final int result;
/** Object coordinates. */ /** Object coordinates. */
public float x, y; public final float x, y;
/** Combo color. */ /** Combo color. */
public Color color; public final Color color;
/** The type of the hit object. */ /** The type of the hit object. */
public HitObjectType hitResultType; public final HitObjectType hitResultType;
/** Slider curve. */
public final Curve curve;
/** Whether or not to expand when animating. */
public final boolean expand;
/** Whether or not to hide the hit result. */
public final boolean hideResult;
/** Alpha level (for fading out). */ /** Alpha level (for fading out). */
public float alpha = 1f; public float alpha = 1f;
/** Slider curve. */
public Curve curve;
/** Whether or not to expand when animating. */
public boolean expand;
/** Whether or not to hide the hit result. */
public boolean hideResult;
/** /**
* Constructor. * Constructor.
* @param time the result's starting track position * @param time the result's starting track position

View File

@ -359,22 +359,22 @@ public enum GameImage {
IMG_JPG = 2; IMG_JPG = 2;
/** The file name. */ /** The file name. */
private String filename; private final String filename;
/** The formatted file name string (for loading multiple images). */ /** The formatted file name string (for loading multiple images). */
private String filenameFormat; private String filenameFormat;
/** Image file type. */ /** Image file type. */
private byte type; private final byte type;
/** /**
* Whether or not the image is skinnable by a beatmap. * Whether or not the image is skinnable by a beatmap.
* These images are typically related to gameplay. * These images are typically related to gameplay.
*/ */
private boolean skinnable; private final boolean skinnable;
/** Whether or not to preload the image when the program starts. */ /** Whether or not to preload the image when the program starts. */
private boolean preload; private final boolean preload;
/** The default image. */ /** The default image. */
private Image defaultImage; private Image defaultImage;

View File

@ -69,13 +69,13 @@ public enum GameMod {
SPECIAL (2, "Special", Color.white); SPECIAL (2, "Special", Color.white);
/** Drawing index. */ /** Drawing index. */
private int index; private final int index;
/** Category name. */ /** Category name. */
private String name; private final String name;
/** Text color. */ /** Text color. */
private Color color; private final Color color;
/** The coordinates of the category. */ /** The coordinates of the category. */
private float x, y; private float x, y;
@ -126,37 +126,37 @@ public enum GameMod {
} }
/** The category for the mod. */ /** The category for the mod. */
private Category category; private final Category category;
/** The index in the category (for positioning). */ /** The index in the category (for positioning). */
private int categoryIndex; private final int categoryIndex;
/** The file name of the mod image. */ /** The file name of the mod image. */
private GameImage image; private final GameImage image;
/** The abbreviation for the mod. */ /** The abbreviation for the mod. */
private String abbrev; private final String abbrev;
/** /**
* Bit value associated with the mod. * Bit value associated with the mod.
* See the osu! API: https://github.com/peppy/osu-api/wiki#mods * See the osu! API: https://github.com/peppy/osu-api/wiki#mods
*/ */
private int bit; private final int bit;
/** The shortcut key associated with the mod. */ /** The shortcut key associated with the mod. */
private int key; private final int key;
/** The score multiplier. */ /** The score multiplier. */
private float multiplier; private final float multiplier;
/** Whether or not the mod is implemented. */ /** Whether or not the mod is implemented. */
private boolean implemented; private final boolean implemented;
/** The name of the mod. */ /** The name of the mod. */
private String name; private final String name;
/** The description of the mod. */ /** The description of the mod. */
private String description; private final String description;
/** Whether or not this mod is active. */ /** Whether or not this mod is active. */
private boolean active = false; private boolean active = false;

View File

@ -459,13 +459,13 @@ public class Options {
DISABLE_UPDATER ("Disable Automatic Updates", "DisableUpdater", "Disable automatic checking for updates upon starting opsu!.", false); DISABLE_UPDATER ("Disable Automatic Updates", "DisableUpdater", "Disable automatic checking for updates upon starting opsu!.", false);
/** Option name. */ /** Option name. */
private String name; private final String name;
/** Option name, as displayed in the configuration file. */ /** Option name, as displayed in the configuration file. */
private String displayName; private final String displayName;
/** Option description. */ /** Option description. */
private String description; private final String description;
/** The boolean value for the option (if applicable). */ /** The boolean value for the option (if applicable). */
protected boolean bool; protected boolean bool;
@ -487,7 +487,7 @@ public class Options {
* @param displayName the option name, as displayed in the configuration file * @param displayName the option name, as displayed in the configuration file
*/ */
GameOption(String displayName) { GameOption(String displayName) {
this.displayName = displayName; this(null, displayName, null);
} }
/** /**

View File

@ -40,10 +40,10 @@ public enum HitSound implements SoundController.SoundComponent {
// TAIKO ("taiko", 4); // TAIKO ("taiko", 4);
/** The sample set name. */ /** The sample set name. */
private String name; private final String name;
/** The sample set index. */ /** The sample set index. */
private int index; private final int index;
/** Total number of sample sets. */ /** Total number of sample sets. */
public static final int SIZE = values().length; public static final int SIZE = values().length;
@ -77,7 +77,7 @@ public enum HitSound implements SoundController.SoundComponent {
private static SampleSet currentDefaultSampleSet = SampleSet.NORMAL; private static SampleSet currentDefaultSampleSet = SampleSet.NORMAL;
/** The file name. */ /** The file name. */
private String filename; private final String filename;
/** The Clip associated with the hit sound. */ /** The Clip associated with the hit sound. */
private HashMap<SampleSet, MultiClip> clips; private HashMap<SampleSet, MultiClip> clips;

View File

@ -49,7 +49,7 @@ public class MultiClip {
private byte[] audioData; private byte[] audioData;
/** The name given to this clip. */ /** The name given to this clip. */
private String name; private final String name;
/** /**
* Constructor. * Constructor.

View File

@ -42,7 +42,7 @@ public enum SoundEffect implements SoundController.SoundComponent {
SPINNERSPIN ("spinnerspin"); SPINNERSPIN ("spinnerspin");
/** The file name. */ /** The file name. */
private String filename; private final String filename;
/** The Clip associated with the sound effect. */ /** The Clip associated with the sound effect. */
private MultiClip clip; private MultiClip clip;

View File

@ -39,13 +39,13 @@ public enum BeatmapSortOrder {
LENGTH (4, "Length", new LengthOrder()); LENGTH (4, "Length", new LengthOrder());
/** The ID of the sort (used for tab positioning). */ /** The ID of the sort (used for tab positioning). */
private int id; private final int id;
/** The name of the sort. */ /** The name of the sort. */
private String name; private final String name;
/** The comparator for the sort. */ /** The comparator for the sort. */
private Comparator<BeatmapSetNode> comparator; private final Comparator<BeatmapSetNode> comparator;
/** The tab associated with the sort (displayed in Song Menu screen). */ /** The tab associated with the sort (displayed in Song Menu screen). */
private MenuButton tab; private MenuButton tab;

View File

@ -61,7 +61,7 @@ public class Download {
ERROR ("Error"); ERROR ("Error");
/** The status name. */ /** The status name. */
private String name; private final String name;
/** /**
* Constructor. * Constructor.

View File

@ -77,7 +77,7 @@ public class Updater {
UPDATE_FINAL ("Update queued."); UPDATE_FINAL ("Update queued.");
/** The status description. */ /** The status description. */
private String description; private final String description;
/** /**
* Constructor. * Constructor.

View File

@ -25,10 +25,10 @@ package itdelatrisu.opsu.replay;
*/ */
public class LifeFrame { public class LifeFrame {
/** Time. */ /** Time. */
private int time; private final int time;
/** Percentage. */ /** Percentage. */
private float percentage; private final float percentage;
/** /**
* Constructor. * Constructor.

View File

@ -35,14 +35,14 @@ public enum PlaybackSpeed {
HALF (GameImage.REPLAY_PLAYBACK_HALF, 0.5f); HALF (GameImage.REPLAY_PLAYBACK_HALF, 0.5f);
/** The button image. */ /** The button image. */
private GameImage gameImage; private final GameImage gameImage;
/** The playback speed modifier. */
private final float modifier;
/** The button. */ /** The button. */
private MenuButton button; private MenuButton button;
/** The playback speed modifier. */
private float modifier;
/** Enum values. */ /** Enum values. */
private static PlaybackSpeed[] values = PlaybackSpeed.values(); private static PlaybackSpeed[] values = PlaybackSpeed.values();

View File

@ -38,13 +38,13 @@ public class ReplayFrame {
private int timeDiff; private int timeDiff;
/** Time, in milliseconds. */ /** Time, in milliseconds. */
private int time; private final int time;
/** Cursor coordinates (in OsuPixels). */ /** Cursor coordinates (in OsuPixels). */
private float x, y; private final float x, y;
/** Keys pressed (bitmask). */ /** Keys pressed (bitmask). */
private int keys; private final int keys;
/** /**
* Returns the start frame. * Returns the start frame.

View File

@ -256,7 +256,7 @@ public class ButtonMenu extends BasicGameState {
}; };
/** The buttons in the state. */ /** The buttons in the state. */
private Button[] buttons; private final Button[] buttons;
/** The associated MenuButton objects. */ /** The associated MenuButton objects. */
private MenuButton[] menuButtons; private MenuButton[] menuButtons;
@ -548,10 +548,10 @@ public class ButtonMenu extends BasicGameState {
}; };
/** The text to show on the button. */ /** The text to show on the button. */
private String text; private final String text;
/** The button color. */ /** The button color. */
private Color color; private final Color color;
/** /**
* Constructor. * Constructor.
@ -594,7 +594,7 @@ public class ButtonMenu extends BasicGameState {
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
private Input input; private Input input;
private int state; private final int state;
public ButtonMenu(int state) { public ButtonMenu(int state) {
this.state = state; this.state = state;

View File

@ -162,10 +162,10 @@ public class DownloadsMenu extends BasicGameState {
/** Search query helper class. */ /** Search query helper class. */
private class SearchQuery implements Runnable { private class SearchQuery implements Runnable {
/** The search query. */ /** The search query. */
private String query; private final String query;
/** The download server. */ /** The download server. */
private DownloadServer server; private final DownloadServer server;
/** Whether the query was interrupted. */ /** Whether the query was interrupted. */
private boolean interrupted = false; private boolean interrupted = false;
@ -246,7 +246,7 @@ public class DownloadsMenu extends BasicGameState {
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
private Input input; private Input input;
private int state; private final int state;
public DownloadsMenu(int state) { public DownloadsMenu(int state) {
this.state = state; this.state = state;

View File

@ -240,7 +240,7 @@ public class Game extends BasicGameState {
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
private Input input; private Input input;
private int state; private final int state;
public Game(int state) { public Game(int state) {
this.state = state; this.state = state;

View File

@ -62,7 +62,7 @@ public class GamePauseMenu extends BasicGameState {
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
private Input input; private Input input;
private int state; private final int state;
private Game gameState; private Game gameState;
public GamePauseMenu(int state) { public GamePauseMenu(int state) {

View File

@ -68,7 +68,7 @@ public class GameRanking extends BasicGameState {
// game-related variables // game-related variables
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
private int state; private final int state;
private Input input; private Input input;
public GameRanking(int state) { public GameRanking(int state) {

View File

@ -122,7 +122,7 @@ public class MainMenu extends BasicGameState {
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
private Input input; private Input input;
private int state; private final int state;
public MainMenu(int state) { public MainMenu(int state) {
this.state = state; this.state = state;

View File

@ -114,10 +114,10 @@ public class OptionsMenu extends BasicGameState {
private static OptionTab[] values = values(); private static OptionTab[] values = values();
/** Tab name. */ /** Tab name. */
private String name; private final String name;
/** Options array. */ /** Options array. */
public GameOption[] options; public final GameOption[] options;
/** Associated tab button. */ /** Associated tab button. */
public MenuButton button; public MenuButton button;
@ -167,7 +167,7 @@ public class OptionsMenu extends BasicGameState {
private StateBasedGame game; private StateBasedGame game;
private Input input; private Input input;
private Graphics g; private Graphics g;
private int state; private final int state;
public OptionsMenu(int state) { public OptionsMenu(int state) {
this.state = state; this.state = state;

View File

@ -209,7 +209,7 @@ public class SongMenu extends BasicGameState {
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
private Input input; private Input input;
private int state; private final int state;
public SongMenu(int state) { public SongMenu(int state) {
this.state = state; this.state = state;

View File

@ -67,7 +67,7 @@ public class Splash extends BasicGameState {
private AnimatedValue logoAlpha; private AnimatedValue logoAlpha;
// game-related variables // game-related variables
private int state; private final int state;
private GameContainer container; private GameContainer container;
private boolean init = false; private boolean init = false;