Merge pull request #8251 from fearphage/preferred-has-3-rs

corrected typo: prefered -> preferred
This commit is contained in:
Oleg Agafonov 2021-09-11 19:24:38 +04:00 committed by GitHub
commit b6f9d57216
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 44 additions and 44 deletions

View file

@ -4378,11 +4378,11 @@
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="labelNumberOfDownloadThreads" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="labelNumberOfDownloadThreads" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelPreferedImageLanguage" alignment="0" max="-2" attributes="0"/> <Component id="labelPreferredImageLanguage" alignment="0" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="cbPreferedImageLanguage" min="-2" pref="153" max="-2" attributes="0"/> <Component id="cbPreferredImageLanguage" min="-2" pref="153" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="cbNumberOfDownloadThreads" min="-2" pref="153" max="-2" attributes="0"/> <Component id="cbNumberOfDownloadThreads" min="-2" pref="153" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
@ -4416,8 +4416,8 @@
</Group> </Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="labelPreferedImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="labelPreferredImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbPreferedImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="cbPreferredImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</Group> </Group>
@ -4453,7 +4453,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbSaveToZipFilesActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbSaveToZipFilesActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JComboBox" name="cbPreferedImageLanguage"> <Component class="javax.swing.JComboBox" name="cbPreferredImageLanguage">
<Properties> <Properties>
<Property name="maximumRowCount" type="int" value="20"/> <Property name="maximumRowCount" type="int" value="20"/>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
@ -4469,7 +4469,7 @@
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="labelPreferedImageLanguage"> <Component class="javax.swing.JLabel" name="labelPreferredImageLanguage">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="Default images language:"/> <Property name="text" type="java.lang.String" value="Default images language:"/>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>

View file

