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

@ -795,7 +795,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
try {
LOGGER.debug("connecting (auto): " + currentConnection.getProxyType().toString()
+ " " + currentConnection.getProxyHost() + " " + currentConnection.getProxyPort() + " " + currentConnection.getProxyUsername());
+ ' ' + currentConnection.getProxyHost() + ' ' + currentConnection.getProxyPort() + ' ' + currentConnection.getProxyUsername());
if (MageFrame.connect(currentConnection)) {
showGames(false);
return true;
@ -1334,7 +1334,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
hideTables();
SessionHandler.disconnect(false);
if (errorCall) {
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + currentConnection.getHost() + "?");
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + currentConnection.getHost() + '?');
message.setButton1("No", null);
message.setButton2("Yes", PlayerAction.CLIENT_RECONNECT);
showUserRequestDialog(message);

View file

@ -141,7 +141,7 @@ public class BigCard extends JComponent {
try {
for (String line : strings) {
doc.insertString(doc.getLength(), line + "\n", doc.getStyle("regular"));
doc.insertString(doc.getLength(), line + '\n', doc.getStyle("regular"));
}
} catch (BadLocationException ble) {
}

View file

@ -192,7 +192,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE));
gImage.drawString(card.getName()+"TEST", CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET);
if (card.getCardTypes().contains(CardType.CREATURE)) {
gImage.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
gImage.drawString(card.getPower() + '/' + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
}
@ -228,27 +228,27 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
StringBuilder sb = new StringBuilder();
if (card instanceof StackAbilityView || card instanceof AbilityView) {
for (String rule : 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());
}
for (String rule : 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(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - ");
sb.append(card.getRarity().toString());
}
@ -277,7 +277,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
try {
for (String rule : getRules()) {
doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
doc.insertString(doc.getLength(), rule + '\n', doc.getStyle("small"));
}
} catch (BadLocationException e) {
}
@ -301,17 +301,17 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
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(' ');
}
}

View file

@ -708,7 +708,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
@Override
public String toString() {
return "(" + sort.toString() + "," + Boolean.toString(separateCreatures) + "," + Integer.toString(cardSize) + ")";
return '(' + sort.toString() + ',' + Boolean.toString(separateCreatures) + ',' + Integer.toString(cardSize) + ')';
}
}
@ -1327,7 +1327,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
if (!s) {
String t = "";
for (CardType type : card.getCardTypes()) {
t += " " + type.toString();
t += ' ' + type.toString();
}
s |= t.toLowerCase().contains(searchStr);
}
@ -1385,14 +1385,14 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
// Type line
String t = "";
for (CardType type : card.getCardTypes()) {
t += " " + type.toString();
t += ' ' + type.toString();
}
// Sub & Super Types
for (String str : card.getSuperTypes()) {
t += " " + str.toLowerCase();
t += ' ' + str.toLowerCase();
}
for (String str : card.getSubTypes()) {
t += " " + str.toLowerCase();
t += ' ' + str.toLowerCase();
}
for (String qty : qtys.keySet()) {

View file

@ -107,24 +107,24 @@ public class Permanent extends Card {
sb.append("\n----- Originally -------\n");
sb.append(permanent.getOriginal().getName());
if (permanent.getOriginal().getManaCost().size() > 0) {
sb.append("\n").append(permanent.getOriginal().getManaCost());
sb.append('\n').append(permanent.getOriginal().getManaCost());
}
sb.append("\n").append(getType(permanent.getOriginal()));
sb.append('\n').append(getType(permanent.getOriginal()));
if (permanent.getOriginal().getColor().hasColor()) {
sb.append("\n").append(permanent.getOriginal().getColor().toString());
sb.append('\n').append(permanent.getOriginal().getColor().toString());
}
if (permanent.getOriginal().getCardTypes().contains(CardType.CREATURE)) {
sb.append("\n").append(permanent.getOriginal().getPower()).append("/").append(permanent.getOriginal().getToughness());
sb.append('\n').append(permanent.getOriginal().getPower()).append('/').append(permanent.getOriginal().getToughness());
}
else if (permanent.getOriginal().getCardTypes().contains(CardType.PLANESWALKER)) {
sb.append("\n").append(permanent.getOriginal().getLoyalty());
sb.append('\n').append(permanent.getOriginal().getLoyalty());
}
for (String rule: getRules()) {
sb.append("\n").append(rule);
sb.append('\n').append(rule);
}
if (permanent.getOriginal().getExpansionSetCode().length() > 0) {
sb.append("\n").append(permanent.getCardNumber()).append(" - ");
sb.append("\n").append(Sets.getInstance().get(permanent.getOriginal().getExpansionSetCode()).getName()).append(" - ");
sb.append('\n').append(permanent.getCardNumber()).append(" - ");
sb.append('\n').append(Sets.getInstance().get(permanent.getOriginal().getExpansionSetCode()).getName()).append(" - ");
sb.append(permanent.getOriginal().getRarity().toString());
}
// sb.append("\n").append(card.getId());

View file

@ -802,6 +802,6 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
return getClass().getName()
+ "[axis=" + axis
+ ",gap=" + gap
+ "]";
+ ']';
}
}

