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);
/** 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. */
private Image menuImage;
@ -202,14 +202,14 @@ public class GameData {
*/
private class HitErrorInfo {
/** The correct hit time. */
private int time;
private final int time;
/** The coordinates of the hit. */
@SuppressWarnings("unused")
private int x, y;
private final int x, y;
/** The difference between the correct and actual hit times. */
private int timeDiff;
private final int timeDiff;
/**
* Constructor.
@ -235,32 +235,32 @@ public class GameData {
/** Hit result helper class. */
private class HitObjectResult {
/** Object start time. */
public int time;
public final int time;
/** Hit result. */
public int result;
public final int result;
/** Object coordinates. */
public float x, y;
public final float x, y;
/** Combo color. */
public Color color;
public final Color color;
/** 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). */
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.
* @param time the result's starting track position

View File

@ -359,22 +359,22 @@ public enum GameImage {
IMG_JPG = 2;
/** The file name. */
private String filename;
private final String filename;
/** The formatted file name string (for loading multiple images). */
private String filenameFormat;
/** Image file type. */
private byte type;
private final byte type;
/**
* Whether or not the image is skinnable by a beatmap.
* 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. */
private boolean preload;
private final boolean preload;
/** The default image. */
private Image defaultImage;

View File

@ -69,13 +69,13 @@ public enum GameMod {
SPECIAL (2, "Special", Color.white);
/** Drawing index. */
private int index;
private final int index;
/** Category name. */
private String name;
private final String name;
/** Text color. */
private Color color;
private final Color color;
/** The coordinates of the category. */
private float x, y;
@ -126,37 +126,37 @@ public enum GameMod {
}
/** The category for the mod. */
private Category category;
private final Category category;
/** The index in the category (for positioning). */
private int categoryIndex;
private final int categoryIndex;
/** The file name of the mod image. */
private GameImage image;
private final GameImage image;
/** The abbreviation for the mod. */
private String abbrev;
private final String abbrev;
/**
* Bit value associated with the mod.
* 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. */
private int key;
private final int key;
/** The score multiplier. */
private float multiplier;
private final float multiplier;
/** Whether or not the mod is implemented. */
private boolean implemented;
private final boolean implemented;
/** The name of the mod. */
private String name;
private final String name;
/** The description of the mod. */
private String description;
private final String description;
/** Whether or not this mod is active. */
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);
/** Option name. */
private String name;
private final String name;
/** Option name, as displayed in the configuration file. */
private String displayName;
private final String displayName;
/** Option description. */
private String description;
private final String description;
/** The boolean value for the option (if applicable). */
protected boolean bool;
@ -487,7 +487,7 @@ public class Options {
* @param displayName the option name, as displayed in the configuration file
*/
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);
/** The sample set name. */
private String name;
private final String name;
/** The sample set index. */
private int index;
private final int index;
/** Total number of sample sets. */
public static final int SIZE = values().length;
@ -77,7 +77,7 @@ public enum HitSound implements SoundController.SoundComponent {
private static SampleSet currentDefaultSampleSet = SampleSet.NORMAL;
/** The file name. */
private String filename;
private final String filename;
/** The Clip associated with the hit sound. */
private HashMap<SampleSet, MultiClip> clips;

View File

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

View File

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

View File

@ -39,13 +39,13 @@ public enum BeatmapSortOrder {
LENGTH (4, "Length", new LengthOrder());
/** The ID of the sort (used for tab positioning). */
private int id;
private final int id;
/** The name of the sort. */
private String name;
private final String name;
/** 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). */
private MenuButton tab;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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