mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Whitespace cleanup
This commit is contained in:
@@ -21,90 +21,83 @@ import forge.util.storage.StorageBase;
|
||||
* @author Max
|
||||
*/
|
||||
public class StaticData {
|
||||
private final CardDb commonCards;
|
||||
private final CardDb variantCards;
|
||||
private final CardEdition.Collection editions;
|
||||
private final IStorage<SealedProduct.Template> boosters;
|
||||
private final IStorage<SealedProduct.Template> specialBoosters;
|
||||
private final IStorage<SealedProduct.Template> tournaments;
|
||||
private final IStorage<FatPack.Template> fatPacks;
|
||||
private final IStorage<PrintSheet> printSheets;
|
||||
|
||||
private final CardDb commonCards;
|
||||
private final CardDb variantCards;
|
||||
private final CardEdition.Collection editions;
|
||||
private final IStorage<SealedProduct.Template> boosters;
|
||||
private final IStorage<SealedProduct.Template> specialBoosters;
|
||||
private final IStorage<SealedProduct.Template> tournaments;
|
||||
private final IStorage<FatPack.Template> fatPacks;
|
||||
private final IStorage<PrintSheet> printSheets;
|
||||
private static StaticData lastInstance = null;
|
||||
|
||||
private static StaticData lastInstance = null;
|
||||
public StaticData(ICardStorageReader reader, String editionFolder, String blockDataFolder) {
|
||||
this.editions = new CardEdition.Collection(new CardEdition.Reader(new File(editionFolder)));
|
||||
lastInstance = this;
|
||||
|
||||
final Map<String, CardRules> regularCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Map<String, CardRules> variantsCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
List<CardRules> rules = reader.loadCards();
|
||||
for (CardRules card : rules) {
|
||||
if (null == card) continue;
|
||||
|
||||
public StaticData(ICardStorageReader reader, String editionFolder, String blockDataFolder) {
|
||||
this.editions = new CardEdition.Collection(new CardEdition.Reader(new File(editionFolder)));
|
||||
lastInstance = this;
|
||||
final String cardName = card.getName();
|
||||
if ( card.isVariant() ) {
|
||||
variantsCards.put(cardName, card);
|
||||
}
|
||||
else {
|
||||
regularCards.put(cardName, card);
|
||||
}
|
||||
}
|
||||
|
||||
final Map<String, CardRules> regularCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Map<String, CardRules> variantsCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
||||
commonCards = new CardDb(regularCards, editions, false);
|
||||
variantCards = new CardDb(variantsCards, editions, false);
|
||||
|
||||
this.boosters = new StorageBase<SealedProduct.Template>("Boosters", editions.getBoosterGenerator());
|
||||
this.specialBoosters = new StorageBase<SealedProduct.Template>("Special boosters", new SealedProduct.Template.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
||||
this.tournaments = new StorageBase<SealedProduct.Template>("Starter sets", new SealedProduct.Template.Reader(new File(blockDataFolder, "starters.txt")));
|
||||
this.fatPacks = new StorageBase<FatPack.Template>("Fat packs", new FatPack.Template.Reader("res/blockdata/fatpacks.txt"));
|
||||
this.printSheets = new StorageBase<PrintSheet>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
||||
}
|
||||
|
||||
List<CardRules> rules = reader.loadCards();
|
||||
for (CardRules card : rules) {
|
||||
if (null == card) continue;
|
||||
public final static StaticData instance() {
|
||||
return lastInstance;
|
||||
}
|
||||
|
||||
final String cardName = card.getName();
|
||||
if ( card.isVariant() )
|
||||
variantsCards.put(cardName, card);
|
||||
else
|
||||
regularCards.put(cardName, card);
|
||||
}
|
||||
public final CardEdition.Collection getEditions() {
|
||||
return this.editions;
|
||||
}
|
||||
|
||||
commonCards = new CardDb(regularCards, editions, false);
|
||||
variantCards = new CardDb(variantsCards, editions, false);
|
||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.item.FatPackTemplate}> */
|
||||
public IStorage<FatPack.Template> getFatPacks() {
|
||||
return fatPacks;
|
||||
}
|
||||
|
||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||
public final IStorage<SealedProduct.Template> getTournamentPacks() {
|
||||
return tournaments;
|
||||
}
|
||||
|
||||
this.boosters = new StorageBase<SealedProduct.Template>("Boosters", editions.getBoosterGenerator());
|
||||
this.specialBoosters = new StorageBase<SealedProduct.Template>("Special boosters", new SealedProduct.Template.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
||||
this.tournaments = new StorageBase<SealedProduct.Template>("Starter sets", new SealedProduct.Template.Reader(new File(blockDataFolder, "starters.txt")));
|
||||
this.fatPacks = new StorageBase<FatPack.Template>("Fat packs", new FatPack.Template.Reader("res/blockdata/fatpacks.txt"));
|
||||
this.printSheets = new StorageBase<PrintSheet>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
||||
}
|
||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||
public final IStorage<SealedProduct.Template> getBoosters() {
|
||||
return boosters;
|
||||
}
|
||||
|
||||
public final static StaticData instance() {
|
||||
return lastInstance;
|
||||
}
|
||||
public final IStorage<SealedProduct.Template> getSpecialBoosters() {
|
||||
return specialBoosters;
|
||||
}
|
||||
|
||||
public IStorage<PrintSheet> getPrintSheets() {
|
||||
return printSheets;
|
||||
}
|
||||
|
||||
public final CardEdition.Collection getEditions() {
|
||||
return this.editions;
|
||||
}
|
||||
|
||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.item.FatPackTemplate}> */
|
||||
public IStorage<FatPack.Template> getFatPacks() {
|
||||
return fatPacks;
|
||||
}
|
||||
|
||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||
public final IStorage<SealedProduct.Template> getTournamentPacks() {
|
||||
return tournaments;
|
||||
}
|
||||
|
||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
||||
public final IStorage<SealedProduct.Template> getBoosters() {
|
||||
return boosters;
|
||||
}
|
||||
|
||||
public final IStorage<SealedProduct.Template> getSpecialBoosters() {
|
||||
return specialBoosters;
|
||||
}
|
||||
|
||||
public IStorage<PrintSheet> getPrintSheets() {
|
||||
return printSheets;
|
||||
}
|
||||
|
||||
|
||||
public CardDb getCommonCards() {
|
||||
return commonCards;
|
||||
}
|
||||
|
||||
|
||||
public CardDb getVariantCards() {
|
||||
return variantCards;
|
||||
}
|
||||
public CardDb getCommonCards() {
|
||||
return commonCards;
|
||||
}
|
||||
|
||||
public CardDb getVariantCards() {
|
||||
return variantCards;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
|
||||
import forge.card.CardEdition.CardInSet;
|
||||
import forge.deck.CardPool;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.CollectionSuppliers;
|
||||
@@ -60,7 +59,6 @@ public final class CardDb implements ICardDatabase {
|
||||
private final Collection<PaperCard> roUniqueCards = Collections.unmodifiableCollection(uniqueCardsByName.values());
|
||||
private final CardEdition.Collection editions;
|
||||
|
||||
|
||||
public CardDb(Map<String, CardRules> rules, CardEdition.Collection editions0, boolean logMissingCards) {
|
||||
this.rulesByName = rules;
|
||||
this.editions = editions0;
|
||||
@@ -197,7 +195,6 @@ public final class CardDb implements ICardDatabase {
|
||||
return null != res && isFoil ? getFoiled(res) : res;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PaperCard tryGetCard(final String cardName, String setName) {
|
||||
return tryGetCard(cardName, setName, -1);
|
||||
@@ -280,7 +277,6 @@ public final class CardDb implements ICardDatabase {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PaperCard getCardPrintedByDate(final String name0, final boolean fromLatestSet, Date printedBefore ) {
|
||||
// Sometimes they read from decks things like "CardName|Set" - but we
|
||||
@@ -300,7 +296,6 @@ public final class CardDb implements ICardDatabase {
|
||||
|
||||
@Override
|
||||
public PaperCard getCard(final String name, final String set, final int artIndex) {
|
||||
|
||||
final PaperCard result = tryGetCard(name, set, artIndex);
|
||||
if (null == result) {
|
||||
final String message = String.format("Asked for '%s' from '%s' #%d: db didn't find that copy.", name, set, artIndex);
|
||||
@@ -412,5 +407,4 @@ public final class CardDb implements ICardDatabase {
|
||||
this.immediateReindex = immediateReindex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -223,7 +223,6 @@ public final class CardRules implements ICardCharacteristics {
|
||||
|
||||
public ColorSet getColorIdentity() {
|
||||
return colorIdentity;
|
||||
|
||||
}
|
||||
|
||||
/** Instantiates class, reads a card. For batch operations better create you own reader instance. */
|
||||
@@ -250,7 +249,6 @@ public final class CardRules implements ICardCharacteristics {
|
||||
private DeckHints hints = null;
|
||||
private DeckHints needs = null;
|
||||
|
||||
|
||||
/**
|
||||
* Reset all fields to parse next card (to avoid allocating new CardRulesReader N times)
|
||||
*/
|
||||
@@ -297,7 +295,6 @@ public final class CardRules implements ICardCharacteristics {
|
||||
return this.getCard();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parses the line.
|
||||
*
|
||||
@@ -372,7 +369,6 @@ public final class CardRules implements ICardCharacteristics {
|
||||
case 'O':
|
||||
if ("Oracle".equals(key)) {
|
||||
this.faces[this.curFace].setOracleText(value);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -423,7 +419,6 @@ public final class CardRules implements ICardCharacteristics {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,7 +458,6 @@ public final class CardRules implements ICardCharacteristics {
|
||||
*/
|
||||
@Override
|
||||
public final ManaCostShard next() {
|
||||
|
||||
final String unparsed = st.nextToken();
|
||||
// System.out.println(unparsed);
|
||||
try {
|
||||
|
||||
@@ -80,15 +80,11 @@ public final class PaperCard implements Comparable<IPaperCard>, InventoryItemFro
|
||||
return this.rarity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public String getImageKey() {
|
||||
// return getImageLocator(getImageName(), getArtIndex(), true, false);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public String getItemType() {
|
||||
return "Card";
|
||||
@@ -178,7 +174,6 @@ public final class PaperCard implements Comparable<IPaperCard>, InventoryItemFro
|
||||
// return String.format("%s|%s", name, cardSet);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -98,8 +98,6 @@ public class CardStorageReader implements ICardStorageReader {
|
||||
throw new RuntimeException("CardReader : constructor error -- not a directory -- " + cardsfolder.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
|
||||
final File zipFile = new File(cardsfolder, "cardsfolder.zip");
|
||||
|
||||
if (useZip && zipFile.exists()) {
|
||||
@@ -115,7 +113,6 @@ public class CardStorageReader implements ICardStorageReader {
|
||||
} // CardReader()
|
||||
|
||||
private final List<CardRules> loadCardsInRange(final List<File> files, int from, int to) {
|
||||
|
||||
CardRules.Reader rulesReader = new CardRules.Reader();
|
||||
|
||||
List<CardRules> result = new ArrayList<CardRules>();
|
||||
@@ -127,7 +124,6 @@ public class CardStorageReader implements ICardStorageReader {
|
||||
}
|
||||
|
||||
private final List<CardRules> loadCardsInRangeFromZip(final List<ZipEntry> files, int from, int to) {
|
||||
|
||||
CardRules.Reader rulesReader = new CardRules.Reader();
|
||||
|
||||
List<CardRules> result = new ArrayList<CardRules>();
|
||||
@@ -139,7 +135,6 @@ public class CardStorageReader implements ICardStorageReader {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts reading cards into memory until the given card is found.
|
||||
*
|
||||
@@ -162,7 +157,6 @@ public class CardStorageReader implements ICardStorageReader {
|
||||
estimatedFilesRemaining = allFiles.size();
|
||||
tasks = makeTaskListForFiles(allFiles);
|
||||
} else {
|
||||
|
||||
estimatedFilesRemaining = this.zip.size();
|
||||
ZipEntry entry;
|
||||
List<ZipEntry> entries = new ArrayList<ZipEntry>();
|
||||
@@ -257,7 +251,7 @@ public class CardStorageReader implements ICardStorageReader {
|
||||
});
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<File> collectCardFiles(List<File> accumulator, File startDir) {
|
||||
String[] list = startDir.list();
|
||||
|
||||
Reference in New Issue
Block a user