@ -81,7 +81,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_CARD_IMAGES_THREADS = "cardImagesThreads"; public static final String KEY_CARD_IMAGES_THREADS = "cardImagesThreads";
public static final String KEY_CARD_IMAGES_THREADS_DEFAULT = "3"; public static final String KEY_CARD_IMAGES_THREADS_DEFAULT = "3";
public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip"; public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip";
public static final String KEY_CARD_IMAGES_PREF_LANGUAGE = "cardImagesPreferedImageLaguage"; public static final String KEY_CARD_IMAGES_PREF_LANGUAGE = "cardImagesPreferredImageLaguage";
public static final String KEY_CARD_RENDERING_FALLBACK = "cardRenderingFallback"; public static final String KEY_CARD_RENDERING_FALLBACK = "cardRenderingFallback";
public static final String KEY_CARD_RENDERING_ICONS_FOR_ABILITIES = "cardRenderingIconsForAbilities"; public static final String KEY_CARD_RENDERING_ICONS_FOR_ABILITIES = "cardRenderingIconsForAbilities";
@ -400,7 +400,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
cbTheme.setModel(new DefaultComboBoxModel<>(ThemeType.values())); cbTheme.setModel(new DefaultComboBoxModel<>(ThemeType.values()));
addAvatars(); addAvatars();
cbPreferedImageLanguage.setModel(new DefaultComboBoxModel<>(CardLanguage.toList())); cbPreferredImageLanguage.setModel(new DefaultComboBoxModel<>(CardLanguage.toList()));
cbNumberOfDownloadThreads.setModel(new DefaultComboBoxModel<>(new String[]{"10", "9", "8", "7", "6", "5", "4", "3", "2", "1"})); cbNumberOfDownloadThreads.setModel(new DefaultComboBoxModel<>(new String[]{"10", "9", "8", "7", "6", "5", "4", "3", "2", "1"}));
} }
@ -509,8 +509,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
txtImageFolderPath = new javax.swing.JTextField(); txtImageFolderPath = new javax.swing.JTextField();
btnBrowseImageLocation = new javax.swing.JButton(); btnBrowseImageLocation = new javax.swing.JButton();
cbSaveToZipFiles = new javax.swing.JCheckBox(); cbSaveToZipFiles = new javax.swing.JCheckBox();
cbPreferedImageLanguage = new javax.swing.JComboBox<>(); cbPreferredImageLanguage = new javax.swing.JComboBox<>();
labelPreferedImageLanguage = new javax.swing.JLabel(); labelPreferredImageLanguage = new javax.swing.JLabel();
labelNumberOfDownloadThreads = new javax.swing.JLabel(); labelNumberOfDownloadThreads = new javax.swing.JLabel();
cbNumberOfDownloadThreads = new javax.swing.JComboBox(); cbNumberOfDownloadThreads = new javax.swing.JComboBox();
labelHint1 = new javax.swing.JLabel(); labelHint1 = new javax.swing.JLabel();
@ -1658,11 +1658,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
}); });
cbPreferedImageLanguage.setMaximumRowCount(20); cbPreferredImageLanguage.setMaximumRowCount(20);
cbPreferedImageLanguage.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cbPreferredImageLanguage.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
labelPreferedImageLanguage.setText("Default images language:"); labelPreferredImageLanguage.setText("Default images language:");
labelPreferedImageLanguage.setFocusable(false); labelPreferredImageLanguage.setFocusable(false);
labelNumberOfDownloadThreads.setText("Default download threads:"); labelNumberOfDownloadThreads.setText("Default download threads:");
@ -1689,10 +1689,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
.add(panelCardImagesLayout.createSequentialGroup() .add(panelCardImagesLayout.createSequentialGroup()
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(labelNumberOfDownloadThreads) .add(labelNumberOfDownloadThreads)
.add(labelPreferedImageLanguage)) .add(labelPreferredImageLanguage))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(cbPreferedImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(cbPreferredImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(panelCardImagesLayout.createSequentialGroup() .add(panelCardImagesLayout.createSequentialGroup()
.add(cbNumberOfDownloadThreads, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(cbNumberOfDownloadThreads, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
@ -1716,8 +1716,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
.add(labelHint1)) .add(labelHint1))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(labelPreferedImageLanguage) .add(labelPreferredImageLanguage)
.add(cbPreferedImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .add(cbPreferredImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
); );
panelCardStyles.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card styles (restart xmage to apply new settings)")); panelCardStyles.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card styles (restart xmage to apply new settings)"));
@ -2945,7 +2945,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
saveImagesPath(prefs); saveImagesPath(prefs);
save(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbNumberOfDownloadThreads, KEY_CARD_IMAGES_THREADS); save(prefs, dialog.cbNumberOfDownloadThreads, KEY_CARD_IMAGES_THREADS);
save(prefs, dialog.cbPreferedImageLanguage, KEY_CARD_IMAGES_PREF_LANGUAGE); save(prefs, dialog.cbPreferredImageLanguage, KEY_CARD_IMAGES_PREF_LANGUAGE);
save(prefs, dialog.cbUseDefaultBackground, KEY_BACKGROUND_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbUseDefaultBackground, KEY_BACKGROUND_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbUseDefaultBattleImage, KEY_BATTLEFIELD_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbUseDefaultBattleImage, KEY_BATTLEFIELD_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
@ -3518,7 +3518,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
load(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true"); load(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true");
dialog.cbNumberOfDownloadThreads.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_THREADS, KEY_CARD_IMAGES_THREADS_DEFAULT)); dialog.cbNumberOfDownloadThreads.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_THREADS, KEY_CARD_IMAGES_THREADS_DEFAULT));
dialog.cbPreferedImageLanguage.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_PREF_LANGUAGE, CardLanguage.ENGLISH.getCode())); dialog.cbPreferredImageLanguage.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_PREF_LANGUAGE, CardLanguage.ENGLISH.getCode()));
// rendering settings // rendering settings
load(prefs, dialog.cbCardRenderImageFallback, KEY_CARD_RENDERING_FALLBACK, "true", "false"); load(prefs, dialog.cbCardRenderImageFallback, KEY_CARD_RENDERING_FALLBACK, "true", "false");
@ -4073,7 +4073,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JComboBox cbNumberOfDownloadThreads; private javax.swing.JComboBox cbNumberOfDownloadThreads;
private javax.swing.JCheckBox cbPassPriorityActivation; private javax.swing.JCheckBox cbPassPriorityActivation;
private javax.swing.JCheckBox cbPassPriorityCast; private javax.swing.JCheckBox cbPassPriorityCast;
private javax.swing.JComboBox<String> cbPreferedImageLanguage; private javax.swing.JComboBox<String> cbPreferredImageLanguage;
private javax.swing.JComboBox<ProxyType> cbProxyType; private javax.swing.JComboBox<ProxyType> cbProxyType;
private javax.swing.JCheckBox cbSaveToZipFiles; private javax.swing.JCheckBox cbSaveToZipFiles;
private javax.swing.JCheckBox cbShowStormCounter; private javax.swing.JCheckBox cbShowStormCounter;
@ -4176,7 +4176,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JLabel labelMainStep; private javax.swing.JLabel labelMainStep;
private javax.swing.JLabel labelNextTurn; private javax.swing.JLabel labelNextTurn;
private javax.swing.JLabel labelNumberOfDownloadThreads; private javax.swing.JLabel labelNumberOfDownloadThreads;
private javax.swing.JLabel labelPreferedImageLanguage; private javax.swing.JLabel labelPreferredImageLanguage;
private javax.swing.JLabel labelPriorEnd; private javax.swing.JLabel labelPriorEnd;
private javax.swing.JLabel labelSkipStep; private javax.swing.JLabel labelSkipStep;
private javax.swing.JLabel labelStackWidth; private javax.swing.JLabel labelStackWidth;

