equals "" should be replaced with isEmpty

This commit is contained in:
vraskulin 2017-02-28 11:45:15 +03:00
parent 3600d03e2c
commit ad7d3c8078
6 changed files with 7 additions and 7 deletions

View file

@ -88,7 +88,7 @@ class FilterCoverOfDarkness extends FilterCreaturePermanent {
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
if (super.match(permanent, sourceId, playerId, game)) { if (super.match(permanent, sourceId, playerId, game)) {
String subtype = (String) game.getState().getValue(sourceId + "_type"); String subtype = (String) game.getState().getValue(sourceId + "_type");
if (subtype != null && !subtype.equals("") && permanent.hasSubtype(subtype, game)) { if (subtype != null && !subtype.isEmpty() && permanent.hasSubtype(subtype, game)) {
return true; return true;
} }
} }

View file

@ -86,7 +86,7 @@ class FilterSteelyResolve extends FilterCreaturePermanent {
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
if (super.match(permanent, sourceId, playerId, game)) { if (super.match(permanent, sourceId, playerId, game)) {
String subtype = (String) game.getState().getValue(sourceId + "_type"); String subtype = (String) game.getState().getValue(sourceId + "_type");
if (subtype != null && !subtype.equals("") && permanent.hasSubtype(subtype, game)) { if (subtype != null && !subtype.isEmpty() && permanent.hasSubtype(subtype, game)) {
return true; return true;
} }
} }

View file

@ -116,7 +116,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i
} }
} }
} }
if ("".equals(type) || type == null) { if (type != null && type.isEmpty() || type == null) {
permanent.getSubtype(game).clear(); permanent.getSubtype(game).clear();
} }
if (!token.getSubtype(game).isEmpty()) { if (!token.getSubtype(game).isEmpty()) {

View file

@ -210,7 +210,7 @@ public class VerifyCardDataTest {
private void checkCost(Card card, JsonCard ref) { private void checkCost(Card card, JsonCard ref) {
String expected = ref.manaCost; String expected = ref.manaCost;
String cost = join(card.getManaCost().getSymbols()); String cost = join(card.getManaCost().getSymbols());
if ("".equals(cost)) { if (cost != null && cost.isEmpty()) {
cost = null; cost = null;
} }
if (cost != null) { if (cost != null) {

View file

@ -135,12 +135,12 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (!"".equals(duration.toString())) { if (duration.toString() != null && !duration.toString().isEmpty()) {
sb.append(duration.toString()).append(", "); sb.append(duration.toString()).append(", ");
} }
sb.append("all "); sb.append("all ");
sb.append(filter.getMessage()); sb.append(filter.getMessage());
if ("".equals(duration.toString())) { if (duration.toString() != null && duration.toString().isEmpty()) {
sb.append(" are "); sb.append(" are ");
} else { } else {
sb.append(" become "); sb.append(" become ");

View file

@ -120,7 +120,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
} }
} }
} }
if ("".equals(type) || type == null && permanent.getCardType().contains(CardType.LAND)) { if (type != null && type.isEmpty() || type == null && permanent.getCardType().contains(CardType.LAND)) {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
} }
if (!token.getSubtype(game).isEmpty()) { if (!token.getSubtype(game).isEmpty()) {