Moving getBlockFormats from FModel to GameFormat.Collection

getBlockFormat becomes also getBlockList, inline with other methods in GameFormat.Collection. DeckManager and CardManager have been updated accordingly.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
This commit is contained in:
leriomaggio
2021-09-21 23:16:56 +01:00
parent 1b5564760a
commit 3f961a14ab
4 changed files with 15 additions and 15 deletions

View File

@@ -468,6 +468,19 @@ public class GameFormat implements Comparable<GameFormat> {
return coreList;
}
public Iterable<GameFormat> getBlockList() {
List<GameFormat> blockFormats = new ArrayList<>();
for (GameFormat format : this.getHistoricList()){
if (format.getFormatSubType() != GameFormat.FormatSubType.BLOCK)
continue;
if (!format.getName().endsWith("Block"))
continue;
blockFormats.add(format);
}
Collections.sort(blockFormats); // GameFormat will be sorted by Index!
return blockFormats;
}
public Map<String, List<GameFormat>> getHistoricMap() {
Map<String, List<GameFormat>> coreList = new HashMap<>();
for (GameFormat format: naturallyOrdered){

View File

@@ -233,7 +233,7 @@ public class CardManager extends ItemManager<PaperCard> {
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_HISTORIC_FORMATS)) {
JMenu blocks = GuiUtils.createMenu(localizer.getMessage("lblBlock"));
final List<GameFormat> blockFormats = FModel.getBlockFormats();
final Iterable<GameFormat> blockFormats = FModel.getFormats().getBlockList();
for (final GameFormat f : blockFormats) {
GuiUtils.addMenuItem(blocks, f.getName(), null, new Runnable() {
@Override

View File

@@ -281,7 +281,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_HISTORIC_FORMATS)) {
JMenu blocks = GuiUtils.createMenu(localizer.getMessage("lblBlock"));
final List<GameFormat> blockFormats = FModel.getBlockFormats();
final Iterable<GameFormat> blockFormats = FModel.getFormats().getBlockList();
for (final GameFormat f : blockFormats) {
GuiUtils.addMenuItem(blocks, f.getName(), null, new Runnable() {
@Override

View File

@@ -463,19 +463,6 @@ public final class FModel {
return blocks;
}
public static List<GameFormat> getBlockFormats(){
List<GameFormat> blockFormats = new ArrayList<>();
for (GameFormat format : FModel.getFormats().getHistoricList()){
if (format.getFormatSubType() != GameFormat.FormatSubType.BLOCK)
continue;
if (!format.getName().endsWith("Block"))
continue;
blockFormats.add(format);
}
Collections.sort(blockFormats); // GameFormat will be sorted by Index!
return blockFormats;
}
public static QuestPreferences getQuestPreferences() {
return questPreferences;
}