View file

@ -168,7 +168,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
private static JLabel createChangingPercentageLabel(final JSlider slider) {
final JLabel label = new JLabel(" " + String.valueOf(slider.getValue()) + "%");
final JLabel label = new JLabel(" " + String.valueOf(slider.getValue()) + '%');
slider.addChangeListener(e -> {
String value = String.valueOf(slider.getValue());
@ -178,7 +178,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
labelBuilder.append(" ");
}
labelBuilder.append(value);
labelBuilder.append("%");
labelBuilder.append('%');
label.setText(labelBuilder.toString());
});
return label;

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();

View file

@ -134,7 +134,7 @@ public class CardInfoWindowDialog extends MageDialog {
public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
boolean changed = cards.loadCards(exile, bigCard, gameId, true);
String titel = name + " (" + exile.size() + ")";
String titel = name + " (" + exile.size() + ')';
setTitle(titel);
this.setTitelBarToolTip(titel);
if (exile.size() > 0) {

View file

@ -398,7 +398,7 @@ public class ConnectDialog extends MageDialog {
// pref settings
MageFrame.getInstance().setUserPrefsToConnection(connection);
logger.debug("connecting: " + connection.getProxyType() + " " + connection.getProxyHost() + " " + connection.getProxyPort());
logger.debug("connecting: " + connection.getProxyType() + ' ' + connection.getProxyHost() + ' ' + connection.getProxyPort());
task = new ConnectTask();
task.execute();
} finally {

View file

@ -100,7 +100,7 @@ public class GameEndDialog extends MageDialog {
StringBuilder sb = new StringBuilder();
for (PlayerView player : gameEndView.getPlayers()) {
sb.append(player.getName()).append(" Life: ").append(player.getLife()).append(" ");
sb.append(player.getName()).append(" Life: ").append(player.getLife()).append(' ');
}
this.txtLife.setText(sb.toString());
@ -128,8 +128,8 @@ public class GameEndDialog extends MageDialog {
sdf.applyPattern( "yyyyMMdd_HHmmss" );
String fileName = new StringBuilder(dir).append(File.separator)
.append(sdf.format(gameEndView.getStartTime()))
.append("_").append(gameEndView.getMatchView().getGameType())
.append("_").append(gameEndView.getMatchView().getGames().size())
.append('_').append(gameEndView.getMatchView().getGameType())
.append('_').append(gameEndView.getMatchView().getGames().size())
.append(".txt").toString();
PrintWriter out = new PrintWriter(fileName);
out.print(gamePanel.getGameLog());

View file

@ -673,7 +673,7 @@ public class NewTableDialog extends MageDialog {
StringBuilder playerTypesString = new StringBuilder();
for (Object player : players) {
if (playerTypesString.length() > 0) {
playerTypesString.append(",");
playerTypesString.append(',');
}
TablePlayerPanel tpp = (TablePlayerPanel) player;
playerTypesString.append(tpp.getPlayerType());

View file

@ -836,7 +836,7 @@ public class NewTournamentDialog extends MageDialog {
StringBuilder packList = new StringBuilder();
for (ExpansionInfo exp : allExpansions) {
packList.append(exp.getCode());
packList.append(";");
packList.append(';');
}
txtRandomPacks.setText(packList.toString());
}
@ -860,7 +860,7 @@ public class NewTournamentDialog extends MageDialog {
StringBuilder packList = new StringBuilder();
for (String str : randomPackSelector.getSelectedPacks()) {
packList.append(str);
packList.append(";");
packList.append(';');
}
this.txtRandomPacks.setText(packList.toString());
this.pack();
@ -1088,7 +1088,7 @@ public class NewTournamentDialog extends MageDialog {
StringBuilder packlist = new StringBuilder();
for (String pack : this.randomPackSelector.getSelectedPacks()){
packlist.append(pack);
packlist.append(";");
packlist.append(';');
}
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, packlist.toString());
}

View file

@ -188,7 +188,7 @@ public class DraftPanel extends javax.swing.JPanel {
// If we are logging the draft create a file that will contain
// the log.
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
logFilename = "Draft_" + sdf.format(new Date()) + "_" + draftId + ".txt";
logFilename = "Draft_" + sdf.format(new Date()) + '_' + draftId + ".txt";
try {
Files.write(pathToDraftLog(), "".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException ex) {
@ -366,12 +366,12 @@ public class DraftPanel 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);
}

View file

@ -406,7 +406,7 @@ public final class GamePanel extends javax.swing.JPanel {
private void saveDividerLocations() {
// save panel sizes and divider locations.
Rectangle rec = MageFrame.getDesktop().getBounds();
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_0, Integer.toString(this.jSplitPane0.getDividerLocation()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
@ -417,7 +417,7 @@ public final class GamePanel extends javax.swing.JPanel {
Rectangle rec = MageFrame.getDesktop().getBounds();
if (rec != null) {
String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null);
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
// use divider positions only if screen size is the same as it was the time the settings were saved
if (size != null && size.equals(sb)) {
@ -764,7 +764,7 @@ public final class GamePanel extends javax.swing.JPanel {
}
if (game.getSpellsCastCurrentTurn() > 0 && PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_SHOW_STORM_COUNTER, "true").equals("true")) {
this.txtSpellsCast.setVisible(true);
this.txtSpellsCast.setText(" " + Integer.toString(game.getSpellsCastCurrentTurn()) + " ");
this.txtSpellsCast.setText(' ' + Integer.toString(game.getSpellsCastCurrentTurn()) + ' ');
} else {
this.txtSpellsCast.setVisible(false);
}
@ -1279,7 +1279,7 @@ public final class GamePanel extends javax.swing.JPanel {
pickChoice.showDialog(choice, objectId, choiceWindowState);
if (choice.isKeyChoice()) {
if (pickChoice.isAutoSelect()) {
SessionHandler.sendPlayerString(gameId, "#" + choice.getChoiceKey());
SessionHandler.sendPlayerString(gameId, '#' + choice.getChoiceKey());
} else {
SessionHandler.sendPlayerString(gameId, choice.getChoiceKey());
}

View file

@ -377,11 +377,11 @@ public class HelperPanel extends JPanel {
public void handleAutoAnswerPopupMenuEvent(ActionEvent e) {
switch (e.getActionCommand()) {
case CMD_AUTO_ANSWER_ID_YES:
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_YES, gameId, originalId.toString() + "#" + message);
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_YES, gameId, originalId.toString() + '#' + message);
clickButton(btnLeft);
break;
case CMD_AUTO_ANSWER_ID_NO:
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_NO, gameId, originalId.toString() + "#" + message);
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_NO, gameId, originalId.toString() + '#' + message);
clickButton(btnRight);
break;
case CMD_AUTO_ANSWER_NAME_YES:

View file

@ -360,7 +360,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
int h = priorityTimeLeft / 3600;
int m = (priorityTimeLeft % 3600) / 60;
int s = priorityTimeLeft % 60;
return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s;
return (h < 10 ? "0" : "") + h + ':' + (m < 10 ? "0" : "") + m + ':' + (s < 10 ? "0" : "") + s;
}
protected void update(ManaPoolView pool) {

View file

@ -43,7 +43,7 @@ public class MagePreferences {
}
private static String prefixedKey(String prefix, String key) {
return prefix + "/" + key;
return prefix + '/' + key;
}
public static String getUserName(String serverAddress) {

View file

@ -161,11 +161,11 @@ public class PlayersChatPanel extends javax.swing.JPanel {
JTableHeader th = jTablePlayers.getTableHeader();
TableColumnModel tcm = th.getColumnModel();
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ')');
tcm.getColumn(jTablePlayers.convertColumnIndexToView(8)).setHeaderValue(
"Games " + roomUserInfo.getNumberActiveGames()
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
+ " limit: " + roomUserInfo.getNumberMaxGames() + ')');
th.repaint();
this.fireTableDataChanged();
}

View file

@ -187,7 +187,7 @@ public class TablesPanel extends javax.swing.JPanel {
String pwdColumn = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_PASSWORD);
switch (action) {
case "Join":
if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + ",")) {
if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + ',')) {
try {
JDesktopPane desktopPane = (JDesktopPane) MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
@ -350,7 +350,7 @@ public class TablesPanel extends javax.swing.JPanel {
private void saveDividerLocations() {
// save panel sizes and divider locations.
Rectangle rec = MageFrame.getDesktop().getBounds();
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPaneTables.getDividerLocation()));
@ -387,7 +387,7 @@ public class TablesPanel extends javax.swing.JPanel {
Rectangle rec = MageFrame.getDesktop().getBounds();
if (rec != null) {
String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null);
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
// use divider positions only if screen size is the same as it was the time the settings were saved
if (size != null && size.equals(sb)) {
String location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, null);

View file

@ -174,7 +174,7 @@ public class TournamentPanel extends javax.swing.JPanel {
private void saveDividerLocations() {
// save panel sizes and divider locations.
Rectangle rec = MageFrame.getDesktop().getBounds();
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
PreferencesDialog.saveValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPane2.getDividerLocation()));
@ -184,7 +184,7 @@ public class TournamentPanel extends javax.swing.JPanel {
Rectangle rec = MageFrame.getDesktop().getBounds();
if (rec != null) {
String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null);
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
// use divider positions only if screen size is the same as it was the time the settings were saved
if (size != null && size.equals(sb)) {
String location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_1, null);
@ -244,7 +244,7 @@ public class TournamentPanel extends javax.swing.JPanel {
c = c.getParent();
}
if (c != null) {
((TournamentPane) c).setTitle("Tournament [" + tournament.getTournamentName() + "]");
((TournamentPane) c).setTitle("Tournament [" + tournament.getTournamentName() + ']');
}
txtName.setText(tournament.getTournamentName());
txtType.setText(tournament.getTournamentType());
@ -260,7 +260,7 @@ public class TournamentPanel extends javax.swing.JPanel {
if (tournament.getStepStartTime() != null) {
timeLeft = Format.getDuration(tournament.getConstructionTime() - (tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime()) / 1000);
}
txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(timeLeft).append(")").toString());
txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(timeLeft).append(')').toString());
break;
case "Dueling":
case "Drafting":

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();
}