View file

@ -128,7 +128,7 @@ public class ChatManagerImpl implements ChatManager {
Matcher matchPattern = cardNamePattern.matcher(message); Matcher matchPattern = cardNamePattern.matcher(message);
while (matchPattern.find()) { while (matchPattern.find()) {
String cardName = matchPattern.group(1); String cardName = matchPattern.group(1);
CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, true); CardInfo cardInfo = CardRepository.instance.findPreferredCoreExpansionCard(cardName, true);
if (cardInfo != null) { if (cardInfo != null) {
String colour = "silver"; String colour = "silver";
if (cardInfo.getCard().getColor(null).isMulticolored()) { if (cardInfo.getCard().getColor(null).isMulticolored()) {
@ -270,7 +270,7 @@ public class ChatManagerImpl implements ChatManager {
Matcher matchPattern = getCardTextPattern.matcher(message.toLowerCase(Locale.ENGLISH)); Matcher matchPattern = getCardTextPattern.matcher(message.toLowerCase(Locale.ENGLISH));
if (matchPattern.find()) { if (matchPattern.find()) {
String cardName = matchPattern.group(1); String cardName = matchPattern.group(1);
CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, true); CardInfo cardInfo = CardRepository.instance.findPreferredCoreExpansionCard(cardName, true);
if (cardInfo != null) { if (cardInfo != null) {
cardInfo.getRules(); cardInfo.getRules();
message = "<font color=orange>" + cardInfo.getName() + "</font>: Cost:" + cardInfo.getManaCosts(CardInfo.ManaCostSide.ALL).toString() + ", Types:" + cardInfo.getTypes().toString() + ", "; message = "<font color=orange>" + cardInfo.getName() + "</font>: Cost:" + cardInfo.getManaCosts(CardInfo.ManaCostSide.ALL).toString() + ", Types:" + cardInfo.getTypes().toString() + ", ";

View file

@ -21,13 +21,13 @@ public class TxtDeckImporterTest {
String[] sideboard = {"Swamp", "Mountain"}; String[] sideboard = {"Swamp", "Mountain"};
for (String c : cards) { for (String c : cards) {
card = CardRepository.instance.findPreferedCoreExpansionCard(c, true); card = CardRepository.instance.findPreferredCoreExpansionCard(c, true);
assert card != null; assert card != null;
deck.getCards().add(new DeckCardInfo(card.getName(), card.getCardNumber(), card.getSetCode())); deck.getCards().add(new DeckCardInfo(card.getName(), card.getCardNumber(), card.getSetCode()));
} }
for (String s : sideboard) { for (String s : sideboard) {
card = CardRepository.instance.findPreferedCoreExpansionCard(s, true); card = CardRepository.instance.findPreferredCoreExpansionCard(s, true);
assert card != null; assert card != null;
deck.getSideboard().add(new DeckCardInfo(card.getName(), card.getCardNumber(), card.getSetCode())); deck.getSideboard().add(new DeckCardInfo(card.getName(), card.getCardNumber(), card.getSetCode()));
} }

View file

@ -1858,7 +1858,7 @@ public class VerifyCardDataTest {
if (!cardId.getExtension().isEmpty()) { if (!cardId.getExtension().isEmpty()) {
cardInfo = CardRepository.instance.findCardWPreferredSet(cardId.getName(), cardId.getExtension(), false); cardInfo = CardRepository.instance.findCardWPreferredSet(cardId.getName(), cardId.getExtension(), false);
} else { } else {
cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardId.getName(), false); cardInfo = CardRepository.instance.findPreferredCoreExpansionCard(cardId.getName(), false);
} }
if (cardInfo == null) { if (cardInfo == null) {
errorsList.add("Error: broken cube, can't find card: " + cube.getClass().getCanonicalName() + " - " + cardId.getName()); errorsList.add("Error: broken cube, can't find card: " + cube.getClass().getCanonicalName() + " - " + cardId.getName());

View file

@ -199,10 +199,10 @@ public class Sets extends HashMap<String, ExpansionSet> {
return null; return null;
} }
public static ExpansionSet.SetCardInfo findCardByClass(Class<?> clazz, String preferedSetCode) { public static ExpansionSet.SetCardInfo findCardByClass(Class<?> clazz, String preferredSetCode) {
ExpansionSet.SetCardInfo info = null; ExpansionSet.SetCardInfo info = null;
if (instance.containsKey(preferedSetCode)) { if (instance.containsKey(preferredSetCode)) {
info = instance.get(preferedSetCode).findCardInfoByClass(clazz).stream().findFirst().orElse(null); info = instance.get(preferredSetCode).findCardInfoByClass(clazz).stream().findFirst().orElse(null);
} }
if (info == null) { if (info == null) {

View file

@ -12,7 +12,7 @@ public class CardLookup {
public static final CardLookup instance = new CardLookup(); public static final CardLookup instance = new CardLookup();
public Optional<CardInfo> lookupCardInfo(String name) { public Optional<CardInfo> lookupCardInfo(String name) {
return Optional.ofNullable(CardRepository.instance.findPreferedCoreExpansionCard(name, true)); return Optional.ofNullable(CardRepository.instance.findPreferredCoreExpansionCard(name, true));
} }
public List<CardInfo> lookupCardInfo(CardCriteria criteria) { public List<CardInfo> lookupCardInfo(CardCriteria criteria) {

View file

@ -92,7 +92,7 @@ public class DckDeckImporter extends PlainTextDeckImporter {
} }
if (!cardName.equals("")) { if (!cardName.equals("")) {
foundedCard = CardRepository.instance.findPreferedCoreExpansionCard(cardName, false, setCode); foundedCard = CardRepository.instance.findPreferredCoreExpansionCard(cardName, false, setCode);
} }
if (foundedCard != null) { if (foundedCard != null) {

View file

@ -21,7 +21,7 @@ public class DekDeckImporter extends PlainTextDeckImporter {
Integer cardCount = Integer.parseInt(extractAttribute(line, "Quantity")); Integer cardCount = Integer.parseInt(extractAttribute(line, "Quantity"));
String cardName = extractAttribute(line, "Name"); String cardName = extractAttribute(line, "Name");
boolean isSideboard = "true".equals(extractAttribute(line, "Sideboard")); boolean isSideboard = "true".equals(extractAttribute(line, "Sideboard"));
CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, true); CardInfo cardInfo = CardRepository.instance.findPreferredCoreExpansionCard(cardName, true);
if (cardInfo == null) { if (cardInfo == null) {
sbMessage.append("Could not find card: '").append(cardName).append("' at line ").append(lineCount).append('\n'); sbMessage.append("Could not find card: '").append(cardName).append("' at line ").append(lineCount).append('\n');
} else { } else {

View file

@ -126,7 +126,7 @@ public class TxtDeckImporter extends PlainTextDeckImporter {
wasCardLines = true; wasCardLines = true;
CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(lineName, true); CardInfo cardInfo = CardRepository.instance.findPreferredCoreExpansionCard(lineName, true);
if (cardInfo == null) { if (cardInfo == null) {
sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n'); sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n');
} else { } else {

View file

@ -381,26 +381,26 @@ public enum CardRepository {
return null; return null;
} }
public CardInfo findPreferedCoreExpansionCard(String name, boolean caseInsensitive) { public CardInfo findPreferredCoreExpansionCard(String name, boolean caseInsensitive) {
return findPreferedCoreExpansionCard(name, caseInsensitive, null); return findPreferredCoreExpansionCard(name, caseInsensitive, null);
} }
public CardInfo findPreferedCoreExpansionCard(String name, boolean caseInsensitive, String preferedSetCode) { public CardInfo findPreferredCoreExpansionCard(String name, boolean caseInsensitive, String preferredSetCode) {
List<CardInfo> cards; List<CardInfo> cards;
if (caseInsensitive) { if (caseInsensitive) {
cards = findCardsCaseInsensitive(name); cards = findCardsCaseInsensitive(name);
} else { } else {
cards = findCards(name); cards = findCards(name);
} }
return findPreferedOrLatestCard(cards, preferedSetCode); return findPreferredOrLatestCard(cards, preferredSetCode);
} }
public CardInfo findPreferedCoreExpansionCardByClassName(String canonicalClassName, String preferedSetCode) { public CardInfo findPreferredCoreExpansionCardByClassName(String canonicalClassName, String preferredSetCode) {
List<CardInfo> cards = findCardsByClass(canonicalClassName); List<CardInfo> cards = findCardsByClass(canonicalClassName);
return findPreferedOrLatestCard(cards, preferedSetCode); return findPreferredOrLatestCard(cards, preferredSetCode);
} }
private CardInfo findPreferedOrLatestCard(List<CardInfo> cards, String preferedSetCode) { private CardInfo findPreferredOrLatestCard(List<CardInfo> cards, String preferredSetCode) {
if (!cards.isEmpty()) { if (!cards.isEmpty()) {
Date lastReleaseDate = null; Date lastReleaseDate = null;
Date lastExpansionDate = null; Date lastExpansionDate = null;
@ -409,7 +409,7 @@ public enum CardRepository {
ExpansionInfo set = ExpansionRepository.instance.getSetByCode(cardinfo.getSetCode()); ExpansionInfo set = ExpansionRepository.instance.getSetByCode(cardinfo.getSetCode());
if (set != null) { if (set != null) {
if ((preferedSetCode != null) && (preferedSetCode.equals(set.getCode()))) { if ((preferredSetCode != null) && (preferredSetCode.equals(set.getCode()))) {
return cardinfo; return cardinfo;
} }
@ -443,7 +443,7 @@ public enum CardRepository {
} }
} }
} }
return findPreferedCoreExpansionCard(name, true); return findPreferredCoreExpansionCard(name, true);
} }
public List<CardInfo> findCards(String name) { public List<CardInfo> findCards(String name) {

View file

@ -86,7 +86,7 @@ public abstract class DraftCube {
if (!cardId.getExtension().isEmpty()) { if (!cardId.getExtension().isEmpty()) {
cardInfo = CardRepository.instance.findCardWPreferredSet(cardId.getName(), cardId.getExtension(), false); cardInfo = CardRepository.instance.findCardWPreferredSet(cardId.getName(), cardId.getExtension(), false);
} else { } else {
cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardId.getName(), false); cardInfo = CardRepository.instance.findPreferredCoreExpansionCard(cardId.getName(), false);
} }
if (cardInfo != null) { if (cardInfo != null) {