- CheckStyle.

This commit is contained in:
Chris
2012-02-29 20:13:35 +00:00
parent 220970b27a
commit e2b750d064
7 changed files with 20 additions and 16 deletions

View File

@@ -71,12 +71,14 @@ public final class CardUtil {
* @return a {@link forge.Card} object.
*/
public static <T> T getRandom(final T[] o) {
if ( o == null ) throw new IllegalArgumentException("CardUtil : getRandom(T) recieved null instead of array.");
if (o == null) {
throw new IllegalArgumentException("CardUtil : getRandom(T) recieved null instead of array.");
}
int len = o.length;
switch(len) {
case 0: throw new IllegalArgumentException("CardUtil : getRandom(T) recieved an empty array.");
switch(len) {
case 0: throw new IllegalArgumentException("CardUtil : getRandom(T) recieved an empty array.");
case 1: return o[0];
default: return o[CardUtil.RANDOM.nextInt(len)];
default: return o[CardUtil.RANDOM.nextInt(len)];
}
}

View File

@@ -941,7 +941,7 @@ public class Combat {
*/
public final List<Card> getUnblockedAttackers() {
final List<Card> out = new ArrayList<Card>();
for(Card c : this.unblockedMap.keySet()) {
for (Card c : this.unblockedMap.keySet()) {
if (!c.hasFirstStrike()) {
out.add(c);
}
@@ -958,7 +958,7 @@ public class Combat {
*/
public final List<Card> getUnblockedFirstStrikeAttackers() {
final List<Card> out = new ArrayList<Card>();
for(Card c : this.unblockedMap.keySet()) { // only add creatures without firstStrike to this
for (Card c : this.unblockedMap.keySet()) { // only add creatures without firstStrike to this
if (c.hasFirstStrike() || c.hasDoubleStrike()) {
out.add(c);
}

View File

@@ -714,7 +714,7 @@ public class CombatUtil {
int cntAttackers = combat.getAttackers().size();
for (final Card card : AllZoneUtil.getCardsIn(Constant.Zone.Battlefield)) {
for (final String keyword : card.getKeyword()) {
if (keyword.equals("No more than one creature can attack each combat.") && cntAttackers > 0 ) {
if (keyword.equals("No more than one creature can attack each combat.") && cntAttackers > 0) {
return false;
}
if (keyword.equals("No more than two creatures can attack each combat.") && cntAttackers > 1) {

View File

@@ -227,7 +227,7 @@ public class ComputerAIGeneral implements Computer {
}
/**
* Returns the spellAbilities from the card list
* Returns the spellAbilities from the card list.
*
* @param l
* a {@link forge.CardList} object.

View File

@@ -199,9 +199,10 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
@Override
public final void setCards(final Iterable<Card> cards) {
List<Card> toSet = new ArrayList<Card>();
for(Card c : cards)
for (Card c : cards) {
toSet.add(c);
this.setCardList( toSet );
}
this.setCardList(toSet);
this.update();
}
@@ -313,7 +314,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @return an array of {@link forge.Card} objects.
*/
@Override
public final List<Card>getCards() {
public final List<Card> getCards() {
return this.getCards(true);
}

View File

@@ -353,12 +353,13 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
// Battlefield filters out Phased Out cards by default. Needs to call
// getCards(false) to get Phased Out cards
if (!filter)
if (!filter) {
return new ArrayList<Card>(this.getCardList());
}
final ArrayList<Card> list = new ArrayList<Card>();
for(Card crd : this.getCardList())
{
for (Card crd : this.getCardList()) {
if (!crd.isPhasedOut()) {
list.add(crd);
}

View File

@@ -282,7 +282,7 @@ public class SpellPermanent extends Spell {
if (card.getSVar("PlayMain1").equals("TRUE")) {
wait = false;
}
if ((card.isCreature() && (ComputerAIGeneral.hasACardGivingHaste()
if ((card.isCreature() && (ComputerAIGeneral.hasACardGivingHaste()
|| card.hasKeyword("Haste"))) || card.hasKeyword("Exalted")) {
wait = false;
}
@@ -348,7 +348,7 @@ public class SpellPermanent extends Spell {
return canPlayFromEffectAI(false, true);
} // canPlayAI()
/** {@inheritDoc} */
@Override
public boolean canPlayFromEffectAI(final boolean mandatory, final boolean withOutManaCost) {