list.size > 0 changed to !list.isEmpty

We care about if it's empty or not, not about it's size
This commit is contained in:
vraskulin 2017-01-27 16:04:56 +03:00
parent f60ebfbb1f
commit 0557b5e89c
366 changed files with 532 additions and 548 deletions

View file

@ -77,7 +77,7 @@ public class AddCardSubTypeTargetEffect extends ContinuousEffectImpl {
@Override
public String getText(Mode mode) {
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() > 0) {
if (!mode.getTargets().isEmpty()) {
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
} else {
sb.append("It ");

View file

@ -106,7 +106,7 @@ public class AssignNoCombatDamageSourceEffect extends ReplacementEffectImpl {
text += " this combat";
break;
default:
if (duration.toString().length() > 0) {
if (!duration.toString().isEmpty()) {
text += ' ' + duration.toString();
}
}

View file

@ -118,11 +118,11 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() > 0) {
if (!mode.getTargets().isEmpty()) {
sb.append("target ");
sb.append(mode.getTargets().get(0).getFilter().getMessage());
sb.append(" becomes the color or colors of your choice");
if (duration.toString().length() > 0) {
if (!duration.toString().isEmpty()) {
sb.append(' ').append(duration.toString());
}
}

View file

@ -76,7 +76,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (token.getCardType().size() > 0) {
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
@ -86,7 +86,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
if (type == null) {
permanent.getSubtype(game).clear();
}
if (token.getSubtype(game).size() > 0) {
if (!token.getSubtype(game).isEmpty()) {
permanent.getSubtype(game).addAll(token.getSubtype(game));
}
}
@ -100,7 +100,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
break;
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
if (token.getAbilities().size() > 0) {
if (!token.getAbilities().isEmpty()) {
for (Ability ability : token.getAbilities()) {
permanent.addAbility(ability, source.getSourceId(), game);
}
@ -146,7 +146,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
sb.append(" become ");
}
sb.append(token.getDescription());
if (type != null && type.length() > 0) {
if (type != null && !type.isEmpty()) {
sb.append(". They are still ").append(type);
}
return sb.toString();

View file

@ -48,7 +48,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
public enum LoseType {
NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE_AND_PT
};
}
protected Token token;
protected String type;
@ -86,7 +86,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (token.getSupertype().size() > 0) {
if (!token.getSupertype().isEmpty()) {
for (String t : token.getSupertype()) {
if (!permanent.getSupertype().contains(t)) {
permanent.getSupertype().add(t);
@ -100,7 +100,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
permanent.getCardType().clear();
break;
}
if (token.getCardType().size() > 0) {
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
@ -115,7 +115,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
break;
}
if (token.getSubtype(game).size() > 0) {
if (!token.getSubtype(game).isEmpty()) {
for (String t : token.getSubtype(game)) {
if (!permanent.getSubtype(game).contains(t)) {
permanent.getSubtype(game).add(t);
@ -148,7 +148,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
permanent.removeAllAbilities(source.getSourceId(), game);
break;
}
if (token.getAbilities().size() > 0) {
if (!token.getAbilities().isEmpty()) {
for (Ability ability : token.getAbilities()) {
permanent.addAbility(ability, source.getSourceId(), game);
}

View file

@ -113,7 +113,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
if (losePreviousTypes) {
permanent.getCardType().clear();
}
if (token.getCardType().size() > 0) {
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
@ -123,7 +123,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
if ("".equals(type) || type == null && permanent.getCardType().contains(CardType.LAND)) {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
}
if (token.getSubtype(game).size() > 0) {
if (!token.getSubtype(game).isEmpty()) {
permanent.getSubtype(game).addAll(token.getSubtype(game));
}
}
@ -137,7 +137,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
break;
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
if (token.getAbilities().size() > 0) {
if (!token.getAbilities().isEmpty()) {
for (Ability ability : token.getAbilities()) {
permanent.addAbility(ability, source.getSourceId(), game);
}
@ -172,7 +172,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
}
private void setText() {
if (type != null && type.length() > 0) {
if (type != null && !type.isEmpty()) {
staticText = duration.toString() + " {this} becomes a " + token.getDescription() + " that's still a " + this.type;
} else {
staticText = duration.toString() + " {this} becomes a " + token.getDescription();

View file

@ -91,7 +91,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
permanent.getSubtype(game).addAll(token.getSubtype(game));
} else {
if (token.getSubtype(game).size() > 0) {
if (!token.getSubtype(game).isEmpty()) {
for (String subtype : token.getSubtype(game)) {
if (!permanent.getSubtype(game).contains(subtype)) {
permanent.getSubtype(game).add(subtype);
@ -100,7 +100,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
}
}
if (token.getCardType().size() > 0) {
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
@ -128,7 +128,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
permanent.removeAllAbilities(source.getSourceId(), game);
}
if (sublayer == SubLayer.NA) {
if (token.getAbilities().size() > 0) {
if (!token.getAbilities().isEmpty()) {
for (Ability ability : token.getAbilities()) {
permanent.addAbility(ability, source.getSourceId(), game);
}

View file

@ -132,7 +132,7 @@ public class BoostEquippedEffect extends ContinuousEffectImpl {
if (duration != Duration.WhileOnBattlefield)
sb.append(' ').append(duration.toString());
String message = power.getMessage();
if (message.length() > 0) {
if (!message.isEmpty()) {
sb.append(" for each ");
}
sb.append(message);

View file

@ -197,7 +197,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
if (quotes) {
sb.append('"');
}
if (duration.toString().length() > 0) {
if (!duration.toString().isEmpty()) {
sb.append(' ').append(duration.toString());
}
return sb.toString();

View file

@ -71,7 +71,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard, Layer layer, SubLayer subLayer) {
super(duration, layer, subLayer,
ability.getEffects().size() > 0 ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility);
!ability.getEffects().isEmpty() ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility);
this.ability = ability;
staticText = rule;
this.onCard = onCard;

View file

@ -48,7 +48,7 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
public static enum HandSizeModification {
SET, INCREASE, REDUCE
};
}
protected DynamicValue handSize;
protected HandSizeModification handSizeModification;