mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 06:52:02 -08:00
Made utility classes final to explicitly forbid it's inheritance
This commit is contained in:
parent
f309717616
commit
498c8cf60c
80 changed files with 83 additions and 83 deletions
|
|
@ -20,7 +20,7 @@ import mage.view.*;
|
|||
/**
|
||||
* Created by IGOUDT on 15-9-2016.
|
||||
*/
|
||||
public class SessionHandler {
|
||||
public final class SessionHandler {
|
||||
|
||||
private static Session session;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import java.util.Optional;
|
|||
import java.util.StringTokenizer;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LocalCommands {
|
||||
public final class LocalCommands {
|
||||
|
||||
private static final DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import javax.swing.*;
|
|||
/**
|
||||
* @author ayratn
|
||||
*/
|
||||
public class TestMageFloatPane {
|
||||
public final class TestMageFloatPane {
|
||||
|
||||
public static void main(String... args) {
|
||||
JFrame f = new JFrame();
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ import mage.util.TournamentUtil;
|
|||
* @author nantuko
|
||||
* @author Simown
|
||||
*/
|
||||
public class DeckGenerator {
|
||||
public final class DeckGenerator {
|
||||
|
||||
public static class DeckGeneratorException extends RuntimeException {
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ public class MageBook extends JComponent {
|
|||
/**
|
||||
* Defines the position of the next card on the mage book
|
||||
*/
|
||||
private static class CardPosition {
|
||||
private static final class CardPosition {
|
||||
|
||||
private CardPosition() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import mage.view.CardView;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class CardHelper {
|
||||
public final class CardHelper {
|
||||
private CardHelper() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import java.util.prefs.BackingStoreException;
|
|||
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";
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import mage.view.*;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CardsViewUtil {
|
||||
public final class CardsViewUtil {
|
||||
|
||||
public static CardsView convertSimple(SimpleCardsView view) {
|
||||
CardsView cards = new CardsView();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @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);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class DeckUtil {
|
||||
public final class DeckUtil {
|
||||
|
||||
private static final Logger log = Logger.getLogger(DeckUtil.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import java.util.Date;
|
|||
*
|
||||
* @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
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import org.mage.card.arcane.CardRenderer;
|
|||
*
|
||||
* @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;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import mage.view.ChatMessage;
|
|||
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."
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import java.util.Map;
|
|||
*
|
||||
* @author draxdyn
|
||||
*/
|
||||
public class ImageCaches {
|
||||
public final class ImageCaches {
|
||||
|
||||
private final static ArrayList<Map> IMAGE_CACHES;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import org.mage.card.arcane.UI;
|
|||
*
|
||||
* @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<>();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import java.lang.reflect.Method;
|
|||
/**
|
||||
* @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";
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.Map;
|
|||
*
|
||||
* @author user
|
||||
*/
|
||||
public class TransformedImageCache {
|
||||
public final class TransformedImageCache {
|
||||
|
||||
private final static class Key {
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.util.UUID;
|
|||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class ArrowUtil {
|
||||
public final class ArrowUtil {
|
||||
|
||||
private ArrowUtil() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jdesktop.swingx.JXPanel;
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class TableUtil {
|
||||
public final class TableUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @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<>();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import java.util.Calendar;
|
|||
*
|
||||
* @author ayrat
|
||||
*/
|
||||
public class SaveObjectUtil {
|
||||
public final class SaveObjectUtil {
|
||||
|
||||
/**
|
||||
* Defines should data be saved or not.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import mage.deck.Standard;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class ConstructedFormats {
|
||||
public final class ConstructedFormats {
|
||||
|
||||
public static final String ALL = "- All Sets";
|
||||
public static final String STANDARD = "- Standard";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package mage.client.util.stats;
|
|||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class MemoryUsageStatUtil {
|
||||
public final class MemoryUsageStatUtil {
|
||||
|
||||
private MemoryUsageStatUtil() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.util.regex.Pattern;
|
|||
*
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import mage.client.util.gui.BufferedImageBuilder;
|
|||
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<>();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author StravantUser
|
||||
*/
|
||||
public class TextboxRuleParser {
|
||||
public final class TextboxRuleParser {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(CardPanel.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import javax.swing.text.html.ImageView;
|
|||
/**
|
||||
* UI utility functions.
|
||||
*/
|
||||
public class UI {
|
||||
public final class UI {
|
||||
private static final ConcurrentMap<URI, Image> imageCache = new ConcurrentHashMap<>();
|
||||
|
||||
public static JToggleButton getToggleButton () {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit;
|
|||
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");
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package org.mage.plugins.card.constants;
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import org.apache.log4j.Logger;
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ import java.awt.image.ImageFilter;
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue