rename a method (getCount => size) to be more uniform with java data structures

This commit is contained in:
Maxmtg
2013-03-21 20:08:30 +00:00
parent 30559d8f8e
commit b64cd4a97d
5 changed files with 5 additions and 15 deletions

View File

@@ -51,7 +51,7 @@ public class CardCollections {
this.scheme = new StorageImmediatelySerialized<Deck>(new DeckSerializer(new File(NewConstants.DECK_SCHEME_DIR)));
this.plane = new StorageImmediatelySerialized<Deck>(new DeckSerializer(new File(NewConstants.DECK_PLANE_DIR)));
System.out.printf("Read decks: %d constructed, %d sealed, %d draft, %d cubes, %d scheme, %d planar.%n", constructed.getCount(), sealed.getCount(), draft.getCount(), cube.getCount(), scheme.getCount(), plane.getCount());
System.out.printf("Read decks: %d constructed, %d sealed, %d draft, %d cubes, %d scheme, %d planar.%n", constructed.size(), sealed.size(), draft.size(), cube.size(), scheme.size(), plane.size());
// remove this after most people have been switched to new layout
final OldDeckParser oldParser = new OldDeckParser(this.constructed, this.draft, this.sealed, this.cube);

View File

@@ -153,7 +153,7 @@ public class DeckgenUtil {
/** @return {@link forge.deck.Deck} */
public static Deck getRandomCustomDeck() {
final IStorage<Deck> allDecks = Singletons.getModel().getDecks().getConstructed();
final int rand = (int) (Math.floor(Math.random() * allDecks.getCount()));
final int rand = (int) (Math.floor(Math.random() * allDecks.size()));
final String name = allDecks.getNames().toArray(new String[0])[rand];
return allDecks.get(name);
}

View File

@@ -121,7 +121,7 @@ public class QuestDeckMap implements IStorage<Deck> {
* @see forge.util.IStorageView#getCount()
*/
@Override
public int getCount() {
public int size() {
return map.size();
}

View File

@@ -56,6 +56,6 @@ public interface IStorageView<T> extends Iterable<T> {
*
* @return the count
*/
int getCount();
int size();
}

View File

@@ -77,16 +77,6 @@ public class StorageView<T> implements IStorageView<T> {
return this.map;
}
/*
* (non-Javadoc)
*
* @see java.lang.Iterable#iterator()
*/
/*
* (non-Javadoc)
*
* @see forge.deck.IFolderMapView#iterator()
*/
@Override
public Iterator<T> iterator() {
return this.map.values().iterator();
@@ -101,7 +91,7 @@ public class StorageView<T> implements IStorageView<T> {
}
@Override
public int getCount() {
public int size() {
return this.map.size();
}
}