forked from External/mage
All 1-character strings converted to primitives
"b" + "r" now changed to 'b' + 'w'. It's more straight-forward, and may cause perfomance improvements - character primitives allocation is faster and less expensive than string creation.
This commit is contained in:
parent
31589778ca
commit
f60ebfbb1f
451 changed files with 989 additions and 978 deletions
|
|
@ -681,17 +681,17 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
StringBuilder sbType = new StringBuilder();
|
||||
|
||||
for (String superType : card.getSuperTypes()) {
|
||||
sbType.append(superType).append(" ");
|
||||
sbType.append(superType).append(' ');
|
||||
}
|
||||
|
||||
for (CardType cardType : card.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(" ");
|
||||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
sbType.append("- ");
|
||||
for (String subType : card.getSubTypes()) {
|
||||
sbType.append(subType).append(" ");
|
||||
sbType.append(subType).append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -702,30 +702,30 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
StringBuilder sb = new StringBuilder();
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
for (String rule : card.getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
} else {
|
||||
sb.append(card.getName());
|
||||
if (card.getManaCost().size() > 0) {
|
||||
sb.append("\n").append(card.getManaCost());
|
||||
sb.append('\n').append(card.getManaCost());
|
||||
}
|
||||
sb.append("\n").append(cardType);
|
||||
sb.append('\n').append(cardType);
|
||||
if (card.getColor().hasColor()) {
|
||||
sb.append("\n").append(card.getColor().toString());
|
||||
sb.append('\n').append(card.getColor().toString());
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
sb.append("\n").append(card.getPower()).append("/").append(card.getToughness());
|
||||
sb.append('\n').append(card.getPower()).append('/').append(card.getToughness());
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
sb.append("\n").append(card.getLoyalty());
|
||||
sb.append('\n').append(card.getLoyalty());
|
||||
}
|
||||
if (card.getRules() == null) {
|
||||
card.overrideRules(new ArrayList<>());
|
||||
}
|
||||
for (String rule : card.getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) {
|
||||
sb.append("\n").append(card.getCardNumber()).append(" - ");
|
||||
sb.append('\n').append(card.getCardNumber()).append(" - ");
|
||||
sb.append(card.getExpansionSetCode()).append(" - ");
|
||||
sb.append(card.getRarity().toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
// PT Text
|
||||
ptText = new GlowText();
|
||||
if (CardUtil.isCreature(gameCard)) {
|
||||
ptText.setText(gameCard.getPower() + "/" + gameCard.getToughness());
|
||||
ptText.setText(gameCard.getPower() + '/' + gameCard.getToughness());
|
||||
} else if (CardUtil.isPlaneswalker(gameCard)) {
|
||||
ptText.setText(gameCard.getLoyalty());
|
||||
}
|
||||
|
|
@ -580,9 +580,9 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
|
||||
// Update card text
|
||||
if (CardUtil.isCreature(card) && CardUtil.isPlaneswalker(card)) {
|
||||
ptText.setText(card.getPower() + "/" + card.getToughness() + " (" + card.getLoyalty() + ")");
|
||||
ptText.setText(card.getPower() + '/' + card.getToughness() + " (" + card.getLoyalty() + ')');
|
||||
} else if (CardUtil.isCreature(card)) {
|
||||
ptText.setText(card.getPower() + "/" + card.getToughness());
|
||||
ptText.setText(card.getPower() + '/' + card.getToughness());
|
||||
} else if (CardUtil.isPlaneswalker(card)) {
|
||||
ptText.setText(card.getLoyalty());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -380,15 +380,15 @@ public abstract class CardRenderer {
|
|||
} else {
|
||||
StringBuilder sbType = new StringBuilder();
|
||||
for (String superType : cardView.getSuperTypes()) {
|
||||
sbType.append(superType).append(" ");
|
||||
sbType.append(superType).append(' ');
|
||||
}
|
||||
for (CardType cardType : cardView.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(" ");
|
||||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
if (cardView.getSubTypes().size() > 0) {
|
||||
sbType.append("- ");
|
||||
for (String subType : cardView.getSubTypes()) {
|
||||
sbType.append(subType).append(" ");
|
||||
sbType.append(subType).append(' ');
|
||||
}
|
||||
}
|
||||
return sbType.toString();
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class ManaSymbols {
|
|||
setImages.put(set, rarityImages);
|
||||
|
||||
for (String rarityCode : codes) {
|
||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + "-" + rarityCode + ".jpg");
|
||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + '-' + rarityCode + ".jpg");
|
||||
try {
|
||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
||||
int width = image.getWidth(null);
|
||||
|
|
@ -114,11 +114,11 @@ public class ManaSymbols {
|
|||
}
|
||||
|
||||
for (String code : codes) {
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + set + "-" + code + ".png");
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + set + '-' + code + ".png");
|
||||
if (file.exists()) {
|
||||
continue;
|
||||
}
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + "-" + code + ".jpg");
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + '-' + code + ".jpg");
|
||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
||||
try {
|
||||
int width = image.getWidth(null);
|
||||
|
|
@ -130,7 +130,7 @@ public class ManaSymbols {
|
|||
}
|
||||
Rectangle r = new Rectangle(15 + dx, (int) (height * (15.0f + dx) / width));
|
||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
File newFile = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + File.separator + set + "-" + code + ".png");
|
||||
File newFile = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + File.separator + set + '-' + code + ".png");
|
||||
ImageIO.write(resized, "png", newFile);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -171,7 +171,7 @@ public class ManaSymbols {
|
|||
resourcePath = Constants.RESOURCE_PATH_MANA_MEDIUM;
|
||||
}
|
||||
for (String symbol : symbols) {
|
||||
File file = new File(getSymbolsPath() + resourcePath + "/" + symbol + ".gif");
|
||||
File file = new File(getSymbolsPath() + resourcePath + '/' + symbol + ".gif");
|
||||
try {
|
||||
|
||||
if (size == 15 || size == 25) {
|
||||
|
|
@ -315,7 +315,7 @@ public class ManaSymbols {
|
|||
if (symbolFilesFound) {
|
||||
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll(
|
||||
"<img src='file:" + getSymbolsPath(true) + "/symbols/" + resourcePath + "/$1$2.gif' alt='$1$2' width=" + symbolSize
|
||||
+ " height=" + symbolSize + ">");
|
||||
+ " height=" + symbolSize + '>');
|
||||
}
|
||||
replaced = replaced.replace("|source|", "{source}");
|
||||
replaced = replaced.replace("|this|", "{this}");
|
||||
|
|
@ -328,7 +328,7 @@ public class ManaSymbols {
|
|||
int factor = size / 15 + 1;
|
||||
Integer width = setImagesExist.get(_set).width * factor;
|
||||
Integer height = setImagesExist.get(_set).height * factor;
|
||||
return "<img src='file:" + getSymbolsPath() + "/sets/small/" + _set + "-" + rarity + ".png' alt='" + rarity + "' height='" + height + "' width='" + width + "' >";
|
||||
return "<img src='file:" + getSymbolsPath() + "/sets/small/" + _set + '-' + rarity + ".png' alt='" + rarity + "' height='" + height + "' width='" + width + "' >";
|
||||
} else {
|
||||
return set;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -638,7 +638,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
}
|
||||
g.setColor(textColor);
|
||||
g.setFont(ptTextFont);
|
||||
String ptText = cardView.getPower() + "/" + cardView.getToughness();
|
||||
String ptText = cardView.getPower() + '/' + cardView.getToughness();
|
||||
int ptTextWidth = g.getFontMetrics().stringWidth(ptText);
|
||||
g.drawString(ptText,
|
||||
x + (partWidth - ptTextWidth) / 2, curY - ptTextOffset - 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue