mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 11:31:33 +01:00
Java language level migrations
This commit is contained in:
parent
16b57176b6
commit
c4575a67d9
|
@ -138,7 +138,7 @@ public class AppletGUI extends javax.swing.JApplet implements GUIInterface {
|
|||
|
||||
NewGame.setText("New Game");
|
||||
NewGame.setFocusable(false);
|
||||
NewGame.addActionListener(evt -> NewGameActionPerformed(evt));
|
||||
NewGame.addActionListener(this::NewGameActionPerformed);
|
||||
|
||||
SettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Settings"));
|
||||
SettingsPanel.setFocusable(false);
|
||||
|
@ -161,15 +161,15 @@ public class AppletGUI extends javax.swing.JApplet implements GUIInterface {
|
|||
TimeSlider.setPaintTicks(true);
|
||||
TimeSlider.setValue(5);
|
||||
TimeSlider.setFocusable(false);
|
||||
TimeSlider.addChangeListener(evt -> TimeSliderStateChanged(evt));
|
||||
TimeSlider.addChangeListener(this::TimeSliderStateChanged);
|
||||
|
||||
ShowThinking.setText("Show Thinking");
|
||||
ShowThinking.setFocusable(false);
|
||||
ShowThinking.addChangeListener(evt -> ShowThinkingStateChanged(evt));
|
||||
ShowThinking.addChangeListener(this::ShowThinkingStateChanged);
|
||||
|
||||
FlipBoard.setText("Flip Board");
|
||||
FlipBoard.setFocusable(false);
|
||||
FlipBoard.addChangeListener(evt -> FlipBoardStateChanged(evt));
|
||||
FlipBoard.addChangeListener(this::FlipBoardStateChanged);
|
||||
|
||||
javax.swing.GroupLayout SettingsPanelLayout = new javax.swing.GroupLayout(SettingsPanel);
|
||||
SettingsPanel.setLayout(SettingsPanelLayout);
|
||||
|
@ -215,13 +215,13 @@ public class AppletGUI extends javax.swing.JApplet implements GUIInterface {
|
|||
Forward.setDefaultCapable(false);
|
||||
Forward.setFocusPainted(false);
|
||||
Forward.setFocusable(false);
|
||||
Forward.addActionListener(evt -> ForwardActionPerformed(evt));
|
||||
Forward.addActionListener(this::ForwardActionPerformed);
|
||||
|
||||
Backward.setText("<-");
|
||||
Backward.setDefaultCapable(false);
|
||||
Backward.setFocusPainted(false);
|
||||
Backward.setFocusable(false);
|
||||
Backward.addActionListener(evt -> BackwardActionPerformed(evt));
|
||||
Backward.addActionListener(this::BackwardActionPerformed);
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
|
|
|
@ -179,9 +179,7 @@ public class ChessBoardPainter extends JLabel {
|
|||
try {
|
||||
Font font = Font.createFont(Font.TRUETYPE_FONT, inStream);
|
||||
chessFont = font.deriveFont((float)sqSize);
|
||||
} catch (FontFormatException ex) {
|
||||
throw new RuntimeException();
|
||||
} catch (IOException ex) {
|
||||
} catch (FontFormatException | IOException ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,12 +147,9 @@ public class TUIGame extends Game {
|
|||
return false;
|
||||
} catch (IOException ex) {
|
||||
System.out.printf("IO error: %s\n", ex.getMessage());
|
||||
} catch (ChessParseError cpe) {
|
||||
} catch (ChessParseError | StringIndexOutOfBoundsException cpe) {
|
||||
int lineNo = (fr == null) ? -1 : fr.getLineNumber();
|
||||
System.out.printf("Parse error, line %d: %s\n", lineNo, cpe.getMessage());
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
int lineNo = (fr == null) ? -1 : fr.getLineNumber();
|
||||
System.out.printf("Parse error, line %d: %s\n", lineNo, e.getMessage());
|
||||
} finally {
|
||||
if (fr != null) {
|
||||
try {
|
||||
|
|
|
@ -199,9 +199,7 @@ public class UCIProtocol {
|
|||
}
|
||||
quit = true;
|
||||
}
|
||||
} catch (ChessParseError ignore) {
|
||||
} catch (ArrayIndexOutOfBoundsException ignore) {
|
||||
} catch (NumberFormatException ignore) {
|
||||
} catch (ChessParseError | ArrayIndexOutOfBoundsException | NumberFormatException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class GameAdapter<T> extends BaseAdapter implements Filterable {
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
values = results == null ? new ArrayList<T>() : (ArrayList<T>) results.values;
|
||||
values = results == null ? new ArrayList<>() : (ArrayList<T>) results.values;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,9 +93,7 @@ public class LoadFEN extends ListActivity {
|
|||
workThread = new Thread(() -> {
|
||||
if (!readFile())
|
||||
return;
|
||||
runOnUiThread(() -> {
|
||||
lfen.showList();
|
||||
});
|
||||
runOnUiThread(lfen::showList);
|
||||
});
|
||||
workThread.start();
|
||||
} else if ("org.petero.droidfish.loadNextFen".equals(action) ||
|
||||
|
|
|
@ -41,7 +41,7 @@ final class InternalBook implements IOpeningBook {
|
|||
private boolean enabled = false;
|
||||
|
||||
InternalBook() {
|
||||
Thread t = new Thread(() -> initInternalBook());
|
||||
Thread t = new Thread(this::initInternalBook);
|
||||
t.setPriority(Thread.MIN_PRIORITY);
|
||||
t.start();
|
||||
}
|
||||
|
|
|
@ -1000,7 +1000,7 @@ public class DroidComputerPlayer {
|
|||
}
|
||||
if (havePvData) {
|
||||
while (statPvInfo.size() < pvNum)
|
||||
statPvInfo.add(new PvInfo(0, 0, 0, 0, 0, 0, 0, 0, false, false, false, new ArrayList<Move>()));
|
||||
statPvInfo.add(new PvInfo(0, 0, 0, 0, 0, 0, 0, 0, false, false, false, new ArrayList<>()));
|
||||
if (statPvInfo.size() == pvNum)
|
||||
statPvInfo.add(null);
|
||||
ArrayList<Move> moves = new ArrayList<>();
|
||||
|
|
|
@ -62,8 +62,7 @@ public class EngineServer implements ErrorHandler {
|
|||
String arguments = prop.getProperty("arguments" + i, "");
|
||||
configs[i] = new EngineConfig(enabled, port, filename, arguments);
|
||||
}
|
||||
} catch (IOException ignore) {
|
||||
} catch (NumberFormatException ignore) {
|
||||
} catch (IOException | NumberFormatException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user