edition cached in deckproxy

This commit is contained in:
Maxmtg
2014-01-25 15:50:56 +00:00
parent 6d34dbc286
commit 2f29cf7755

View File

@@ -48,6 +48,7 @@ public class DeckProxy implements InventoryItem {
private int sbSize = Integer.MIN_VALUE;
private final String path;
private final Function<IHasName, Deck> fnGetDeck;
private String edition;
public DeckProxy(Deck deck, GameType type, IStorage<? extends IHasName> storage) {
this(deck, type, "", storage, null);
@@ -85,12 +86,13 @@ public class DeckProxy implements InventoryItem {
}
public String getEdition() {
if ( deck instanceof PreconDeck )
return ((PreconDeck) deck).getEdition();
Deck d = getDeck();
if ( d != null )
return StaticData.instance().getEditions().getEarliestEditionWithAllCards(d.getAllCardsInASinglePool()).getCode();
return null;
if ( null == edition ) {
if ( deck instanceof PreconDeck )
edition = ((PreconDeck) deck).getEdition();
if ( !isGeneratedDeck() )
edition = StaticData.instance().getEditions().getEarliestEditionWithAllCards(getDeck().getAllCardsInASinglePool()).getCode();
}
return edition;
}
@Override
@@ -101,6 +103,7 @@ public class DeckProxy implements InventoryItem {
public void invalidateCache() {
color = null;
formats = null;
edition = null;
mainSize = Integer.MIN_VALUE;
sbSize = Integer.MIN_VALUE;
}