mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Added some default date handling for gameformats
This commit is contained in:
@@ -61,6 +61,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
protected boolean restrictedLegendary = false;
|
protected boolean restrictedLegendary = false;
|
||||||
private Date effectiveDate;
|
private Date effectiveDate;
|
||||||
private final static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
private final static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
private final static String DEFAULTDATE = "1990-01-01";
|
||||||
|
|
||||||
protected final transient List<String> allowedSetCodes_ro;
|
protected final transient List<String> allowedSetCodes_ro;
|
||||||
protected final transient List<String> bannedCardNames_ro;
|
protected final transient List<String> bannedCardNames_ro;
|
||||||
@@ -73,10 +74,10 @@ 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("1990-01-01"), 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("1990-01-01") , 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,
|
||||||
@@ -271,7 +272,9 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (formatType.equals(FormatType.Historic)){
|
if (formatType.equals(FormatType.Historic)){
|
||||||
return effectiveDate.compareTo(other.effectiveDate);
|
if(effectiveDate!=other.effectiveDate) {//for matching dates or default dates default to name sorting
|
||||||
|
return effectiveDate.compareTo(other.effectiveDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return name.compareTo(other.name);
|
return name.compareTo(other.name);
|
||||||
//return index - other.index;
|
//return index - other.index;
|
||||||
@@ -313,6 +316,9 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
}
|
}
|
||||||
Integer idx = section.getInt("order");
|
Integer idx = section.getInt("order");
|
||||||
Date date = parseDate(section.get("effectivedate"));
|
Date date = parseDate(section.get("effectivedate"));
|
||||||
|
if (date == null){
|
||||||
|
date = parseDate(DEFAULTDATE);
|
||||||
|
}
|
||||||
String strSets = section.get("sets");
|
String strSets = section.get("sets");
|
||||||
if ( null != strSets ) {
|
if ( null != strSets ) {
|
||||||
sets = Arrays.asList(strSets.split(", "));
|
sets = Arrays.asList(strSets.split(", "));
|
||||||
|
|||||||
Reference in New Issue
Block a user