Better name for emum value

This commit is contained in:
Laurent Clouet
2015-04-07 20:05:48 +01:00
parent a1f1399e23
commit 9a970643c0
4 changed files with 13 additions and 13 deletions

View File

@@ -35,7 +35,7 @@ import com.sheepit.client.os.OS;
public class Configuration { public class Configuration {
public enum ComputeType { public enum ComputeType {
CPU_GPU, CPU_ONLY, GPU_ONLY CPU_GPU, CPU, GPU
} // accept job for ... } // accept job for ...
public File workingDirectory; public File workingDirectory;

View File

@@ -271,7 +271,7 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
HttpURLConnection connection = null; HttpURLConnection connection = null;
try { try {
String url = String.format("%s?computemethod=%s", this.getPage("request-job"), this.user_config.computeMethodToInt()); String url = String.format("%s?computemethod=%s", this.getPage("request-job"), this.user_config.computeMethodToInt());
if (this.user_config.getComputeMethod() != ComputeType.CPU_ONLY && this.user_config.getGPUDevice() != null) { if (this.user_config.getComputeMethod() != ComputeType.CPU && this.user_config.getGPUDevice() != null) {
String gpu_model = ""; String gpu_model = "";
try { try {
gpu_model = URLEncoder.encode(this.user_config.getGPUDevice().getModel(), "UTF-8"); gpu_model = URLEncoder.encode(this.user_config.getGPUDevice().getModel(), "UTF-8");

View File

@@ -104,7 +104,7 @@ public class Worker {
return; return;
} }
ComputeType compute_method = ComputeType.CPU_ONLY; ComputeType compute_method = ComputeType.CPU;
Configuration config = new Configuration(null, login, password); Configuration config = new Configuration(null, login, password);
config.setPrintLog(print_log); config.setPrintLog(print_log);
@@ -196,10 +196,10 @@ public class Worker {
} }
else { else {
if (config.getGPUDevice() == null) { if (config.getGPUDevice() == null) {
compute_method = ComputeType.CPU_ONLY; compute_method = ComputeType.CPU;
} }
else { else {
compute_method = ComputeType.GPU_ONLY; compute_method = ComputeType.GPU;
} }
} }
@@ -236,7 +236,7 @@ public class Worker {
config.setExtras(extras); config.setExtras(extras);
} }
if (compute_method == ComputeType.CPU_ONLY && config.getGPUDevice() != null) { if (compute_method == ComputeType.CPU && config.getGPUDevice() != null) {
System.err.println("You choose to only use the CPU but a GPU was also provided. You can not do both."); System.err.println("You choose to only use the CPU but a GPU was also provided. You can not do both.");
System.err.println("Aborting"); System.err.println("Aborting");
System.exit(2); System.exit(2);
@@ -246,12 +246,12 @@ public class Worker {
System.err.println("Aborting"); System.err.println("Aborting");
System.exit(2); System.exit(2);
} }
else if (compute_method == ComputeType.GPU_ONLY && config.getGPUDevice() == null) { else if (compute_method == ComputeType.GPU && config.getGPUDevice() == null) {
System.err.println("You choose to only use the GPU but no GPU device was provided."); System.err.println("You choose to only use the GPU but no GPU device was provided.");
System.err.println("Aborting"); System.err.println("Aborting");
System.exit(2); System.exit(2);
} }
else if (compute_method == ComputeType.CPU_ONLY) { else if (compute_method == ComputeType.CPU) {
config.setUseGPU(null); // remove the GPU config.setUseGPU(null); // remove the GPU
} }

View File

@@ -130,11 +130,11 @@ public class Settings implements Activity {
useCPU.setSelected(true); useCPU.setSelected(true);
gpuChecked = true; gpuChecked = true;
} }
else if (method == ComputeType.CPU_ONLY) { else if (method == ComputeType.CPU) {
useCPU.setSelected(true); useCPU.setSelected(true);
gpuChecked = false; gpuChecked = false;
} }
else if (method == ComputeType.GPU_ONLY) { else if (method == ComputeType.GPU) {
useCPU.setSelected(false); useCPU.setSelected(false);
gpuChecked = true; gpuChecked = true;
} }
@@ -279,12 +279,12 @@ public class Settings implements Activity {
} }
} }
ComputeType method = ComputeType.CPU_ONLY; ComputeType method = ComputeType.CPU;
if (useCPU.isSelected() && selected_gpu == null) { if (useCPU.isSelected() && selected_gpu == null) {
method = ComputeType.CPU_ONLY; method = ComputeType.CPU;
} }
else if (useCPU.isSelected() == false && selected_gpu != null) { else if (useCPU.isSelected() == false && selected_gpu != null) {
method = ComputeType.GPU_ONLY; method = ComputeType.GPU;
} }
else if (useCPU.isSelected() && selected_gpu != null) { else if (useCPU.isSelected() && selected_gpu != null) {
method = ComputeType.CPU_GPU; method = ComputeType.CPU_GPU;