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

@ -59,7 +59,7 @@ public class CardsViewUtil {
CardsView cards = new CardsView();
for (SimpleCardView simple: view.values()) {
String key = simple.getExpansionSetCode() + "_" + simple.getCardNumber();
String key = simple.getExpansionSetCode() + '_' + simple.getCardNumber();
Card card = loadedCards.get(key);
if(card == null)
{

View file

@ -62,13 +62,13 @@ public class Format {
seconds = seconds % 3600;
long m = seconds / 60;
long s = seconds % 60;
sb.append(h).append(":");
sb.append(h).append(':');
if (m<10) {
sb.append("0");
sb.append('0');
}
sb.append(m).append(":");
sb.append(m).append(':');
if (s<10) {
sb.append("0");
sb.append('0');
}
sb.append(s);
return sb.toString();

View file

@ -112,7 +112,7 @@ public class MusicPlayer {
volume = (FloatControl) sourceDataLine.getControl(FloatControl.Type.MASTER_GAIN);
sourceDataLine.start();
} catch (Exception e) {
log.error("Couldn't load file: " + file + " " + e);
log.error("Couldn't load file: " + file + ' ' + e);
}
}

View file

@ -222,7 +222,7 @@ public class GuiDisplayUtil {
buffer.append("<tr><td valign='top'><b>");
buffer.append(card.getDisplayName());
if (card.isGameObject()) {
buffer.append(" [").append(card.getId().toString().substring(0, 3)).append("]");
buffer.append(" [").append(card.getId().toString().substring(0, 3)).append(']');
}
buffer.append("</b></td><td align='right' valign='top' style='width:");
buffer.append(symbolCount * GUISizeHelper.cardTooltipFontSize);
@ -232,7 +232,7 @@ public class GuiDisplayUtil {
}
buffer.append("</td></tr></table>");
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%'><tr><td style='margin-left: 1px'>");
String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + ">";
String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + '>';
if (card.getColor().isWhite()) {
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W' ").append(imageSize);
}
@ -281,7 +281,7 @@ public class GuiDisplayUtil {
String pt = "";
if (CardUtil.isCreature(card)) {
pt = card.getPower() + "/" + card.getToughness();
pt = card.getPower() + '/' + card.getToughness();
} else if (CardUtil.isPlaneswalker(card)) {
pt = card.getLoyalty();
}
@ -291,7 +291,7 @@ public class GuiDisplayUtil {
buffer.append("<td align='right'>");
if (!card.isControlledByOwner()) {
if (card instanceof PermanentView) {
buffer.append("[").append(((PermanentView) card).getNameOwner()).append("] ");
buffer.append('[').append(((PermanentView) card).getNameOwner()).append("] ");
} else {
buffer.append("[only controlled] ");
}
@ -361,16 +361,16 @@ public class GuiDisplayUtil {
private static String getTypes(CardView card) {
String types = "";
for (String superType : card.getSuperTypes()) {
types += superType + " ";
types += superType + ' ';
}
for (CardType cardType : card.getCardTypes()) {
types += cardType.toString() + " ";
types += cardType.toString() + ' ';
}
if (card.getSubTypes().size() > 0) {
types += "- ";
}
for (String subType : card.getSubTypes()) {
types += subType + " ";
types += subType + ' ';
}
return types.trim();
}

View file

@ -59,8 +59,8 @@ public class TableUtil {
for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
TableColumn column = table.getColumnModel().getColumn(table.convertColumnIndexToView(i));
if (!firstValue) {
columnWidthSettings.append(",");
columnOrderSettings.append(",");
columnWidthSettings.append(',');
columnOrderSettings.append(',');
} else {
firstValue = false;
}

View file

@ -65,7 +65,7 @@ public class MyComboBoxEditor extends BasicComboBoxEditor {
@Override
public Object getItem() {
return "[" + this.selectedItem.toString() + "]";
return '[' + this.selectedItem.toString() + ']';
}
@Override

View file

@ -53,7 +53,7 @@ public class SaveObjectUtil {
}
}
String time = now(DATE_PATTERN);
File f = new File("income" + File.separator + name + "_" + time + ".save");
File f = new File("income" + File.separator + name + '_' + time + ".save");
if (!f.exists()) {
f.createNewFile();
}