Minor formatting.

This commit is contained in:
LevelX2 2013-06-11 17:22:21 +02:00
parent 21e88c1ce3
commit 140bf42f60

View file

@ -87,15 +87,17 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
@Override @Override
public Card get(UUID cardId, Game game) { public Card get(UUID cardId, Game game) {
if (this.contains(cardId)) if (this.contains(cardId)) {
return game.getCard(cardId); return game.getCard(cardId);
}
return null; return null;
} }
@Override @Override
public void remove(Card card) { public void remove(Card card) {
if (card == null) if (card == null) {
return; return;
}
this.remove(card.getId()); this.remove(card.getId());
} }
@ -109,8 +111,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
@Override @Override
public Card getRandom(Game game) { public Card getRandom(Game game) {
if (this.size() == 0) if (this.size() == 0) {
return null; return null;
}
UUID[] cards = this.toArray(new UUID[0]); UUID[] cards = this.toArray(new UUID[0]);
return game.getCard(cards[rnd.nextInt(cards.length)]); return game.getCard(cards[rnd.nextInt(cards.length)]);
} }
@ -118,9 +121,10 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
@Override @Override
public int count(FilterCard filter, Game game) { public int count(FilterCard filter, Game game) {
int result = 0; int result = 0;
for (UUID card: this) { for (UUID cardId: this) {
if (filter.match(game.getCard(card), game)) if (filter.match(game.getCard(cardId), game)) {
result++; result++;
}
} }
return result; return result;
} }