move CardHelper::getColor to CardView::getColorText

This commit is contained in:
ingmargoudt 2017-04-06 22:11:57 +02:00
parent 63df7f65a7
commit d60e01d497
4 changed files with 15 additions and 15 deletions

View file

@ -42,17 +42,6 @@ public final class CardHelper {
private CardHelper() {
}
public static String getColor(CardView c) {
if (c.getColor().getColorCount() == 0) return "Colorless";
else if (c.getColor().getColorCount() > 1) return "Gold";
else if (c.getColor().isBlack()) return "Black";
else if (c.getColor().isBlue()) return "Blue";
else if (c.getColor().isWhite()) return "White";
else if (c.getColor().isGreen()) return "Green";
else if (c.getColor().isRed()) return "Red";
return "";
}
public static String getType(CardView c) {
StringBuilder type = new StringBuilder();
for (SuperType superType : c.getSuperTypes()) {

View file

@ -74,8 +74,8 @@ public class MageCardComparator implements Comparator<CardView> {
break;
// Color
case 3:
aCom = CardHelper.getColor(a);
bCom = CardHelper.getColor(b);
aCom = a.getColorText();
bCom = a.getColorText();
break;
// Type
case 4:

View file

@ -252,7 +252,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TABLE);
return "<html>" + castingCost + "</html>";
case 3:
return CardHelper.getColor(c);
return c.getColorText();
case 4:
return CardHelper.getType(c);
case 5:

View file

@ -961,4 +961,15 @@ public class CardView extends SimpleCardView {
return cardTypes.contains(CardType.CREATURE);
}
public String getColorText() {
if (getColor().getColorCount() == 0) return "Colorless";
else if (getColor().getColorCount() > 1) return "Gold";
else if (getColor().isBlack()) return "Black";
else if (getColor().isBlue()) return "Blue";
else if (getColor().isWhite()) return "White";
else if (getColor().isGreen()) return "Green";
else if (getColor().isRed()) return "Red";
return "";
}
}