Merge pull request #2268 from ingmargoudt/master

replace [list].size() == 0 and [string].length() == 0 to use .isEmpty…
This commit is contained in:
LevelX2 2016-09-14 17:15:10 +02:00 committed by GitHub
commit eae53c0cfc
48 changed files with 90 additions and 109 deletions

View file

@ -85,7 +85,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
}
public void loadBooster(CardsView booster, BigCard bigCard) {
if (booster instanceof CardsView && booster.size() == 0) {
if (booster instanceof CardsView && booster.isEmpty()) {
emptyGrid = true;
} else {
if (!emptyGrid) {

View file

@ -126,7 +126,7 @@ public class ChoiceDialog extends IDialogPanel {
}
private void displayCards(CardsView cards, UUID gameId, BigCard bigCard) {
if (cards.size() == 0) {
if (cards.isEmpty()) {
return;
}

View file

@ -103,7 +103,7 @@ public class StackDialog extends IDialogPanel {
private void displayStack(CardsView cards, UUID gameId, BigCard bigCard) {
if (cards == null || cards.size() == 0) {
if (cards == null || cards.isEmpty()) {
return;
}

View file

@ -259,7 +259,7 @@ public class ResetPasswordDialog extends MageDialog {
}// </editor-fold>//GEN-END:initComponents
private void btnGetAuthTokenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGetAuthTokenActionPerformed
if (this.txtEmail.getText().length() == 0) {
if (this.txtEmail.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an email address.");
return;
}
@ -275,15 +275,15 @@ public class ResetPasswordDialog extends MageDialog {
}//GEN-LAST:event_btnGetAuthTokenActionPerformed
private void btnSubmitNewPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitNewPasswordActionPerformed
if (this.txtEmail.getText().length() == 0) {
if (this.txtEmail.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an email address.");
return;
}
if (this.txtAuthToken.getText().length() == 0) {
if (this.txtAuthToken.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an auth token.");
return;
}
if (this.txtPassword.getText().length() == 0) {
if (this.txtPassword.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter a new password.");
return;
}

View file

@ -166,7 +166,7 @@ public class TournamentPlayerPanel extends javax.swing.JPanel {
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
this.pnlPlayerName.setVisible(true);
if (this.txtPlayerName.getText().length() == 0) {
if (this.txtPlayerName.getText().isEmpty()) {
this.txtPlayerName.setText("Computer " + this.lblPlayerNum.getText());
}
}

View file

@ -153,7 +153,7 @@ public class GlowText extends JLabel {
@Override
public void paint(Graphics g) {
if (getText().length() == 0) {
if (getText().isEmpty()) {
return;
}

View file

@ -217,7 +217,7 @@ public class ManaSymbols {
loadSymbolsImages(symbolWidth);
}
Map<String, BufferedImage> sizedSymbols = manaImages.get(symbolWidth);
if (manaCost.length() == 0) {
if (manaCost.isEmpty()) {
return;
}
manaCost = manaCost.replace("\\", "");

View file

@ -98,7 +98,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
ArrayList<CardDownloadData> cards = getNeededCards(allCards);
/*
* if (cards == null || cards.size() == 0) {
* if (cards == null || cards.isEmpty()) {
* JOptionPane.showMessageDialog(null,
* "All card pictures have been downloaded."); return; }
*/

View file

@ -27,22 +27,6 @@
*/
package mage.remote;
import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.Authenticator;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import mage.MageException;
import mage.cards.decks.DeckCardLists;
import mage.cards.decks.InvalidDeckException;
@ -62,22 +46,9 @@ import mage.interfaces.ServerState;
import mage.interfaces.callback.ClientCallback;
import mage.players.net.UserData;
import mage.utils.CompressUtil;
import mage.view.DraftPickView;
import mage.view.GameTypeView;
import mage.view.MatchView;
import mage.view.RoomUsersView;
import mage.view.TableView;
import mage.view.TournamentTypeView;
import mage.view.TournamentView;
import mage.view.UserView;
import mage.view.*;
import org.apache.log4j.Logger;
import org.jboss.remoting.CannotConnectException;
import org.jboss.remoting.Client;
import org.jboss.remoting.ConnectionListener;
import org.jboss.remoting.ConnectionValidator;
import org.jboss.remoting.InvocationFailureException;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.Remoting;
import org.jboss.remoting.*;
import org.jboss.remoting.callback.Callback;
import org.jboss.remoting.callback.HandleCallbackException;
import org.jboss.remoting.callback.InvokerCallbackHandler;
@ -85,6 +56,12 @@ import org.jboss.remoting.transport.bisocket.Bisocket;
import org.jboss.remoting.transport.socket.SocketWrapper;
import org.jboss.remoting.transporter.TransporterClient;
import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
*
* @author BetaSteward_at_googlemail.com

View file

@ -185,7 +185,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
if (logger.isInfoEnabled()) {
printOutState(game);
}
if (actions.size() == 0) {
if (actions.isEmpty()) {
calculateActions(game);
}
act(game);
@ -351,7 +351,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
/*
* // Try to fix horizon effect if (root.combat == null ||
* root.combat.getAttackers().size() == 0) {
* root.combat.getAttackers().isEmpty()) {
* FilterCreatureForAttack attackFilter = new
* FilterCreatureForAttack();
* attackFilter.getControllerId().add(playerId); List<Permanent>

View file

@ -105,7 +105,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
case PRECOMBAT_MAIN:
if (game.getActivePlayerId().equals(playerId)) {
printOutState(game);
if (actions.size() == 0) {
if (actions.isEmpty()) {
logger.info("Sim Calculate pre combat actions ----------------------------------------------------- ");
calculatePreCombatActions(game);
}
@ -122,7 +122,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
case DECLARE_ATTACKERS:
if (!game.getActivePlayerId().equals(playerId)) {
printOutState(game);
if (actions.size() == 0) {
if (actions.isEmpty()) {
logger.info("Sim Calculate declare attackers actions ----------------------------------------------------- ");
calculatePreCombatActions(game);
}
@ -142,7 +142,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
case POSTCOMBAT_MAIN:
// if (game.getActivePlayerId().equals(playerId)) {
printOutState(game);
if (actions.size() == 0) {
if (actions.isEmpty()) {
calculatePostCombatActions(game);
}
act(game);

View file

@ -117,7 +117,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
case COMBAT_DAMAGE:
case END_COMBAT:
case POSTCOMBAT_MAIN:
if (actions.size() == 0) {
if (actions.isEmpty()) {
calculateActions(game);
}
act(game);
@ -131,7 +131,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
}
protected void act(Game game) {
if (actions == null || actions.size() == 0)
if (actions == null || actions.isEmpty())
pass(game);
else {
boolean usedStack = false;

View file

@ -78,7 +78,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
return false;
case PRECOMBAT_MAIN:
if (game.getActivePlayerId().equals(playerId)) {
if (actions.size() == 0) {
if (actions.isEmpty()) {
calculatePreCombatActions(game);
}
act(game);
@ -92,7 +92,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
return false;
case DECLARE_ATTACKERS:
if (!game.getActivePlayerId().equals(playerId)) {
if (actions.size() == 0) {
if (actions.isEmpty()) {
calculatePreCombatActions(game);
}
act(game);
@ -109,7 +109,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
return false;
case POSTCOMBAT_MAIN:
if (game.getActivePlayerId().equals(playerId)) {
if (actions.size() == 0) {
if (actions.isEmpty()) {
calculatePostCombatActions(game);
}
act(game);

View file

@ -63,7 +63,7 @@ public class GmailClient {
}
public static boolean sendMessage(String email, String subject, String text) {
if (email.length() == 0) {
if (email.isEmpty()) {
logger.info("Email is not sent because the address is empty");
return false;
}

View file

@ -15,7 +15,7 @@ public class MailClient {
private static final Logger logger = Logger.getLogger(Main.class);
public static boolean sendMessage(String email, String subject, String text) {
if (email.length() == 0) {
if (email.isEmpty()) {
logger.info("Email is not sent because the address is empty");
return false;
}

View file

@ -14,7 +14,7 @@ public class MailgunClient {
private static final Logger logger = Logger.getLogger(Main.class);
public static boolean sendMessage(String email, String subject, String text) {
if (email.length() == 0) {
if (email.isEmpty()) {
logger.info("Email is not sent because the address is empty");
return false;
}

View file

@ -55,7 +55,7 @@ public class SystemUtil {
try {
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
if (line.trim().length() == 0 || line.startsWith("#")) {
if (line.trim().isEmpty() || line.startsWith("#")) {
continue;
}

View file

@ -95,7 +95,7 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
if (object != null && object instanceof Spell) {
Card c = (Spell) object;
if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}

View file

@ -102,7 +102,7 @@ class NezumiGraverobberFlipEffect extends OneShotEffect {
if (card != null) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
if (player.getGraveyard().size() == 0) {
if (player.getGraveyard().isEmpty()) {
return new FlipSourceEffect(new NighteyesTheDesecratorToken()).apply(game, source);
}
}

View file

@ -112,7 +112,7 @@ class DesecratorHagEffect extends OneShotEffect {
}
}
}
if (cards.size() == 0) {
if (cards.isEmpty()) {
return true;
}
if (cards.size() > 1

View file

@ -85,7 +85,7 @@ class OpponentHasNoCardsInHandCondition implements Condition {
if (player != null) {
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId);
if (opponent != null && opponent.getHand().size() == 0) {
if (opponent != null && opponent.getHand().isEmpty()) {
return true;
}
}

View file

@ -86,7 +86,7 @@ class DingusEggTriggeredAbility extends TriggeredAbilityImpl {
if (zEvent.getFromZone() == Zone.BATTLEFIELD
&& zEvent.getToZone() == Zone.GRAVEYARD
&& zEvent.getTarget().getCardType().contains(CardType.LAND)) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
UUID targetId = zEvent.getTarget().getControllerId();
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(targetId));

View file

@ -84,7 +84,7 @@ class GorillaTitanCondition implements Condition {
Player p = game.getPlayer(source.getControllerId());
if (p != null)
{
return p.getGraveyard().size() == 0;
return p.getGraveyard().isEmpty();
}
return false;
}

View file

@ -102,7 +102,7 @@ class CloneShellEffect extends OneShotEffect {
cards.add(card);
}
if (cards.size() == 0) {
if (cards.isEmpty()) {
return false;
}

View file

@ -89,7 +89,7 @@ class AEtherFlashTriggeredAbility extends TriggeredAbilityImpl {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(targetId));
}

View file

@ -134,7 +134,7 @@ class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null && opponent.getHand().size() == 0) {
if (opponent != null && opponent.getHand().isEmpty()) {
opponent.loseLife(2, game);
return true;
}

View file

@ -100,7 +100,7 @@ class ImmortalCoilAbility extends StateTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Player player = game.getPlayer(this.getControllerId());
return player != null && player.getGraveyard().size() == 0;
return player != null && player.getGraveyard().isEmpty();
}
@Override

View file

@ -94,7 +94,7 @@ class RivalryTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}

View file

@ -133,7 +133,7 @@ class QuestForTheNihilStoneTriggeredAbility2 extends TriggeredAbilityImpl {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null
&& opponent.getHand().size() == 0
&& opponent.getHand().isEmpty()
&& quest.getCounters(game).getCount(CounterType.QUEST) >= 2) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(opponent.getId()));

View file

@ -90,7 +90,7 @@ class GuulDrazSpecterCondition implements Condition {
Set<UUID> opponents = game.getOpponents(source.getControllerId());
for (UUID opponentId : opponents) {
result |= game.getPlayer(opponentId).getHand().size() == 0;
result |= game.getPlayer(opponentId).getHand().isEmpty();
}
return result;

View file

@ -45,7 +45,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl {
case YOU:
boolean yours = event.getPlayerId().equals(this.controllerId);
if (yours && setTargetPointer) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}

View file

@ -77,7 +77,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
case YOU:
boolean yours = event.getPlayerId().equals(this.controllerId);
if (yours) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
@ -86,7 +86,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
return yours;
case OPPONENT:
if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
@ -96,7 +96,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
break;
case NOT_YOU:
if (!this.controllerId.equals(event.getPlayerId())) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
@ -109,7 +109,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
if (attachment != null && attachment.getAttachedTo() != null) {
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
if (attachedTo != null && attachedTo.getControllerId().equals(event.getPlayerId())) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
@ -119,7 +119,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
}
break;
case ANY:
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}

View file

@ -54,7 +54,7 @@ public class BeginningOfPreCombatMainTriggeredAbility extends TriggeredAbilityIm
case YOU:
boolean yours = event.getPlayerId().equals(this.controllerId);
if (yours && setTargetPointer) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}

View file

@ -71,7 +71,7 @@ public class BeginningOfUntapTriggeredAbility extends TriggeredAbilityImpl {
break;
case OPPONENT:
if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
@ -82,7 +82,7 @@ public class BeginningOfUntapTriggeredAbility extends TriggeredAbilityImpl {
case ANY:
controller = game.getPlayer(this.getControllerId());
if (controller != null && controller.getInRange().contains(event.getPlayerId())) {
if (getTargets().size() == 0) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}

View file

@ -41,7 +41,7 @@ public class HellbentCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return game.getPlayer(source.getControllerId()).getHand().size() == 0;
return game.getPlayer(source.getControllerId()).getHand().isEmpty();
}
@Override

View file

@ -70,7 +70,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
if (text != null) {
return text;
}
if (this.size() == 0) {
if (this.isEmpty()) {
return "";
}

View file

@ -262,11 +262,11 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
// First try only to pay colored mana with the pool
for (ManaCost cost : this) {
if (!cost.isPaid() && cost instanceof MonoHybridManaCost) {
if (((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.W)) && pool.getWhite() > 0)
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.B)) && pool.getBlack() > 0)
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.R)) && pool.getRed() > 0)
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.G)) && pool.getGreen() > 0)
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.U)) && pool.getBlue() > 0)) {
if (((cost.containsColor(ColoredManaSymbol.W)) && pool.getWhite() > 0)
|| ((cost.containsColor(ColoredManaSymbol.B)) && pool.getBlack() > 0)
|| ((cost.containsColor(ColoredManaSymbol.R)) && pool.getRed() > 0)
|| ((cost.containsColor(ColoredManaSymbol.G)) && pool.getGreen() > 0)
|| ((cost.containsColor(ColoredManaSymbol.U)) && pool.getBlue() > 0)) {
cost.assignPayment(game, ability, pool, costToPay);
if (pool.count() == 0) {
return;
@ -315,12 +315,12 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
public final void load(String mana) {
this.clear();
if (costs.containsKey(mana)) {
ManaCosts<T> savedCosts = costs.get(mana);
ManaCosts<ManaCost> savedCosts = costs.get(mana);
for (ManaCost cost : savedCosts) {
this.add((T) cost.copy());
this.add(cost.copy());
}
} else {
if (mana == null || mana.length() == 0) {
if (mana == null || mana.isEmpty()) {
return;
}
String[] symbols = mana.split("^\\{|\\}\\{|\\}$");
@ -347,11 +347,11 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
this.add(new VariableManaCost(modifierForX));
} //TODO: handle multiple {X} and/or {Y} symbols
} else if (Character.isDigit(symbol.charAt(0))) {
this.add((T) new MonoHybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(2))));
this.add(new MonoHybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(2))));
} else if (symbol.contains("P")) {
this.add((T) new PhyrexianManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
this.add(new PhyrexianManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
} else {
this.add((T) new HybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(0)), ColoredManaSymbol.lookup(symbol.charAt(2))));
this.add(new HybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(0)), ColoredManaSymbol.lookup(symbol.charAt(2))));
}
}
}
@ -392,7 +392,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
if (text != null) {
return text;
}
if (this.size() == 0) {
if (this.isEmpty()) {
return "";
}

View file

@ -110,7 +110,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
}
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() == 0) {
if (mode.getTargets().isEmpty()) {
sb.append("counter it");
} else {
sb.append("Counter target ").append(mode.getTargets().get(0).getTargetName());

View file

@ -45,7 +45,7 @@ public class DckDeckImporter extends DeckImporter {
@Override
protected void readLine(String line, DeckCardLists deckList) {
if (line.length() == 0 || line.startsWith("#")) {
if (line.isEmpty() || line.startsWith("#")) {
return;
}

View file

@ -40,7 +40,7 @@ public class DecDeckImporter extends DeckImporter {
@Override
protected void readLine(String line, DeckCardLists deckList) {
if (line.length() == 0 || line.startsWith("//")) {
if (line.isEmpty() || line.startsWith("//")) {
return;
}

View file

@ -13,7 +13,7 @@ public class DekDeckImporter extends DeckImporter {
@Override
protected void readLine(String line, DeckCardLists deckList) {
if (line.length() == 0 || line.startsWith("#") || !line.contains("<Cards CatID")) {
if (line.isEmpty() || line.startsWith("#") || !line.contains("<Cards CatID")) {
return;
}
try {

View file

@ -44,7 +44,7 @@ public class MWSDeckImporter extends DeckImporter {
@Override
protected void readLine(String line, DeckCardLists deckList) {
if (line.length() == 0 || line.startsWith("//")) {
if (line.isEmpty() || line.startsWith("//")) {
return;
}
boolean sideboard = false;

View file

@ -61,7 +61,7 @@ public class TxtDeckImporter extends DeckImporter {
// Start the sideboard on empty line that follows
// at least 1 non-empty line
if (line.length() == 0 && nonEmptyLinesTotal > 0) {
if (line.isEmpty() && nonEmptyLinesTotal > 0) {
sideboard = true;
return;
} else {

View file

@ -55,11 +55,11 @@ public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer
@Override
public boolean match(MageItem o, Game game) {
if (o instanceof Player) {
if (((Player)o).getCounters().size() == 0) {
if (((Player)o).getCounters().isEmpty()) {
return false;
}
} else if (o instanceof Permanent) {
if (((Permanent)o).getCounters(game).size() == 0) {
if (((Permanent)o).getCounters(game).isEmpty()) {
return false;
}
}

View file

@ -28,7 +28,7 @@
package mage.game.tournament;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import mage.constants.TournamentPlayerState;
@ -49,7 +49,7 @@ public abstract class TournamentSwiss extends TournamentImpl {
@Override
protected void runTournament() {
for (Map.Entry<UUID, TournamentPlayer> entry : players.entrySet()) {
for (Entry<UUID, TournamentPlayer> entry : players.entrySet()) {
if (entry.getValue().getPlayer().autoLoseGame()) {
entry.getValue().setEliminated();
entry.getValue().setResults("Auto Eliminated");

View file

@ -474,4 +474,8 @@ public class ManaPool implements Serializable {
}
return false;
}
public boolean isEmpty(){
return count() == 0;
}
}

View file

@ -2536,7 +2536,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
if (manaCosts.size() == 0) {
if (manaCosts.isEmpty()) {
return true;
} else {
if (available == null) {
@ -2567,7 +2567,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
if (manaCosts.size() == 0) {
if (manaCosts.isEmpty()) {
return true;
} else {
for (Mana mana : manaCosts.getOptions()) {
@ -2604,7 +2604,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
if (manaCosts.size() == 0) {
if (manaCosts.isEmpty()) {
return true;
} else {
for (Mana mana : manaCosts.getOptions()) {

View file

@ -80,13 +80,13 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer
public boolean canTarget(UUID id, Game game) {
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
if (permanent.getCounters(game).size() == 0) {
if (permanent.getCounters(game).isEmpty()) {
return false;
}
}
Player player = game.getPlayer(id);
if (player != null) {
if (player.getCounters().size() == 0) {
if (player.getCounters().isEmpty()) {
return false;
}
}
@ -97,13 +97,13 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer
public boolean canTarget(UUID id, Ability source, Game game) {
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
if (permanent.getCounters(game).size() == 0) {
if (permanent.getCounters(game).isEmpty()) {
return false;
}
}
Player player = game.getPlayer(id);
if (player != null) {
if (player.getCounters().size() == 0) {
if (player.getCounters().isEmpty()) {
return false;
}
}