Code cleanup

This commit is contained in:
drdev
2013-12-08 17:49:49 +00:00
parent 0b9d254e12
commit 61fe9f2282

View File

@@ -57,7 +57,6 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
protected final transient MapOfLists<ZoneType, Card> cardsAddedThisTurn = new EnumMapOfLists<>(ZoneType.class, CollectionSuppliers.<Card>arrayLists());
public Zone(final ZoneType zone, Game game) {
this.zoneType = zone;
this.game = game;
@@ -70,14 +69,11 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
return null;
}
public final void add(final Card c) {
add(c, null);
}
public void add(final Card c, final Integer index) {
// Immutable cards are usually emblems and effects
if (!c.isImmutable()) {
final Zone oldZone = game.getZoneOf(c);
@@ -91,14 +87,15 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
}
c.setZone(this);
if ( index == null )
if (index == null) {
this.cardList.add(c);
else
}
else {
this.cardList.add(index.intValue(), c);
}
game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.Added, c));
}
public final boolean contains(final Card c) {
return this.cardList.contains(c);
}
@@ -112,7 +109,6 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.Removed, c));
}
public final void setCards(final Iterable<Card> cards) {
cardList.clear();
for (Card c : cards) {
@@ -120,10 +116,8 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
cardList.add(c);
}
game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.ComplexUpdate, null));
}
public final boolean is(final ZoneType zone) {
return zone == this.zoneType;
}
@@ -134,7 +128,6 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
return zoneType == zone && player == getPlayer();
}
public final ZoneType getZoneType() {
return this.zoneType;
}
@@ -143,7 +136,6 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
return this.cardList.size();
}
public final Card get(final int index) {
return this.cardList.get(index);
}
@@ -153,7 +145,6 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
return this.getCards(true);
}
public List<Card> getCards(final boolean filter) {
// Non-Battlefield PlayerZones don't care about the filter
return this.roCardList;
@@ -196,8 +187,9 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
// all cards if key == null
final List<Card> ret = new ArrayList<Card>();
for(Collection<Card> kv : cardsAddedThisTurn.values())
for (Collection<Card> kv : cardsAddedThisTurn.values()) {
ret.addAll(kv);
}
return ret;
}
@@ -234,6 +226,4 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
public String toString() {
return this.zoneType.toString();
}
}