mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Checkstyle fixes in a few random files.
This commit is contained in:
@@ -13,21 +13,21 @@ public interface Display {
|
||||
*
|
||||
* @param s a {@link java.lang.String} object.
|
||||
*/
|
||||
public void showMessage(String s);
|
||||
void showMessage(String s);
|
||||
|
||||
/**
|
||||
* <p>getButtonOK.</p>
|
||||
*
|
||||
* @return a {@link forge.MyButton} object.
|
||||
*/
|
||||
public MyButton getButtonOK();
|
||||
MyButton getButtonOK();
|
||||
|
||||
/**
|
||||
* <p>getButtonCancel.</p>
|
||||
*
|
||||
* @return a {@link forge.MyButton} object.
|
||||
*/
|
||||
public MyButton getButtonCancel();
|
||||
MyButton getButtonCancel();
|
||||
|
||||
// public void showStatus(String message);
|
||||
/**
|
||||
@@ -35,14 +35,14 @@ public interface Display {
|
||||
*
|
||||
* @param message a {@link java.lang.String} object.
|
||||
*/
|
||||
public void showCombat(String message);
|
||||
void showCombat(String message);
|
||||
|
||||
/**
|
||||
* <p>setVisible.</p>
|
||||
*
|
||||
* @param b a boolean.
|
||||
*/
|
||||
public void setVisible(boolean b);
|
||||
void setVisible(boolean b);
|
||||
|
||||
//assigns combat damage, used by Combat.setAssignedDamage()
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ public interface Display {
|
||||
* @param blockers a {@link forge.CardList} object.
|
||||
* @param damage a int.
|
||||
*/
|
||||
public void assignDamage(Card attacker, CardList blockers, int damage);
|
||||
void assignDamage(Card attacker, CardList blockers, int damage);
|
||||
//public void addAssignDamage(Card attacker, Card blocker, int damage);
|
||||
//public void addAssignDamage(Card attacker, int damage);
|
||||
|
||||
@@ -63,33 +63,33 @@ public interface Display {
|
||||
* @param phase a {@link java.lang.String} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean stopAtPhase(Player turn, String phase);
|
||||
boolean stopAtPhase(Player turn, String phase);
|
||||
|
||||
/**
|
||||
* <p>loadPrefs.</p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean loadPrefs();
|
||||
boolean loadPrefs();
|
||||
|
||||
/**
|
||||
* <p>savePrefs.</p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean savePrefs();
|
||||
boolean savePrefs();
|
||||
|
||||
/**
|
||||
* <p>canLoseByDecking.</p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean canLoseByDecking();
|
||||
boolean canLoseByDecking();
|
||||
|
||||
/**
|
||||
* <p>setCard.</p>
|
||||
*
|
||||
* @param c a {@link forge.Card} object.
|
||||
*/
|
||||
public void setCard(Card c);
|
||||
void setCard(Card c);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.awt.event.WindowEvent;
|
||||
*/
|
||||
public class ExternalPanel extends JPanel {
|
||||
|
||||
/** Constant <code>serialVersionUID=9098962430872706173L</code> */
|
||||
/** Constant <code>serialVersionUID=9098962430872706173L</code>. */
|
||||
private static final long serialVersionUID = 9098962430872706173L;
|
||||
private Component child, head;
|
||||
private JFrame frame;
|
||||
@@ -33,7 +33,7 @@ public class ExternalPanel extends JPanel {
|
||||
*
|
||||
* @param child a {@link java.awt.Component} object.
|
||||
*/
|
||||
public ExternalPanel(Component child) {
|
||||
public ExternalPanel(final Component child) {
|
||||
this(child, BorderLayout.EAST);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ExternalPanel extends JPanel {
|
||||
* @param child a {@link java.awt.Component} object.
|
||||
* @param side a {@link java.lang.String} object.
|
||||
*/
|
||||
public ExternalPanel(Component child, String side) {
|
||||
public ExternalPanel(final Component child, final String side) {
|
||||
super(new BorderLayout());
|
||||
add(this.child = child);
|
||||
JButton b = new JButton();
|
||||
@@ -59,15 +59,17 @@ public class ExternalPanel extends JPanel {
|
||||
*
|
||||
* @param side a {@link java.lang.String} object.
|
||||
*/
|
||||
public void setHeadSide(String side) {
|
||||
public final void setHeadSide(final String side) {
|
||||
remove(head);
|
||||
add(head, side);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void addImpl(Component comp, Object constraints, int index) {
|
||||
if (comp != child && comp != head) throw new IllegalArgumentException();
|
||||
protected final void addImpl(final Component comp, final Object constraints, final int index) {
|
||||
if (comp != child && comp != head) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
super.addImpl(comp, constraints, index);
|
||||
}
|
||||
|
||||
@@ -92,13 +94,16 @@ public class ExternalPanel extends JPanel {
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (frame == null) bringOut();
|
||||
else bringIn();
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (frame == null) {
|
||||
bringOut();
|
||||
} else {
|
||||
bringIn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
public void windowClosing(final WindowEvent e) {
|
||||
bringIn();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ public class FileFinder {
|
||||
private long totalLength = 0;
|
||||
private int filesNumber = 0;
|
||||
private long directoriesNumber = 0;
|
||||
/** Constant <code>FILES=0</code> */
|
||||
/** Constant <code>FILES=0</code>. */
|
||||
private static final int FILES = 0;
|
||||
/** Constant <code>DIRECTORIES=1</code> */
|
||||
/** Constant <code>DIRECTORIES=1</code>. */
|
||||
private static final int DIRECTORIES = 1;
|
||||
private ArrayList<String> fileNames;
|
||||
private ArrayList<String> fName;
|
||||
@@ -42,8 +42,7 @@ public class FileFinder {
|
||||
* @return a {@link java.util.List} object.
|
||||
* @throws java.lang.Exception if any.
|
||||
*/
|
||||
public List<File> findFiles(String startPath, String mask)
|
||||
throws Exception {
|
||||
public final List<File> findFiles(final String startPath, final String mask) throws Exception {
|
||||
fileNames = new ArrayList<String>();
|
||||
fName = new ArrayList<String>();
|
||||
return findWithFull(startPath, mask, FILES);
|
||||
@@ -55,7 +54,7 @@ public class FileFinder {
|
||||
*
|
||||
* @return a long.
|
||||
*/
|
||||
public long getDirectorySize() {
|
||||
public final long getDirectorySize() {
|
||||
return totalLength;
|
||||
}
|
||||
|
||||
@@ -64,7 +63,7 @@ public class FileFinder {
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getFilesNumber() {
|
||||
public final int getFilesNumber() {
|
||||
return filesNumber;
|
||||
}
|
||||
|
||||
@@ -73,7 +72,7 @@ public class FileFinder {
|
||||
*
|
||||
* @return a long.
|
||||
*/
|
||||
public long getDirectoriesNumber() {
|
||||
public final long getDirectoriesNumber() {
|
||||
return directoriesNumber;
|
||||
}
|
||||
|
||||
@@ -83,20 +82,15 @@ public class FileFinder {
|
||||
* @param name a {@link java.lang.String} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
private boolean accept(String name) {
|
||||
private boolean accept(final String name) {
|
||||
|
||||
if (p == null) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
m = p.matcher(name);
|
||||
|
||||
if (m.matches()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return m.matches();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +103,7 @@ public class FileFinder {
|
||||
* @return a {@link java.util.List} object.
|
||||
* @throws java.lang.Exception if any.
|
||||
*/
|
||||
private List<File> findWithFull(String startPath, String mask, int objectType) throws Exception {
|
||||
private List<File> findWithFull(final String startPath, final String mask, final int objectType) throws Exception {
|
||||
|
||||
if (startPath == null || mask == null) {
|
||||
throw new Exception("Error");
|
||||
@@ -141,7 +135,7 @@ public class FileFinder {
|
||||
* @param res a {@link java.util.List} object.
|
||||
* @param objectType a int.
|
||||
*/
|
||||
private void searchWithFull(File topDirectory, List<File> res, int objectType) {
|
||||
private void searchWithFull(final File topDirectory, final List<File> res, final int objectType) {
|
||||
|
||||
File[] list = topDirectory.listFiles();
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@ package forge;
|
||||
|
||||
import forge.error.ErrorViewer;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -14,14 +18,19 @@ import java.util.List;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class FileUtil {
|
||||
public final class FileUtil {
|
||||
|
||||
private FileUtil() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>doesFileExist.</p>
|
||||
*
|
||||
* @param filename a {@link java.lang.String} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static boolean doesFileExist(String filename) {
|
||||
public static boolean doesFileExist(final String filename) {
|
||||
File f = new File(filename);
|
||||
return f.exists();
|
||||
}
|
||||
@@ -32,7 +41,7 @@ public class FileUtil {
|
||||
* @param filename a {@link java.lang.String} object.
|
||||
* @param data a {@link java.util.List} object.
|
||||
*/
|
||||
public static void writeFile(String filename, List<String> data) {
|
||||
public static void writeFile(final String filename, final List<String> data) {
|
||||
writeFile(new File(filename), data);
|
||||
}
|
||||
|
||||
@@ -46,13 +55,14 @@ public class FileUtil {
|
||||
* @param file a {@link java.io.File} object.
|
||||
* @param data a {@link java.util.List} object.
|
||||
*/
|
||||
public static void writeFile(File file, List<String> data) {
|
||||
public static void writeFile(final File file, final List<String> data) {
|
||||
try {
|
||||
Collections.sort(data);
|
||||
|
||||
BufferedWriter io = new BufferedWriter(new FileWriter(file));
|
||||
for (int i = 0; i < data.size(); i++)
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
io.write(data.get(i) + "\r\n");
|
||||
}
|
||||
|
||||
io.flush();
|
||||
io.close();
|
||||
@@ -60,7 +70,7 @@ public class FileUtil {
|
||||
ErrorViewer.showError(ex);
|
||||
throw new RuntimeException("FileUtil : writeFile() error, problem writing file - " + file + " : " + ex);
|
||||
}
|
||||
}//writeAllDecks()
|
||||
} //writeAllDecks()
|
||||
|
||||
/**
|
||||
* <p>readFile.</p>
|
||||
@@ -68,7 +78,7 @@ public class FileUtil {
|
||||
* @param filename a {@link java.lang.String} object.
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
public static ArrayList<String> readFile(String filename) {
|
||||
public static ArrayList<String> readFile(final String filename) {
|
||||
return readFile(new File(filename));
|
||||
}
|
||||
|
||||
@@ -81,24 +91,27 @@ public class FileUtil {
|
||||
* @param file a {@link java.io.File} object.
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
public static ArrayList<String> readFile(File file) {
|
||||
public static ArrayList<String> readFile(final File file) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
BufferedReader in;
|
||||
|
||||
try {
|
||||
if (file == null || !file.exists()) return list;
|
||||
if (file == null || !file.exists()) {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
in = new BufferedReader(new FileReader(file));
|
||||
|
||||
String line;
|
||||
while ((line = in.readLine()) != null)
|
||||
while ((line = in.readLine()) != null) {
|
||||
list.add(line);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
throw new RuntimeException("FileUtil : readFile() error, " + ex);
|
||||
}
|
||||
|
||||
return list;
|
||||
}//readFile()
|
||||
} //readFile()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user