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:
vraskulin 2017-01-27 15:57:10 +03:00
parent 31589778ca
commit f60ebfbb1f
451 changed files with 989 additions and 978 deletions

View file

@ -97,7 +97,7 @@ public class DeckArea extends javax.swing.JPanel {
@Override
public String toString() {
return maindeckSettings.toString() + "|" + sideboardSetings.toString() + "|" + dividerLocationNormal + "|" + dividerLocationLimited;
return maindeckSettings.toString() + '|' + sideboardSetings.toString() + '|' + dividerLocationNormal + '|' + dividerLocationLimited;
}
}

View file

@ -584,12 +584,12 @@ public class DeckEditorPanel extends javax.swing.JPanel {
int second = s - (minute * 60);
String text;
if (minute < 10) {
text = "0" + Integer.toString(minute) + ":";
text = '0' + Integer.toString(minute) + ':';
} else {
text = Integer.toString(minute) + ":";
text = Integer.toString(minute) + ':';
}
if (second < 10) {
text = text + "0" + Integer.toString(second);
text = text + '0' + Integer.toString(second);
} else {
text = text + Integer.toString(second);
}
@ -599,7 +599,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
}
if (timeToSubmit > 0) {
timeToSubmit--;
btnSubmitTimer.setText("Submit (" + timeToSubmit + ")");
btnSubmitTimer.setText("Submit (" + timeToSubmit + ')');
btnSubmitTimer.setToolTipText("Submit your deck in " + timeToSubmit + " seconds!");
}
}

View file

@ -56,17 +56,17 @@ public class CardHelper {
StringBuilder type = new StringBuilder();
for (String superType : c.getSuperTypes()) {
type.append(superType);
type.append(" ");
type.append(' ');
}
for (CardType cardType : c.getCardTypes()) {
type.append(cardType.toString());
type.append(" ");
type.append(' ');
}
if (c.getSubTypes().size() > 0) {
type.append("- ");
for (String subType : c.getSubTypes()) {
type.append(subType);
type.append(" ");
type.append(' ');
}
}
return type.toString();

View file

@ -86,10 +86,10 @@ public class MageCardComparator implements Comparator<CardView> {
aCom = (float) -1;
bCom = (float) -1;
if (CardHelper.isCreature(a)) {
aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
aCom = new Float(a.getPower() + '.' + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
}
if (CardHelper.isCreature(b)) {
bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
bCom = new Float(b.getPower() + '.' + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
}
break;
// Rarity

View file

@ -264,7 +264,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
case 4:
return CardHelper.getType(c);
case 5:
return CardHelper.isCreature(c) ? c.getPower() + "/"
return CardHelper.isCreature(c) ? c.getPower() + '/'
+ c.getToughness() : "-";
case 6:
return c.getRarity().toString();