mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 11:31:33 +01:00
Don't create unnecessary objects
This commit is contained in:
parent
74c832ebbc
commit
d0b6fd9e4c
|
@ -55,9 +55,9 @@ public class EngineServer implements ErrorHandler {
|
||||||
InputStream is = new FileInputStream(getConfigFile());
|
InputStream is = new FileInputStream(getConfigFile());
|
||||||
prop.load(is);
|
prop.load(is);
|
||||||
for (int i = 0; i < configs.length; i++) {
|
for (int i = 0; i < configs.length; i++) {
|
||||||
boolean enabled = Boolean.valueOf(prop.getProperty("enabled" + i, "false"));
|
boolean enabled = Boolean.parseBoolean(prop.getProperty("enabled" + i, "false"));
|
||||||
String defPort = Integer.toString(4567 + i);
|
String defPort = Integer.toString(4567 + i);
|
||||||
int port = Integer.valueOf(prop.getProperty("port" + i, defPort));
|
int port = Integer.parseInt(prop.getProperty("port" + i, defPort));
|
||||||
String filename = prop.getProperty("filename" + i, "");
|
String filename = prop.getProperty("filename" + i, "");
|
||||||
String arguments = prop.getProperty("arguments" + i, "");
|
String arguments = prop.getProperty("arguments" + i, "");
|
||||||
configs[i] = new EngineConfig(enabled, port, filename, arguments);
|
configs[i] = new EngineConfig(enabled, port, filename, arguments);
|
||||||
|
@ -119,7 +119,7 @@ public class EngineServer implements ErrorHandler {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
if ("-numengines".equals(args[i]) && i+1 < args.length) {
|
if ("-numengines".equals(args[i]) && i+1 < args.length) {
|
||||||
try {
|
try {
|
||||||
numEngines = Integer.valueOf(args[i+1]);
|
numEngines = Integer.parseInt(args[i+1]);
|
||||||
numEngines = Math.max(1, numEngines);
|
numEngines = Math.max(1, numEngines);
|
||||||
numEngines = Math.min(20, numEngines);
|
numEngines = Math.min(20, numEngines);
|
||||||
i++;
|
i++;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user