Code cleanup

This commit is contained in:
drdev
2014-01-25 02:48:36 +00:00
parent a3fb6de6b3
commit b198e8a40e
4 changed files with 30 additions and 26 deletions

View File

@@ -125,9 +125,10 @@ public class DeckProxy implements InventoryItem {
if (sbSize == Integer.MIN_VALUE) { if (sbSize == Integer.MIN_VALUE) {
CardPool sb = getDeck().get(DeckSection.Sideboard); CardPool sb = getDeck().get(DeckSection.Sideboard);
sbSize = sb == null ? -1 : sb.countAll(); sbSize = sb == null ? -1 : sb.countAll();
if( sbSize == 0 ) if (sbSize == 0) {
sbSize = -1; sbSize = -1;
} }
}
return sbSize; return sbSize;
} }
@@ -179,21 +180,24 @@ public class DeckProxy implements InventoryItem {
} }
public void reloadFromStorage() { public void reloadFromStorage() {
if( null != storage ) if (storage != null) {
deck = storage.get(getName()); deck = storage.get(getName());
}
invalidateCache(); invalidateCache();
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateInStorage() { public void updateInStorage() {
if ( storage instanceof StorageImmediatelySerialized<?> ) if (storage instanceof StorageImmediatelySerialized<?>) {
((StorageImmediatelySerialized<IHasName>)storage).add(deck); ((StorageImmediatelySerialized<IHasName>)storage).add(deck);
} }
}
public void deleteFromStorage() { public void deleteFromStorage() {
if ( storage instanceof StorageImmediatelySerialized<?> ) if (storage instanceof StorageImmediatelySerialized<?>) {
storage.delete(getName()); storage.delete(getName());
} }
}
private static class ThemeDeckGenerator extends DeckProxy { private static class ThemeDeckGenerator extends DeckProxy {
private final String name; private final String name;

View File

@@ -47,8 +47,7 @@ public class DeckController<T extends DeckBase> {
* @param view0 the view0 * @param view0 the view0
* @param newModelCreator0 the new model creator0 * @param newModelCreator0 the new model creator0
*/ */
public DeckController(final IStorage<T> folder0, final ACEditorBase<?, T> view0, public DeckController(final IStorage<T> folder0, final ACEditorBase<?, T> view0, final Supplier<T> newModelCreator0) {
final Supplier<T> newModelCreator0) {
this.rootFolder = folder0; this.rootFolder = folder0;
this.currentFolder = rootFolder; this.currentFolder = rootFolder;
this.view = view0; this.view = view0;
@@ -142,10 +141,12 @@ public class DeckController<T extends DeckBase> {
} }
public void load(final String path, final String name) { public void load(final String path, final String name) {
if ( StringUtils.isBlank(path)) if (StringUtils.isBlank(path)) {
currentFolder = rootFolder; currentFolder = rootFolder;
else }
else {
currentFolder = rootFolder.tryGetFolder(path); currentFolder = rootFolder.tryGetFolder(path);
}
load(name); load(name);
} }

View File

@@ -407,7 +407,6 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
*/ */
public void setPool(final ItemPool<T> poolView, boolean infinite) { public void setPool(final ItemPool<T> poolView, boolean infinite) {
this.setPoolImpl(ItemPool.createFrom(poolView, this.genericType), infinite); this.setPoolImpl(ItemPool.createFrom(poolView, this.genericType), infinite);
} }
public void setPool(final ItemPool<T> pool0) { public void setPool(final ItemPool<T> pool0) {