Skip to content

Commit

Permalink
Made utility classes final to explicitly forbid it's inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
kubikrubikvkube committed Feb 27, 2017
1 parent f309717 commit 498c8cf
Show file tree
Hide file tree
Showing 80 changed files with 83 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/mage/client/SessionHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Created by IGOUDT on 15-9-2016.
*/
public class SessionHandler {
public final class SessionHandler {

private static Session session;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.StringTokenizer;
import java.util.UUID;

public class LocalCommands {
public final class LocalCommands {

private static final DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* @author ayratn
*/
public class TestMageFloatPane {
public final class TestMageFloatPane {

public static void main(String... args) {
JFrame f = new JFrame();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* @author nantuko
* @author Simown
*/
public class DeckGenerator {
public final class DeckGenerator {

public static class DeckGeneratorException extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public final class CollectionViewerPanel extends JPanel {
private static final Logger logger = Logger.getLogger(CollectionViewerPanel.class);

protected static final String LAYOYT_CONFIG_KEY = "collectionViewerLayoutConfig";
protected static final String FORMAT_CONFIG_KEY = "collectionViewerFormat";
private static final String FORMAT_CONFIG_KEY = "collectionViewerFormat";

public CollectionViewerPanel() {
initComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public void updateSize(String size) {
/**
* Defines the position of the next card on the mage book
*/
private static class CardPosition {
private static final class CardPosition {

private CardPosition() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @author nantuko
*/
public class CardHelper {
public final class CardHelper {
private CardHelper() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.prefs.Preferences;

// TODO: Move all preference related logic from MageFrame and PreferencesDialog to this class.
public class MagePreferences {
public final class MagePreferences {

private static final String KEY_SERVER_ADDRESS = "serverAddress";
private static final String KEY_SERVER_PORT = "serverPort";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
* @author BetaSteward_at_googlemail.com
*/
public class CardsViewUtil {
public final class CardsViewUtil {

public static CardsView convertSimple(SimpleCardsView view) {
CardsView cards = new CardsView();
Expand Down
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/mage/client/util/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* @author BetaSteward_at_googlemail.com
*/
public class Config {
public final class Config {

// TODO: Remove this class completely
private static final Logger logger = Logger.getLogger(Config.class);
Expand Down
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/mage/client/util/DeckUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* @author nantuko
*/
public class DeckUtil {
public final class DeckUtil {

private static final Logger log = Logger.getLogger(DeckUtil.class);

Expand Down
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/mage/client/util/Format.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* @author LevelX2
*/
public class Format {
public final class Format {

/**
* calculates the duration between two dates and returns a string in the format hhh:mm:ss
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @author LevelX2
*/
public class GUISizeHelper {
public final class GUISizeHelper {

// relate the native image card size to a value of the size scale
final static int CARD_IMAGE_WIDTH = 312;
Expand Down
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/mage/client/util/IgnoreList.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Arrays;
import java.util.Set;

public class IgnoreList {
public final class IgnoreList {

private static final String USAGE = "<br/><font color=yellow>\\ignore - shows current ignore list on this server."
+ "<br/>\\ignore [username] - add a username to your ignore list on this server."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* @author draxdyn
*/
public class ImageCaches {
public final class ImageCaches {

private final static ArrayList<Map> IMAGE_CACHES;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*
* @author BetaSteward_at_googlemail.com
*/
public class ImageHelper {
public final class ImageHelper {

protected static final HashMap<String, BufferedImage> images = new HashMap<>();
protected static final HashMap<String, BufferedImage> backgrounds = new HashMap<>();
Expand Down
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/mage/client/util/SystemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @author noxx
*/
public class SystemUtil {
public final class SystemUtil {

public static final String OS_NAME = "os.name";
public static final String MAC_OS_X = "Mac OS X";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author user
*/
public class TransformedImageCache {
public final class TransformedImageCache {

private final static class Key {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* @author noxx
*/
public class ArrowUtil {
public final class ArrowUtil {

private ArrowUtil() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;

public class GuiDisplayUtil {
public final class GuiDisplayUtil {

private static final Font cardNameFont = new Font("Calibri", Font.BOLD, 15);
private static final Insets DEFAULT_INSETS = new Insets(0, 0, 70, 25);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author LevelX2
*/
public class TableUtil {
public final class TableUtil {

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @author LevelX2
*/
public class CountryUtil {
public final class CountryUtil {

private static final Logger LOGGER = Logger.getLogger(CountryUtil.class);
private static final Map<String, ImageIcon> FLAG_ICON_CACHE = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author ayrat
*/
public class SaveObjectUtil {
public final class SaveObjectUtil {

/**
* Defines should data be saved or not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @author nantuko
*/
public class ConstructedFormats {
public final class ConstructedFormats {

public static final String ALL = "- All Sets";
public static final String STANDARD = "- Standard";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @author noxx
*/
public class MemoryUsageStatUtil {
public final class MemoryUsageStatUtil {

private MemoryUsageStatUtil() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* Various static utilities for use in the card renderer
*/
public class CardRendererUtils {
public final class CardRendererUtils {

/**
* Convert an abstract image, whose underlying implementation may or may not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.log4j.Logger;
import org.mage.plugins.card.constants.Constants;

public class ManaSymbols {
public final class ManaSymbols {

private static final Logger LOGGER = Logger.getLogger(ManaSymbols.class);
private static final Map<Integer, Map<String, BufferedImage>> manaImages = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @author StravantUser
*/
public class TextboxRuleParser {
public final class TextboxRuleParser {

private static final Logger LOGGER = Logger.getLogger(CardPanel.class);

Expand Down
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/org/mage/card/arcane/UI.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/**
* UI utility functions.
*/
public class UI {
public final class UI {
private static final ConcurrentMap<URI, Image> imageCache = new ConcurrentHashMap<>();

public static JToggleButton getToggleButton () {
Expand Down
2 changes: 1 addition & 1 deletion Mage.Client/src/main/java/org/mage/card/arcane/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import javax.swing.SwingUtilities;

@SuppressWarnings({ "rawtypes", "unchecked" })
public class Util {
public final class Util {
public static final boolean isMac = System.getProperty("os.name").toLowerCase().contains("mac");
public static final boolean isWindows = !System.getProperty("os.name").toLowerCase().contains("windows");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.awt.Rectangle;
import java.io.File;

public class Constants {
public final class Constants {

public static final String RESOURCE_PATH_SET = File.separator + "sets" + File.separator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.mage.plugins.card.images.CardDownloadData;
import org.mage.plugins.card.properties.SettingsManager;

public class CardImageUtils {
public final class CardImageUtils {

private static final HashMap<CardDownloadData, String> pathCache = new HashMap<>();
private static final Logger log = Logger.getLogger(CardImageUtils.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import java.awt.image.ImageProducer;
import java.awt.image.RGBImageFilter;

public class Transparency {
public final class Transparency {
public static Image makeColorTransparent(Image im, final Color color) {
ImageFilter filter = new RGBImageFilter() {
// the color we are looking for... Alpha bits are set to opaque
public final int markerRGB = color.getRGB() | 0xFF000000;

@Override
public final int filterRGB(int x, int y, int rgb) {
public int filterRGB(int x, int y, int rgb) {
if ((rgb | 0xFF000000) == markerRGB) {
// Mark the alpha bits as zero - transparent
return 0x00FFFFFF & rgb;
Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/db/EntityManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* @author noxx
*/
public class EntityManagerTest {
public final class EntityManagerTest {

private static DateFormat timeFormatter = SimpleDateFormat.getTimeInstance(SimpleDateFormat.FULL);

Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/db/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* @author noxx
*/
public class Statistics {
public final class Statistics {

public static void main(String[] args) throws Exception {
List<Log> logs = EntityManager.instance.getAllLogs();
Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/utils/CardUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @version 0.1 02.11.2010
* @author nantuko
*/
public class CardUtil {
public final class CardUtil {

private static final String regexBlack = ".*\\x7b.{0,2}B.{0,2}\\x7d.*";
private static final String regexBlue = ".*\\x7b.{0,2}U.{0,2}\\x7d.*";
Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/utils/CompressUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @author ayrat
*/
public class CompressUtil {
public final class CompressUtil {

/**
* Defines should data be compressed or not. True by default. Read from
Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/utils/DeckBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @author nantuko
*/
public class DeckBuilder {
public final class DeckBuilder {

private static final int DECK_COUNT40[] = {3, 6, 6, 4, 3, 2};
private static final int DECK_COUNT60[] = {4, 9, 9, 5, 5, 3};
Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/utils/ThreadUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author ayrat
*/
@SuppressWarnings("unchecked")
public class ThreadUtils {
public final class ThreadUtils {

public static final ThreadPoolExecutor threadPool;
public static final ThreadPoolExecutor threadPool2;
Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/utils/properties/PropertiesUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @author noxx
*/
public class PropertiesUtil {
public final class PropertiesUtil {

private static final Logger logger = Logger.getLogger(PropertiesUtil.class);

Expand Down
2 changes: 1 addition & 1 deletion Mage.Common/src/mage/utils/properties/PropertyKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @author noxx
*/
public class PropertyKeys {
public final class PropertyKeys {

public static final String KEY_DB_LOG_URL = "db.log.url";
public static final String KEY_DB_FEEDBACK_URL = "db.feedback.url";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
* @author BetaSteward_at_googlemail.com
*/
public class Config2 {
public final class Config2 {

private static final Logger logger = Logger.getLogger(Config2.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* this evaluator is only good for two player games
*
*/
public class GameStateEvaluator2 {
public final class GameStateEvaluator2 {

private static final Logger logger = Logger.getLogger(GameStateEvaluator2.class);

Expand Down
Loading

0 comments on commit 498c8cf

Please sign in to comment.