Cleanup: Use foreach whenever is possible
This commit is contained in:
committed by
Laurent Clouet
parent
c6dafb3bf6
commit
3ea4107dc1
@@ -536,8 +536,8 @@ public class Client {
|
||||
new_env.put("BLENDER_USER_CONFIG", this.config.workingDirectory.getAbsolutePath().replace("\\", "\\\\"));
|
||||
|
||||
int index = 0;
|
||||
for (int i = 0; i < command1.length; i++) {
|
||||
if (command1[i].equals(".c")) {
|
||||
for (String arg : command1) {
|
||||
if (arg.equals(".c")) {
|
||||
command[index] = ajob.getScenePath();
|
||||
index += 1;
|
||||
command[index] = "-P";
|
||||
@@ -563,7 +563,7 @@ public class Client {
|
||||
}
|
||||
script_file.deleteOnExit();
|
||||
}
|
||||
else if (command1[i].equals(".e")) {
|
||||
else if (arg.equals(".e")) {
|
||||
command[index] = ajob.getRendererPath();
|
||||
// the number of cores has to be put after the binary and before the scene arg
|
||||
if (this.config.getNbCores() > 0) {
|
||||
@@ -574,14 +574,14 @@ public class Client {
|
||||
//index += 1; // do not do it, it will be done at the end of the loop
|
||||
}
|
||||
}
|
||||
else if (command1[i].equals(".o")) {
|
||||
else if (arg.equals(".o")) {
|
||||
command[index] = this.config.workingDirectory.getAbsolutePath() + File.separator + ajob.getPrefixOutputImage();
|
||||
}
|
||||
else if (command1[i].equals(".f")) {
|
||||
else if (arg.equals(".f")) {
|
||||
command[index] = ajob.getFrameNumber();
|
||||
}
|
||||
else {
|
||||
command[index] = command1[i];
|
||||
command[index] = arg;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
|
||||
@@ -197,8 +197,7 @@ public class Configuration {
|
||||
|
||||
File[] files = dir.listFiles();
|
||||
if (files != null) {
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
File file = files[i];
|
||||
for (File file : files) {
|
||||
if (file.isDirectory()) {
|
||||
Utils.delete(file);
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ public class Error {
|
||||
|
||||
public static ServerCode fromInt(int val) {
|
||||
ServerCode[] As = ServerCode.values();
|
||||
for (int i = 0; i < As.length; i++) {
|
||||
if (As[i].getValue() == val) {
|
||||
return As[i];
|
||||
for (ServerCode A : As) {
|
||||
if (A.getValue() == val) {
|
||||
return A;
|
||||
}
|
||||
}
|
||||
return ServerCode.UNKNOWN;
|
||||
|
||||
@@ -155,8 +155,8 @@ public class Utils {
|
||||
if (directory_.isDirectory()) {
|
||||
File[] list = directory_.listFiles();
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
double max1 = lastModificationTime(list[i]);
|
||||
for (File aFile : list) {
|
||||
double max1 = lastModificationTime(aFile);
|
||||
if (max1 > max) {
|
||||
max = max1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user