mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
program towards Interface rather than implementations
This commit is contained in:
parent
b04c436801
commit
ae7919cd07
100 changed files with 218 additions and 209 deletions
|
|
@ -1241,7 +1241,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (button.isSelected()) {
|
||||
// Special case - "Multiples" (CONSPIRACY type)
|
||||
if (cardType == CardType.CONSPIRACY) {
|
||||
HashMap<String, CardView> cardNames = new HashMap<>();
|
||||
Map<String, CardView> cardNames = new HashMap<>();
|
||||
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
|
|
@ -1334,11 +1334,11 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
private static final Pattern pattern = Pattern.compile(".*Add(.*)(\\{[WUBRGXC]\\})");
|
||||
|
||||
public void analyseDeck() {
|
||||
HashMap<String, Integer> qtys = new HashMap<>();
|
||||
HashMap<String, Integer> pips = new HashMap<>();
|
||||
HashMap<String, Integer> pips_at_cmcs = new HashMap<>();
|
||||
HashMap<String, Integer> sourcePips = new HashMap<>();
|
||||
HashMap<String, Integer> manaCounts = new HashMap<>();
|
||||
Map<String, Integer> qtys = new HashMap<>();
|
||||
Map<String, Integer> pips = new HashMap<>();
|
||||
Map<String, Integer> pips_at_cmcs = new HashMap<>();
|
||||
Map<String, Integer> sourcePips = new HashMap<>();
|
||||
Map<String, Integer> manaCounts = new HashMap<>();
|
||||
pips.put("#w}", 0);
|
||||
pips.put("#u}", 0);
|
||||
pips.put("#b}", 0);
|
||||
|
|
@ -1651,7 +1651,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
int thisMaxStackSize = 0;
|
||||
cardGrid.add(gridRow);
|
||||
for (List<DeckCardInfo> stack : row) {
|
||||
ArrayList<CardView> gridStack = new ArrayList<>();
|
||||
List<CardView> gridStack = new ArrayList<>();
|
||||
gridRow.add(gridStack);
|
||||
for (DeckCardInfo info : stack) {
|
||||
if (trackedCards.containsKey(info.getSetCode()) && trackedCards.get(info.getSetCode()).containsKey(info.getCardNum())) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class ManaBarChart extends JComponent {
|
|||
|
||||
void drawBar(Graphics2D g, Rectangle area) {
|
||||
Pattern regex = Pattern.compile("^([0-9]+)##(.)}");
|
||||
HashMap<Integer, Integer> totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
int max_num_pips = 0;
|
||||
int max_cmc = 0;
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ public class ManaBarChart extends JComponent {
|
|||
|
||||
}
|
||||
|
||||
HashMap<Integer, Integer> running_totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> running_totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
for (String key : pips_at_cmcs.keySet()) {
|
||||
Matcher regexMatcher = regex.matcher(key);
|
||||
int num_pips = pips_at_cmcs.get(key);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import javax.swing.table.DefaultTableCellRenderer;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static mage.client.dialog.PreferencesDialog.*;
|
||||
|
|
@ -228,7 +229,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
filter.add(new CardTextPredicate(name, chkNames.isSelected(), chkTypes.isSelected(), chkRules.isSelected(), chkUnique.isSelected()));
|
||||
|
||||
if (limited) {
|
||||
ArrayList<Predicate<MageObject>> predicates = new ArrayList<>();
|
||||
List<Predicate<MageObject>> predicates = new ArrayList<>();
|
||||
|
||||
if (this.tbGreen.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
|
|
@ -277,7 +278,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
if (this.cbExpansionSet.isVisible()) {
|
||||
String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
|
||||
if (!expansionSelection.equals("- All Sets")) {
|
||||
ArrayList<Predicate<Card>> expansionPredicates = new ArrayList<>();
|
||||
List<Predicate<Card>> expansionPredicates = new ArrayList<>();
|
||||
for (String setCode : ConstructedFormats.getSetsByFormat(expansionSelection)) {
|
||||
expansionPredicates.add(new ExpansionSetPredicate(setCode));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -541,8 +541,8 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private List<Token> getTokens(int page, String set) {
|
||||
ArrayList<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
ArrayList<Token> tokens = new ArrayList<>();
|
||||
List<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
List<Token> tokens = new ArrayList<>();
|
||||
|
||||
for (CardDownloadData token : allTokens) {
|
||||
if (token.getSet().equals(set)) {
|
||||
|
|
@ -715,7 +715,7 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private int getTotalNumTokens(String set) {
|
||||
ArrayList<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
List<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
int numTokens = 0;
|
||||
|
||||
for (CardDownloadData token : allTokens) {
|
||||
|
|
@ -732,7 +732,7 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private int getTotalNumEmblems(String set) {
|
||||
ArrayList<CardDownloadData> allEmblems = getTokenCardUrls();
|
||||
List<CardDownloadData> allEmblems = getTokenCardUrls();
|
||||
int numEmblems = 0;
|
||||
|
||||
for (CardDownloadData emblem : allEmblems) {
|
||||
|
|
@ -749,7 +749,7 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private int getTotalNumPlanes(String set) {
|
||||
ArrayList<CardDownloadData> allPlanes = getTokenCardUrls();
|
||||
List<CardDownloadData> allPlanes = getTokenCardUrls();
|
||||
int numPlanes = 0;
|
||||
|
||||
for (CardDownloadData plane : allPlanes) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package mage.client.dialog;
|
|||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.*;
|
||||
import mage.cards.decks.Deck;
|
||||
|
|
@ -951,7 +952,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
private void loadRandomPacks(int version) {
|
||||
String versionStr = prepareVersionStr(version, false);
|
||||
ArrayList<String> packList;
|
||||
List<String> packList;
|
||||
String packNames;
|
||||
String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT + versionStr, "");
|
||||
if (!randomPrefs.isEmpty()) {
|
||||
|
|
@ -1219,7 +1220,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.isRandom = tournamentType.isRandom();
|
||||
this.isRichMan = tournamentType.isRichMan();
|
||||
tOptions.getLimitedOptions().getSetCodes().clear();
|
||||
ArrayList<String> selected = randomPackSelector.getSelectedPacks();
|
||||
List<String> selected = randomPackSelector.getSelectedPacks();
|
||||
Collections.shuffle(selected);
|
||||
int maxPacks = 3 * (players.size() + 1);
|
||||
if (tournamentType.isRichMan()) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import javax.swing.event.DocumentListener;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
|
@ -19,7 +20,7 @@ import java.util.*;
|
|||
public class PickCheckBoxDialog extends MageDialog {
|
||||
|
||||
Choice choice;
|
||||
ArrayList<KeyValueItem> allItems = new ArrayList<>();
|
||||
List<KeyValueItem> allItems = new ArrayList<>();
|
||||
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel();
|
||||
CheckBoxList.CheckBoxListModel m_dataModel;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import javax.swing.event.DocumentListener;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
|
@ -18,8 +19,8 @@ import java.util.*;
|
|||
public class PickChoiceDialog extends MageDialog {
|
||||
|
||||
Choice choice;
|
||||
ArrayList<KeyValueItem> allItems = new ArrayList<>();
|
||||
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel();
|
||||
List<KeyValueItem> allItems = new ArrayList<>();
|
||||
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel<>();
|
||||
|
||||
final private static String HTML_TEMPLATE = "<html><div style='text-align: center;'>%s</div></html>";
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package mage.client.dialog;
|
|||
|
||||
import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JOptionPane;
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
|
|
@ -58,7 +59,7 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
|||
this.setModal(true);
|
||||
}
|
||||
|
||||
public void setSelectedPacks(ArrayList<String> packs) {
|
||||
public void setSelectedPacks(List<String> packs) {
|
||||
if (!boxesCreated) {
|
||||
createCheckboxes();
|
||||
}
|
||||
|
|
@ -72,8 +73,8 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList<String> getSelectedPacks() {
|
||||
ArrayList<String> returnVal = new ArrayList<>();
|
||||
public List<String> getSelectedPacks() {
|
||||
List<String> returnVal = new ArrayList<>();
|
||||
for (Component pack : pnlPacks.getComponents()) {
|
||||
JCheckBox thePack = (JCheckBox) pack;
|
||||
if (thePack.isSelected()) {
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public class TestCardRenderDialog extends MageDialog {
|
|||
Player playerOpponent = new StubPlayer("player2", RangeOfInfluence.ALL);
|
||||
game.addPlayer(playerOpponent, deck);
|
||||
|
||||
ArrayList<CardView> cardViews = new ArrayList<>();
|
||||
java.util.List<CardView> cardViews = new ArrayList<>();
|
||||
///*
|
||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "263", 0, 0, 0, false)); // mountain
|
||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "185", 0, 0, 0, true)); // Judith, the Scourge Diva
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ public class HelperPanel extends JPanel {
|
|||
this.buttonGrid.setLayout(new FlowLayout(FlowLayout.CENTER, BUTTONS_H_GAP, 0));
|
||||
this.buttonGrid.setPreferredSize(null);
|
||||
|
||||
ArrayList<JButton> buttons = new ArrayList<>();
|
||||
java.util.List<JButton> buttons = new ArrayList<>();
|
||||
if (this.btnSpecial.isVisible()) {
|
||||
buttons.add(this.btnSpecial);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.client.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
|
@ -41,7 +42,7 @@ public enum CardLanguage {
|
|||
}
|
||||
|
||||
public static String[] toList() {
|
||||
ArrayList<String> res = new ArrayList<>();
|
||||
List<String> res = new ArrayList<>();
|
||||
for (CardLanguage l : values()) {
|
||||
res.add(l.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public final class GuiDisplayUtil {
|
|||
|
||||
// counters
|
||||
if (card.getMageObjectType().canHaveCounters()) {
|
||||
ArrayList<CounterView> counters = new ArrayList<>();
|
||||
java.util.List<CounterView> counters = new ArrayList<>();
|
||||
if (card instanceof PermanentView) {
|
||||
if (card.getCounters() != null) {
|
||||
counters = new ArrayList<>(card.getCounters());
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ public abstract class CardRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
protected void parseRules(List<String> stringRules, ArrayList<TextboxRule> keywords, ArrayList<TextboxRule> rules) {
|
||||
protected void parseRules(List<String> stringRules, List<TextboxRule> keywords, List<TextboxRule> rules) {
|
||||
// Translate the textbox text and remove card hints
|
||||
for (String rule : stringRules) {
|
||||
// remove all card hints
|
||||
|
|
|
|||
|
|
@ -1170,7 +1170,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
return layout;
|
||||
}
|
||||
|
||||
protected void drawRulesText(Graphics2D g, ArrayList<TextboxRule> keywords, ArrayList<TextboxRule> rules, int x, int y, int w, int h, boolean forceRules) {
|
||||
protected void drawRulesText(Graphics2D g, List<TextboxRule> keywords, List<TextboxRule> rules, int x, int y, int w, int h, boolean forceRules) {
|
||||
// Gather all rules to render
|
||||
List<TextboxRule> allRules = new ArrayList<>(rules);
|
||||
|
||||
|
|
@ -1271,7 +1271,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
}
|
||||
|
||||
// Get the first line of the textbox, the keyword string
|
||||
private static String getKeywordRulesString(ArrayList<TextboxRule> keywords) {
|
||||
private static String getKeywordRulesString(List<TextboxRule> keywords) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < keywords.size(); ++i) {
|
||||
builder.append(keywords.get(i).text);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
String typeLineString;
|
||||
String manaCostString;
|
||||
ObjectColor color;
|
||||
ArrayList<TextboxRule> rules = new ArrayList<>();
|
||||
ArrayList<TextboxRule> keywords = new ArrayList<>();
|
||||
List<TextboxRule> rules = new ArrayList<>();
|
||||
List<TextboxRule> keywords = new ArrayList<>();
|
||||
}
|
||||
|
||||
private static ArrayList<CardType> ONLY_LAND_TYPE = new ArrayList<CardType>() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.mage.card.arcane;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by stravant@gmail.com on 2016-09-14.
|
||||
|
|
@ -8,7 +9,7 @@ import java.util.ArrayList;
|
|||
public class TextboxBasicManaRule extends TextboxRule {
|
||||
private final String basicManaSymbol;
|
||||
|
||||
public TextboxBasicManaRule(String rule, ArrayList<AttributeRegion> regions, String basicManaSymbol) {
|
||||
public TextboxBasicManaRule(String rule, List<AttributeRegion> regions, String basicManaSymbol) {
|
||||
super(rule, regions, TextboxRuleType.BASIC_MANA);
|
||||
|
||||
this.basicManaSymbol = basicManaSymbol;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public final class TextboxRuleParser {
|
|||
// the textbox of a card.
|
||||
public static TextboxRule parse(CardView source, String rule) {
|
||||
// List of regions to apply
|
||||
ArrayList<TextboxRule.AttributeRegion> regions = new ArrayList<>();
|
||||
java.util.List<TextboxRule.AttributeRegion> regions = new ArrayList<>();
|
||||
|
||||
// Leveler / loyalty / basic
|
||||
boolean isLeveler = false;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.mage.plugins.card.images.CardDownloadData;
|
|||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
|
|
@ -69,9 +70,9 @@ public enum AltMtgOnlTokensImageSource implements CardImageSource {
|
|||
return null;
|
||||
}
|
||||
|
||||
HashMap<String, String> copyUrlToImage = null;
|
||||
HashMap<String, String> copyImageToUrl = null;
|
||||
HashMap<String, Integer> copyUrlToImageDone = null;
|
||||
Map<String, String> copyUrlToImage = null;
|
||||
Map<String, String> copyImageToUrl = null;
|
||||
Map<String, Integer> copyUrlToImageDone = null;
|
||||
|
||||
private void setupLinks() {
|
||||
if (copyUrlToImage != null) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ package org.mage.plugins.card.dl.sources;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
|
@ -40,7 +42,7 @@ public class CardFrames implements Iterable<DownloadJob> {
|
|||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
for (String texture : TEXTURES) {
|
||||
jobs.add(generateDownloadJob(TEXTURES_FOLDER, texture));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public interface CardImageSource {
|
|||
|
||||
void doPause(String httpImageUrl);
|
||||
|
||||
default ArrayList<String> getSupportedSets() {
|
||||
default List<String> getSupportedSets() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
|
||||
private Set<String> supportedSets = new LinkedHashSet<String>();
|
||||
private Set<String> missingCards = new LinkedHashSet<String>();
|
||||
HashMap<String, String> singleLinks = null;
|
||||
Map<String, String> singleLinks = null;
|
||||
boolean loadedFromDialog = false;
|
||||
boolean viewMissingCards = true;
|
||||
HashMap<String, Integer> singleLinksDone = null;
|
||||
Map<String, Integer> singleLinksDone = null;
|
||||
private static int maxTimes = 2;
|
||||
|
||||
@Override
|
||||
|
|
@ -225,13 +225,11 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
public List<String> getSupportedSets() {
|
||||
setupLinks();
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
List<String> supportedSetsCopy = new ArrayList<>();
|
||||
if (supportedSets.isEmpty()) {
|
||||
for (String setCode : Sets.getInstance().keySet()) {
|
||||
supportedSets.add(setCode);
|
||||
}
|
||||
supportedSets.addAll(Sets.getInstance().keySet());
|
||||
}
|
||||
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
|
|
|
|||
|
|
@ -10,10 +10,7 @@ import mage.client.constants.Constants;
|
|||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
|
@ -48,7 +45,7 @@ public class DirectLinksForDownload implements Iterable<DownloadJob> {
|
|||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, String> url : directLinks.entrySet()) {
|
||||
File dst = new File(outDir, url.getKey());
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
package org.mage.plugins.card.dl.sources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.*;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
|
|
@ -286,7 +282,7 @@ public class GathererSets implements Iterable<DownloadJob> {
|
|||
c.setTime(new Date());
|
||||
c.add(Calendar.DATE, DAYS_BEFORE_RELEASE_TO_DOWNLOAD);
|
||||
Date compareDate = c.getTime();
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
boolean canDownload;
|
||||
|
||||
setsToDownload.clear();
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public enum GrabbagImageSource implements CardImageSource {
|
|||
return null;
|
||||
}
|
||||
|
||||
HashMap<String, String> singleLinks = null;
|
||||
Map<String, String> singleLinks = null;
|
||||
|
||||
private void setupLinks() {
|
||||
if (singleLinks != null) {
|
||||
|
|
@ -485,10 +485,8 @@ public enum GrabbagImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -289,9 +289,7 @@ public enum MagidexImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.mage.plugins.card.images.CardDownloadData;
|
|||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
|
|
@ -69,9 +70,9 @@ public enum MtgOnlTokensImageSource implements CardImageSource {
|
|||
return null;
|
||||
}
|
||||
|
||||
HashMap<String, String> copyUrlToImage = null;
|
||||
HashMap<String, String> copyImageToUrl = null;
|
||||
HashMap<String, Integer> copyUrlToImageDone = null;
|
||||
Map<String, String> copyUrlToImage = null;
|
||||
Map<String, String> copyImageToUrl = null;
|
||||
Map<String, Integer> copyUrlToImageDone = null;
|
||||
|
||||
private void setupLinks() {
|
||||
if (copyUrlToImage != null) {
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
cardNameAliases.put("RIX-tetzimocdeathprimordial", "tetzimocprimaldeath");
|
||||
// <card name, card link>
|
||||
manualLinks = new HashMap<>();
|
||||
HashMap<String, String> links = new HashMap<>();
|
||||
Map<String, String> links = new HashMap<>();
|
||||
links.put("templeofaclazotz", "templeofaclazotz");
|
||||
links.put("conquerorsfoothold", "conquerorsfoothold");
|
||||
links.put("primalwellspring", "primalwellspring");
|
||||
|
|
@ -272,7 +272,7 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
links.put("spitfirebastion", "spitfirebastion");
|
||||
manualLinks.put("XLN", links);
|
||||
|
||||
HashMap<String, String> linksRix = new HashMap<>();
|
||||
Map<String, String> linksRix = new HashMap<>();
|
||||
linksRix.put("vaultofcatlacan", "vaultofcatlacan");
|
||||
linksRix.put("atzalcaveofeternity", "atzalcaveofeternity");
|
||||
linksRix.put("wingedtempleoforazca", "wingedtempleoforazca");
|
||||
|
|
@ -283,7 +283,7 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
manualLinks.put("RIX", linksRix);
|
||||
|
||||
cardNameAliasesStart = new HashMap<>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
Set<String> names = new HashSet<>();
|
||||
names.add("eldrazidevastator.jpg");
|
||||
cardNameAliasesStart.put("BFZ", names);
|
||||
}
|
||||
|
|
@ -450,10 +450,8 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,11 +309,10 @@ public enum ScryfallImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
public List<String> getSupportedSets() {
|
||||
|
||||
// cards
|
||||
supportedSetsCopy.addAll(ScryfallImageSupportCards.getSupportedSets());
|
||||
List<String> supportedSetsCopy = new ArrayList<>(ScryfallImageSupportCards.getSupportedSets());
|
||||
|
||||
// tokens
|
||||
for (String code : ScryfallImageSupportTokens.getSupportedSets().keySet()) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class ScryfallSymbolsSource implements Iterable<DownloadJob> {
|
|||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
|
||||
// all symbols on one page
|
||||
jobs.add(generateDownloadJob());
|
||||
|
|
|
|||
|
|
@ -151,10 +151,8 @@ public enum TokensMtgImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ public enum WizardCardsImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
String languageName = languageAliases.get(preferredLanguage);
|
||||
HashMap<String, Integer> localizedLanguageIds = getlocalizedMultiverseIds(multiverseId);
|
||||
Map<String, Integer> localizedLanguageIds = getlocalizedMultiverseIds(multiverseId);
|
||||
if (localizedLanguageIds.containsKey(languageName)) {
|
||||
return localizedLanguageIds.get(languageName);
|
||||
} else {
|
||||
|
|
@ -633,11 +633,11 @@ public enum WizardCardsImageSource implements CardImageSource {
|
|||
}
|
||||
}
|
||||
|
||||
private HashMap<String, Integer> getlocalizedMultiverseIds(Integer englishMultiverseId) throws IOException {
|
||||
private Map<String, Integer> getlocalizedMultiverseIds(Integer englishMultiverseId) throws IOException {
|
||||
String cardLanguagesUrl = "https://gatherer.wizards.com/Pages/Card/Languages.aspx?multiverseid=" + englishMultiverseId;
|
||||
Document cardLanguagesDoc = CardImageUtils.downloadHtmlDocument(cardLanguagesUrl);
|
||||
Elements languageTableRows = cardLanguagesDoc.select("tr.cardItem");
|
||||
HashMap<String, Integer> localizedIds = new HashMap<>();
|
||||
Map<String, Integer> localizedIds = new HashMap<>();
|
||||
if (!languageTableRows.isEmpty()) {
|
||||
for (Element languageTableRow : languageTableRows) {
|
||||
Elements languageTableColumns = languageTableRow.select("td");
|
||||
|
|
@ -714,10 +714,8 @@ public enum WizardCardsImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
|
|||
|
||||
private Object[] getSetsForCurrentImageSource() {
|
||||
// Set the available sets to the combo box
|
||||
ArrayList<String> supportedSets = selectedSource.getSupportedSets();
|
||||
List<String> supportedSets = selectedSource.getSupportedSets();
|
||||
List<String> setNames = new ArrayList<>();
|
||||
|
||||
// multiple sets selection
|
||||
|
|
@ -490,8 +490,8 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
|
|||
return Collections.synchronizedList(new ArrayList<>(cardsToDownload));
|
||||
}
|
||||
|
||||
public static ArrayList<CardDownloadData> getTokenCardUrls() throws RuntimeException {
|
||||
ArrayList<CardDownloadData> list = new ArrayList<>();
|
||||
public static List<CardDownloadData> getTokenCardUrls() throws RuntimeException {
|
||||
List<CardDownloadData> list = new ArrayList<>();
|
||||
InputStream in = DownloadPicturesService.class.getClassLoader().getResourceAsStream("card-pictures-tok.txt");
|
||||
|
||||
if (in == null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue