mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Updating all enum FormatType to UPPERCASE as constants
This commit is contained in:
@@ -57,8 +57,28 @@ import forge.util.storage.StorageReaderRecursiveFolderWithUserFolder;
|
|||||||
|
|
||||||
public class GameFormat implements Comparable<GameFormat> {
|
public class GameFormat implements Comparable<GameFormat> {
|
||||||
private final String name;
|
private final String name;
|
||||||
public enum FormatType {Sanctioned, Casual, Historic, Digital, Custom}
|
public enum FormatType {
|
||||||
public enum FormatSubType {Block, Standard, Extended, Pioneer, Modern, Legacy, Vintage, Commander, Planechase, Videogame, MTGO, Arena, Custom}
|
SANCTIONED,
|
||||||
|
CASUAL,
|
||||||
|
HISTORIC,
|
||||||
|
DIGITAL,
|
||||||
|
CUSTOM
|
||||||
|
}
|
||||||
|
public enum FormatSubType {
|
||||||
|
Block,
|
||||||
|
Standard,
|
||||||
|
Extended,
|
||||||
|
Pioneer,
|
||||||
|
Modern,
|
||||||
|
Legacy,
|
||||||
|
Vintage,
|
||||||
|
Commander,
|
||||||
|
Planechase,
|
||||||
|
Videogame,
|
||||||
|
MTGO,
|
||||||
|
Arena,
|
||||||
|
Custom
|
||||||
|
}
|
||||||
|
|
||||||
// contains allowed sets, when empty allows all sets
|
// contains allowed sets, when empty allows all sets
|
||||||
private FormatType formatType;
|
private FormatType formatType;
|
||||||
@@ -85,11 +105,11 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
private final int index;
|
private final int index;
|
||||||
|
|
||||||
public GameFormat(final String fName, final Iterable<String> sets, final List<String> bannedCards) {
|
public GameFormat(final String fName, final Iterable<String> sets, final List<String> bannedCards) {
|
||||||
this(fName, parseDate(DEFAULTDATE), sets, bannedCards, null, false, null, null, 0, FormatType.Custom, FormatSubType.Custom);
|
this(fName, parseDate(DEFAULTDATE), sets, bannedCards, null, false, null, null, 0, FormatType.CUSTOM, FormatSubType.Custom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final GameFormat NoFormat = new GameFormat("(none)", parseDate(DEFAULTDATE) , null, null, null, false
|
public static final GameFormat NoFormat = new GameFormat("(none)", parseDate(DEFAULTDATE) , null, null, null, false
|
||||||
, null, null, Integer.MAX_VALUE, FormatType.Custom, FormatSubType.Custom);
|
, null, null, Integer.MAX_VALUE, FormatType.CUSTOM, FormatSubType.Custom);
|
||||||
|
|
||||||
public GameFormat(final String fName, final Date effectiveDate, final Iterable<String> sets, final List<String> bannedCards,
|
public GameFormat(final String fName, final Date effectiveDate, final Iterable<String> sets, final List<String> bannedCards,
|
||||||
final List<String> restrictedCards, Boolean restrictedLegendary, final List<String> additionalCards,
|
final List<String> restrictedCards, Boolean restrictedLegendary, final List<String> additionalCards,
|
||||||
@@ -283,7 +303,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
return formatSubType.compareTo(other.formatSubType);
|
return formatSubType.compareTo(other.formatSubType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (formatType.equals(FormatType.Historic)){
|
if (formatType.equals(FormatType.HISTORIC)){
|
||||||
if(effectiveDate!=other.effectiveDate) {//for matching dates or default dates default to name sorting
|
if(effectiveDate!=other.effectiveDate) {//for matching dates or default dates default to name sorting
|
||||||
return other.effectiveDate.compareTo(effectiveDate);
|
return other.effectiveDate.compareTo(effectiveDate);
|
||||||
}
|
}
|
||||||
@@ -340,7 +360,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
try {
|
try {
|
||||||
formatType = FormatType.valueOf(section.get("type"));
|
formatType = FormatType.valueOf(section.get("type"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
formatType = FormatType.Custom;
|
formatType = FormatType.CUSTOM;
|
||||||
}
|
}
|
||||||
FormatSubType formatsubType;
|
FormatSubType formatsubType;
|
||||||
try {
|
try {
|
||||||
@@ -432,7 +452,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
public Iterable<GameFormat> getSanctionedList() {
|
public Iterable<GameFormat> getSanctionedList() {
|
||||||
List<GameFormat> coreList = new ArrayList<>();
|
List<GameFormat> coreList = new ArrayList<>();
|
||||||
for(GameFormat format: naturallyOrdered){
|
for(GameFormat format: naturallyOrdered){
|
||||||
if(format.getFormatType().equals(FormatType.Sanctioned)){
|
if(format.getFormatType().equals(FormatType.SANCTIONED)){
|
||||||
coreList.add(format);
|
coreList.add(format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,8 +462,8 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
public Iterable<GameFormat> getFilterList() {
|
public Iterable<GameFormat> getFilterList() {
|
||||||
List<GameFormat> coreList = new ArrayList<>();
|
List<GameFormat> coreList = new ArrayList<>();
|
||||||
for(GameFormat format: naturallyOrdered){
|
for(GameFormat format: naturallyOrdered){
|
||||||
if(!format.getFormatType().equals(FormatType.Historic)
|
if(!format.getFormatType().equals(FormatType.HISTORIC)
|
||||||
&&!format.getFormatType().equals(FormatType.Digital)){
|
&&!format.getFormatType().equals(FormatType.DIGITAL)){
|
||||||
coreList.add(format);
|
coreList.add(format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,7 +473,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
public Iterable<GameFormat> getHistoricList() {
|
public Iterable<GameFormat> getHistoricList() {
|
||||||
List<GameFormat> coreList = new ArrayList<>();
|
List<GameFormat> coreList = new ArrayList<>();
|
||||||
for(GameFormat format: naturallyOrdered){
|
for(GameFormat format: naturallyOrdered){
|
||||||
if(format.getFormatType().equals(FormatType.Historic)){
|
if(format.getFormatType().equals(FormatType.HISTORIC)){
|
||||||
coreList.add(format);
|
coreList.add(format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -463,7 +483,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
public Map<String, List<GameFormat>> getHistoricMap() {
|
public Map<String, List<GameFormat>> getHistoricMap() {
|
||||||
Map<String, List<GameFormat>> coreList = new HashMap<>();
|
Map<String, List<GameFormat>> coreList = new HashMap<>();
|
||||||
for(GameFormat format: naturallyOrdered){
|
for(GameFormat format: naturallyOrdered){
|
||||||
if(format.getFormatType().equals(FormatType.Historic)){
|
if(format.getFormatType().equals(FormatType.HISTORIC)){
|
||||||
String alpha = format.getName().substring(0,1);
|
String alpha = format.getName().substring(0,1);
|
||||||
if(!coreList.containsKey(alpha)){
|
if(!coreList.containsKey(alpha)){
|
||||||
coreList.put(alpha,new ArrayList<>());
|
coreList.put(alpha,new ArrayList<>());
|
||||||
@@ -528,7 +548,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
Set<FormatSubType> coveredTypes = new HashSet<>();
|
Set<FormatSubType> coveredTypes = new HashSet<>();
|
||||||
CardPool allCards = deck.getAllCardsInASinglePool();
|
CardPool allCards = deck.getAllCardsInASinglePool();
|
||||||
for(GameFormat gf : reverseDateOrdered) {
|
for(GameFormat gf : reverseDateOrdered) {
|
||||||
if (gf.getFormatType().equals(FormatType.Digital) && !exhaustive){
|
if (gf.getFormatType().equals(FormatType.DIGITAL) && !exhaustive){
|
||||||
//exclude Digital formats from lists for now
|
//exclude Digital formats from lists for now
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -536,7 +556,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
//exclude Commander format as other deck checks are not performed here
|
//exclude Commander format as other deck checks are not performed here
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (gf.getFormatType().equals(FormatType.Historic) && coveredTypes.contains(gf.getFormatSubType())
|
if (gf.getFormatType().equals(FormatType.HISTORIC) && coveredTypes.contains(gf.getFormatSubType())
|
||||||
&& !exhaustive){
|
&& !exhaustive){
|
||||||
//exclude duplicate formats - only keep first of e.g. Standard historical
|
//exclude duplicate formats - only keep first of e.g. Standard historical
|
||||||
continue;
|
continue;
|
||||||
@@ -570,7 +590,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
return gf1.formatSubType.compareTo(gf2.formatSubType);
|
return gf1.formatSubType.compareTo(gf2.formatSubType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gf1.formatType.equals(FormatType.Historic)){
|
if (gf1.formatType.equals(FormatType.HISTORIC)){
|
||||||
if(gf1.effectiveDate!=gf2.effectiveDate) {//for matching dates or default dates default to name sorting
|
if(gf1.effectiveDate!=gf2.effectiveDate) {//for matching dates or default dates default to name sorting
|
||||||
return gf1.effectiveDate.compareTo(gf2.effectiveDate);
|
return gf1.effectiveDate.compareTo(gf2.effectiveDate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,15 +48,15 @@ public class DialogChooseFormats {
|
|||||||
FCheckBox box = new FCheckBox(format.getName());
|
FCheckBox box = new FCheckBox(format.getName());
|
||||||
box.setName(format.getName());
|
box.setName(format.getName());
|
||||||
switch (format.getFormatType()){
|
switch (format.getFormatType()){
|
||||||
case Sanctioned:
|
case SANCTIONED:
|
||||||
sanctioned.add(box);
|
sanctioned.add(box);
|
||||||
break;
|
break;
|
||||||
case Historic:
|
case HISTORIC:
|
||||||
historic.add(box);
|
historic.add(box);
|
||||||
break;
|
break;
|
||||||
case Custom:
|
case CUSTOM:
|
||||||
case Casual:
|
case CASUAL:
|
||||||
case Digital:
|
case DIGITAL:
|
||||||
default:
|
default:
|
||||||
casual.add(box);
|
casual.add(box);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class HistoricFormatSelect extends FScreen {
|
|||||||
public HistoricFormatSelect() {
|
public HistoricFormatSelect() {
|
||||||
super(Localizer.getInstance().getMessage("lblChooseFormat"));
|
super(Localizer.getInstance().getMessage("lblChooseFormat"));
|
||||||
for (GameFormat.FormatType group:GameFormat.FormatType.values()){
|
for (GameFormat.FormatType group:GameFormat.FormatType.values()){
|
||||||
if (group == GameFormat.FormatType.Historic){
|
if (group == GameFormat.FormatType.HISTORIC){
|
||||||
for (GameFormat.FormatSubType subgroup:GameFormat.FormatSubType.values()){
|
for (GameFormat.FormatSubType subgroup:GameFormat.FormatSubType.values()){
|
||||||
if (historicSubTypes.contains(subgroup)){
|
if (historicSubTypes.contains(subgroup)){
|
||||||
lstFormats.addGroup(group.name() + "-" + subgroup.name());
|
lstFormats.addGroup(group.name() + "-" + subgroup.name());
|
||||||
@@ -48,13 +48,13 @@ public class HistoricFormatSelect extends FScreen {
|
|||||||
}
|
}
|
||||||
for (GameFormat format: FModel.getFormats().getOrderedList()){
|
for (GameFormat format: FModel.getFormats().getOrderedList()){
|
||||||
switch(format.getFormatType()){
|
switch(format.getFormatType()){
|
||||||
case Sanctioned:
|
case SANCTIONED:
|
||||||
lstFormats.addItem(format, 0);
|
lstFormats.addItem(format, 0);
|
||||||
break;
|
break;
|
||||||
case Casual:
|
case CASUAL:
|
||||||
lstFormats.addItem(format, 1);
|
lstFormats.addItem(format, 1);
|
||||||
break;
|
break;
|
||||||
case Historic:
|
case HISTORIC:
|
||||||
switch (format.getFormatSubType()){
|
switch (format.getFormatSubType()){
|
||||||
case Block:
|
case Block:
|
||||||
lstFormats.addItem(format, 2);
|
lstFormats.addItem(format, 2);
|
||||||
@@ -77,10 +77,10 @@ public class HistoricFormatSelect extends FScreen {
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Digital:
|
case DIGITAL:
|
||||||
lstFormats.addItem(format, 8);
|
lstFormats.addItem(format, 8);
|
||||||
break;
|
break;
|
||||||
case Custom:
|
case CUSTOM:
|
||||||
lstFormats.addItem(format, 9);
|
lstFormats.addItem(format, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public final class GameFormatQuest extends GameFormat {
|
|||||||
public GameFormatQuest(final GameFormat toCopy, boolean allowSetUnlocks) {
|
public GameFormatQuest(final GameFormat toCopy, boolean allowSetUnlocks) {
|
||||||
super(toCopy.getName(), toCopy.getEffectiveDate(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames(), toCopy.getRestrictedCards(),
|
super(toCopy.getName(), toCopy.getEffectiveDate(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames(), toCopy.getRestrictedCards(),
|
||||||
toCopy.isRestrictedLegendary(),toCopy.getAdditionalCards(), toCopy.getAllowedRarities(),
|
toCopy.isRestrictedLegendary(),toCopy.getAdditionalCards(), toCopy.getAllowedRarities(),
|
||||||
toCopy.getIndex(), FormatType.Custom, FormatSubType.Custom);
|
toCopy.getIndex(), FormatType.CUSTOM, FormatSubType.Custom);
|
||||||
allowUnlocks = allowSetUnlocks;
|
allowUnlocks = allowSetUnlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user